diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2015-10-29 16:00:28 -0400 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2015-10-29 16:00:28 -0400 |
commit | 893a8cc09b9f718cc177a11c8c1d04de50d05fd5 (patch) | |
tree | 9af3afd37d06b195d5efad04b1e6b9914640989b /inventory | |
parent | 947de774fdc0022caf0e3083dca4e085984272d5 (diff) | |
parent | 39dcaf35142bf335957db23358c14513779ac802 (diff) | |
download | openshift-893a8cc09b9f718cc177a11c8c1d04de50d05fd5.tar.gz openshift-893a8cc09b9f718cc177a11c8c1d04de50d05fd5.tar.bz2 openshift-893a8cc09b9f718cc177a11c8c1d04de50d05fd5.tar.xz openshift-893a8cc09b9f718cc177a11c8c1d04de50d05fd5.zip |
Merge pull request #770 from kwoodson/multi_fix
Updating multi_ec2 to support extra_vars and extra_groups
Diffstat (limited to 'inventory')
-rwxr-xr-x | inventory/multi_ec2.py | 31 |
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(): |