Skip to content

Commit

Permalink
Do not fails if JSON cannot be decoded (#176)
Browse files Browse the repository at this point in the history
Fix #174
  • Loading branch information
enolfc authored and gwarf committed Oct 18, 2019
1 parent 3cc7475 commit 31c0f70
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cloud_info_provider/providers/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,13 @@ def get_images(self, **kwargs):
marketplace_id = image.get('vmcatcher_event_ad_mpuri',
image.get('marketplace'))

extra_attrs = json.loads(image.get('APPLIANCE_ATTRIBUTES', '{}'))
try:
extra_attrs = json.loads(image.get('APPLIANCE_ATTRIBUTES',
'{}'))
except ValueError:
logging.warning("Unexpected issue while getting json for '%s'",
image.get('APPLIANCE_ATTRIBUTES', '{}'))
extra_attrs = {}
if 'ad:base_mpuri' in extra_attrs:
aux_img['other_info'].append('base_mpuri=%s'
% extra_attrs['ad:base_mpuri'])
Expand Down

0 comments on commit 31c0f70

Please sign in to comment.