Commit 1f2ee67d authored by Yingjie Xu's avatar Yingjie Xu

Simplify file reading and catch exception for type converting.

parent 5f722223
......@@ -575,14 +575,15 @@ class Slapgrid(object):
self.instance_root, computer_partition_id)
timestamp_path = os.path.join(instance_path, '.timestamp')
if os.path.exists(timestamp_path):
descriptor = open(timestamp_path)
old_timestamp = int(descriptor.read())
descriptor.close()
old_timestamp = open(timestamp_path).read()
parameter_dict = computer_partition.getInstanceParameterDict()
if 'timestamp' in parameter_dict:
timestamp = int(parameter_dict['timestamp'])
if timestamp <= old_timestamp:
continue
timestamp = parameter_dict['timestamp']
try:
if int(timestamp) <= int(old_timestamp):
continue
except ValueError:
pass
try:
software_url = computer_partition.getSoftwareRelease().getURI()
except NotFoundError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment