summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-10-29 15:58:44 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-10-29 15:58:44 -0400
commit39dcaf35142bf335957db23358c14513779ac802 (patch)
tree9af3afd37d06b195d5efad04b1e6b9914640989b
parent947de774fdc0022caf0e3083dca4e085984272d5 (diff)
downloadopenshift-39dcaf35142bf335957db23358c14513779ac802.tar.gz
openshift-39dcaf35142bf335957db23358c14513779ac802.tar.bz2
openshift-39dcaf35142bf335957db23358c14513779ac802.tar.xz
openshift-39dcaf35142bf335957db23358c14513779ac802.zip
Updating multi_ec2 to support extra_vars and extra_groups
-rwxr-xr-xinventory/multi_ec2.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/inventory/multi_ec2.py b/inventory/multi_ec2.py
index 23cf5ecf1..98dde3f3c 100755
--- a/inventory/multi_ec2.py
+++ b/inventory/multi_ec2.py
@@ -241,23 +241,24 @@ class MultiEc2(object):
'''
results = self.all_ec2_results[acc_config['name']]
- # Update each hostvar with the newly desired key: value
- for new_var, value in acc_config.get('extra_vars', {}).items():
- # Verify the account results look sane
- # by checking for these keys ('_meta' and 'hostvars' exist)
- if results.has_key('_meta') and results['_meta'].has_key('hostvars'):
- for data in results['_meta']['hostvars'].values():
- data[str(new_var)] = str(value)
-
- # Add this group
- if results.has_key(acc_config['all_group']):
- results["%s_%s" % (new_var, value)] = \
- copy.copy(results[acc_config['all_group']])
+ # Update each hostvar with the newly desired key: value from extra_*
+ for _extra in ['extra_groups', 'extra_vars']:
+ for new_var, value in acc_config.get(_extra, {}).items():
+ # Verify the account results look sane
+ # by checking for these keys ('_meta' and 'hostvars' exist)
+ if results.has_key('_meta') and results['_meta'].has_key('hostvars'):
+ for data in results['_meta']['hostvars'].values():
+ data[str(new_var)] = str(value)
+
+ # Add this group
+ if _extra == 'extra_groups' and results.has_key(acc_config['all_group']):
+ results["%s_%s" % (new_var, value)] = \
+ copy.copy(results[acc_config['all_group']])
# Clone groups goes here
- for name_from, name_to in acc_config.get('clone_groups', {}).items():
- if results.has_key(name_from):
- results[name_to] = copy.copy(results[name_from])
+ for to_name, from_name in acc_config.get('clone_groups', {}).items():
+ if results.has_key(from_name):
+ results[to_name] = copy.copy(results[from_name])
# Clone vars goes here
for to_name, from_name in acc_config.get('clone_vars', {}).items():