add debug about the execution of the variation salt state files
authorPaul Tonelli <paul.tonelli@logilab.fr>
Fri, 24 May 2013 14:05:29 +0200
changeset 129 9d4caa5f760e
parent 128 91b237a7720f
child 130 0de6a4286bae
add debug about the execution of the variation salt state files
_modules/vm_create.py
--- a/_modules/vm_create.py	Thu May 30 13:56:09 2013 +0200
+++ b/_modules/vm_create.py	Fri May 24 14:05:29 2013 +0200
@@ -42,7 +42,8 @@
         salt '*' vm_create.variate_image /mnt/variation
 
     '''
-    log.info(_chroot_exec(path, 'salt-call  --local state.highstate'))
+    _print_if_error(_chroot_exec(path, 'salt-call  --local state.highstate'),
+                    info=True)
     return True
 
 def upload_to_glance(path):
@@ -78,7 +79,9 @@
 def _chroot_exec(chroot_path, command):
     return __salt__['cmd.run_all']('chroot ' + chroot_path + ' ' + command)
 
-def _print_if_error(ret):
+def _print_if_error(ret, info=False):
+    if info:
+        log.info(ret['stdout'])
     if ret['retcode'] != 0:
         log.error(ret['stderr'])