mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Merge pull request #4842 from cchurch/devel
Retrieve EC2 state when using newer versions of Boto
This commit is contained in:
@@ -502,7 +502,14 @@ class Ec2Inventory(object):
|
|||||||
key = self.to_safe('ec2_' + key)
|
key = self.to_safe('ec2_' + key)
|
||||||
|
|
||||||
# Handle complex types
|
# Handle complex types
|
||||||
if type(value) in [int, bool]:
|
# state/previous_state changed to properties in boto in https://github.com/boto/boto/commit/a23c379837f698212252720d2af8dec0325c9518
|
||||||
|
if key == 'ec2__state':
|
||||||
|
instance_vars['ec2_state'] = instance.state or ''
|
||||||
|
instance_vars['ec2_state_code'] = instance.state_code
|
||||||
|
elif key == 'ec2__previous_state':
|
||||||
|
instance_vars['ec2_previous_state'] = instance.previous_state or ''
|
||||||
|
instance_vars['ec2_previous_state_code'] = instance.previous_state_code
|
||||||
|
elif type(value) in [int, bool]:
|
||||||
instance_vars[key] = value
|
instance_vars[key] = value
|
||||||
elif type(value) in [str, unicode]:
|
elif type(value) in [str, unicode]:
|
||||||
instance_vars[key] = value.strip()
|
instance_vars[key] = value.strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user