X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetstack%2Fopenstack_observer%2Fansible.py;h=5761327428d30ee1d87a24b21511d15947cea99a;hb=94adfd8f36fbe58c0af25d021319f8e2795e02e1;hp=8570c17292b65a8ae1c8cf42720dd696642fbe82;hpb=43e37ab9119107c59488919f67f448c07a0f9a88;p=plstackapi.git diff --git a/planetstack/openstack_observer/ansible.py b/planetstack/openstack_observer/ansible.py index 8570c17..5761327 100755 --- a/planetstack/openstack_observer/ansible.py +++ b/planetstack/openstack_observer/ansible.py @@ -46,7 +46,6 @@ def run_template(name, opts,path=''): template = os_template_env.get_template(name) buffer = template.render(opts) - import pdb #f = open('/tmp/obsans','w') try: @@ -61,7 +60,6 @@ def run_template(name, opts,path=''): f.write(buffer) f.flush() - #os.system('cp %s %s-backup'%(fqp,fqp)) run = os.popen('/opt/planetstack/observer/run_ansible '+fqp) msg = run.read() status = run.close() @@ -69,8 +67,17 @@ def run_template(name, opts,path=''): try: ok_results = parse_output(msg) except ValueError,e: - print str(e) - raise e + all_fatal = re.findall(r'^msg: (.*)',msg,re.MULTILINE) + all_fatal2 = re.findall(r'^ERROR: (.*)',msg,re.MULTILINE) + + + all_fatal.extend(all_fatal2) + try: + error = ' // '.join(all_fatal) + except: + pass + raise Exception(error) + return ok_results def main():