if buildmonitor_enabled:
bm_img_url = os.path.join(sync_src, fields['images_path'])
- bm_img_path = bm_img_url + '/' + build_id + '_' + fields['name'] + '.tar.gz'
- bm_img_size = os.path.getsize(bm_img_path)
- #print '[%s] bm_img_path(%s), bm_img_size(%s)\n' \
- # % (__file__, bm_img_path, bm_img_size)
+
+ # get bm_img_name from 'manifest.json' file
+ search_name = 'image_files'
+ manifest_name = 'manifest.json'
+ bm_manifest_path = os.path.join(bm_img_url, manifest_name)
+ with open(bm_manifest_path,'r') as f:
+ bm_dict = eval(f.read())
+ for key, val in bm_dict.iteritems():
+ if isinstance(val, dict) and val.has_key(search_name):
+ bm_img_name = val.get(search_name)[0]
+
+ bm_img_path = os.path.join(bm_img_url, bm_img_name)
+ print '[%s] bm_img_path(%s))\n' % (__file__, bm_img_path)
+
+ if os.path.isfile(bm_img_path):
+ bm_img_size = os.path.getsize(bm_img_path)
+ #print '[%s] bm_img_path(%s), bm_img_size(%s)\n' \
+ # % (__file__, bm_img_path, bm_img_size)
+ else:
+ print '[%s] %s does not exist!!\n' % (__file__, bm_img_path)
+ bm_img_size = 0
bm_end_datetime = datetime.datetime.now()
bm_stage = 'Image'