summaryrefslogtreecommitdiffstats
path: root/inventory/multi_ec2.py
diff options
context:
space:
mode:
authorTroy Dawson <tdawson@redhat.com>2015-06-12 12:49:37 -0500
committerTroy Dawson <tdawson@redhat.com>2015-06-12 12:49:37 -0500
commitc650920bc7b0043e59fa3439f48f61d5fa211f2d (patch)
tree3e1f882f5bc7fe419f13a134a71927cb6484fa86 /inventory/multi_ec2.py
parent124ca40c134a40b2e6823ab3c4bfe329580d7eaa (diff)
parent42806b6745c747843b71eaf08b62aeee5e450ab1 (diff)
downloadopenshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.tar.gz
openshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.tar.bz2
openshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.tar.xz
openshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.zip
Merge branch 'master' into prod
Diffstat (limited to 'inventory/multi_ec2.py')
-rwxr-xr-xinventory/multi_ec2.py13
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