Commit 08163c62 by Seth Vidal

catch all exceptions and emit sensible errors - if we have a config file error…

catch all exceptions and emit sensible errors - if we have a config file error this lets us know about it
parent 5764ccdb
...@@ -311,16 +311,23 @@ def main(): ...@@ -311,16 +311,23 @@ def main():
if 'list' in params: if 'list' in params:
my = yum_base(conf_file=params['conf_file'], cachedir=True) try:
results = dict(results=list_stuff(my, params['list'])) my = yum_base(conf_file=params['conf_file'], cachedir=True)
results = dict(results=list_stuff(my, params['list']))
except Exception, e:
return 1, str(e)
elif 'state' in params: elif 'state' in params:
if 'pkg' not in params: if 'pkg' not in params:
results['msg'] = "No pkg specified" results['msg'] = "No pkg specified"
else: else:
my = yum_base(conf_file=params['conf_file'], cachedir=True) try:
state = params['state'] my = yum_base(conf_file=params['conf_file'], cachedir=True)
pkgspec = params['pkg'] state = params['state']
results = ensure(my, state, pkgspec) pkgspec = params['pkg']
results = ensure(my, state, pkgspec)
except Exception, e:
return 1, str(e)
print json.dumps(results) print json.dumps(results)
return 0, None return 0, None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment