mirror of
https://github.com/ansible/awx.git
synced 2026-07-01 11:28:02 -02:30
Updated inventory plugins from ansible, updated all third party packages in awx/lib/site-packages to latest versions, minor serializer fixes after package upgrades.
This commit is contained in:
@@ -223,9 +223,12 @@ class Ec2Inventory(object):
|
||||
config.get('ec2', 'route53_excluded_zones', '').split(','))
|
||||
|
||||
# Cache related
|
||||
cache_path = config.get('ec2', 'cache_path')
|
||||
self.cache_path_cache = cache_path + "/ansible-ec2.cache"
|
||||
self.cache_path_index = cache_path + "/ansible-ec2.index"
|
||||
cache_dir = os.path.expanduser(config.get('ec2', 'cache_path'))
|
||||
if not os.path.exists(cache_dir):
|
||||
os.makedirs(cache_dir)
|
||||
|
||||
self.cache_path_cache = cache_dir + "/ansible-ec2.cache"
|
||||
self.cache_path_index = cache_dir + "/ansible-ec2.index"
|
||||
self.cache_max_age = config.getint('ec2', 'cache_max_age')
|
||||
|
||||
|
||||
@@ -251,7 +254,7 @@ class Ec2Inventory(object):
|
||||
|
||||
for region in self.regions:
|
||||
self.get_instances_by_region(region)
|
||||
# Don't return RDS instances for AWX!
|
||||
# Don't return RDS instances for Ansible Tower!
|
||||
#self.get_rds_instances_by_region(region)
|
||||
|
||||
self.write_to_cache(self.inventory, self.cache_path_cache)
|
||||
@@ -279,7 +282,7 @@ class Ec2Inventory(object):
|
||||
for instance in reservation.instances:
|
||||
self.add_instance(instance, region)
|
||||
|
||||
except boto.exception.BotoServerError as e:
|
||||
except boto.exception.BotoServerError, e:
|
||||
if not self.eucalyptus:
|
||||
print "Looks like AWS is down again:"
|
||||
print e
|
||||
@@ -295,10 +298,11 @@ class Ec2Inventory(object):
|
||||
instances = conn.get_all_dbinstances()
|
||||
for instance in instances:
|
||||
self.add_rds_instance(instance, region)
|
||||
except boto.exception.BotoServerError as e:
|
||||
print "Looks like AWS RDS is down: "
|
||||
print e
|
||||
sys.exit(1)
|
||||
except boto.exception.BotoServerError, e:
|
||||
if not e.reason == "Forbidden":
|
||||
print "Looks like AWS RDS is down: "
|
||||
print e
|
||||
sys.exit(1)
|
||||
|
||||
def get_instance(self, region, instance_id):
|
||||
''' Gets details about a specific instance '''
|
||||
@@ -340,7 +344,7 @@ class Ec2Inventory(object):
|
||||
# Add to index
|
||||
self.index[dest] = [region, instance.id]
|
||||
|
||||
# Do not output group based on instance ID for AWX!
|
||||
# Do not output group based on instance ID for Ansible Tower!
|
||||
# Inventory: Group by instance ID (always a group of 1)
|
||||
#self.inventory[instance.id] = [dest]
|
||||
|
||||
@@ -508,6 +512,8 @@ class Ec2Inventory(object):
|
||||
instance_vars[key] = ''
|
||||
elif key == 'ec2_region':
|
||||
instance_vars[key] = value.name
|
||||
elif key == 'ec2__placement':
|
||||
instance_vars['ec2_placement'] = value.zone
|
||||
elif key == 'ec2_tags':
|
||||
for k, v in value.iteritems():
|
||||
key = self.to_safe('ec2_tag_' + k)
|
||||
|
||||
Reference in New Issue
Block a user