summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-06-09 13:56:10 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-06-09 14:01:44 -0400
commit9636fd100f5391a5404da2175d31ec744b73cd50 (patch)
tree24159ab2f04168f9b7a179b5c57413a978aa7105
parent9872c03145f3b597244880d440530ba02e1190b0 (diff)
downloadopenshift-9636fd100f5391a5404da2175d31ec744b73cd50.tar.gz
openshift-9636fd100f5391a5404da2175d31ec744b73cd50.tar.bz2
openshift-9636fd100f5391a5404da2175d31ec744b73cd50.tar.xz
openshift-9636fd100f5391a5404da2175d31ec744b73cd50.zip
Added more verbosity when error happens. Also fixed a bug.
-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