[cloud] Fixes #26045 Ensure instance.instance_profile is not None before casting to dict (#26047)

This commit is contained in:
Ryan Fitzpatrick 2017-06-23 12:33:55 -04:00 committed by Ryan Brown
parent a439f45a18
commit 3e52f47b51

View file

@ -108,9 +108,11 @@ def get_instance_info(instance):
except AttributeError: except AttributeError:
pass pass
instance_profile = dict(instance.instance_profile) if instance.instance_profile is not None else None
instance_info = { 'id': instance.id, instance_info = { 'id': instance.id,
'kernel': instance.kernel, 'kernel': instance.kernel,
'instance_profile': dict(instance.instance_profile), 'instance_profile': instance_profile,
'root_device_type': instance.root_device_type, 'root_device_type': instance.root_device_type,
'private_dns_name': instance.private_dns_name, 'private_dns_name': instance.private_dns_name,
'public_dns_name': instance.public_dns_name, 'public_dns_name': instance.public_dns_name,