diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2015-06-09 14:05:44 -0400 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2015-06-09 14:05:44 -0400 |
commit | 8afff8357bc56bc7bfa0ad7334b7ccc0b024718c (patch) | |
tree | 24159ab2f04168f9b7a179b5c57413a978aa7105 | |
parent | 9872c03145f3b597244880d440530ba02e1190b0 (diff) | |
parent | 9636fd100f5391a5404da2175d31ec744b73cd50 (diff) | |
download | openshift-8afff8357bc56bc7bfa0ad7334b7ccc0b024718c.tar.gz openshift-8afff8357bc56bc7bfa0ad7334b7ccc0b024718c.tar.bz2 openshift-8afff8357bc56bc7bfa0ad7334b7ccc0b024718c.tar.xz openshift-8afff8357bc56bc7bfa0ad7334b7ccc0b024718c.zip |
Merge pull request #274 from kwoodson/multi_fixes
multi_ec2 fixes.
-rwxr-xr-x | inventory/multi_ec2.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/inventory/multi_ec2.py b/inventory/multi_ec2.py index f8196aefd..b7ce9e5dc 100755 --- a/inventory/multi_ec2.py +++ b/inventory/multi_ec2.py @@ -82,7 +82,6 @@ class MultiEc2(object): else: raise RuntimeError("Could not find valid ec2 credentials in the environment.") - # Set the default cache path but if its defined we'll assign it. if self.config.has_key('cache_location'): self.cache_path = self.config['cache_location'] @@ -217,7 +216,12 @@ class MultiEc2(object): # For any non-zero, raise an error on it for result in provider_results: if result['code'] != 0: - raise RuntimeError(result['err']) + err_msg = ['\nProblem fetching account: {name}', + 'Error Code: {code}', + 'StdErr: {err}', + 'Stdout: {out}', + ] + raise RuntimeError('\n'.join(err_msg).format(**result)) else: self.all_ec2_results[result['name']] = json.loads(result['out']) @@ -248,8 +252,9 @@ class MultiEc2(object): data[str(host_property)] = str(value) # Add this group - results["%s_%s" % (host_property, value)] = \ - copy.copy(results[acc_config['all_group']]) + if results.has_key(acc_config['all_group']): + results["%s_%s" % (host_property, value)] = \ + copy.copy(results[acc_config['all_group']]) # store the results back into all_ec2_results self.all_ec2_results[acc_config['name']] = results |