change return code in variate_image depending on return code of command
authorPaul Tonelli <paul.tonelli@logilab.fr>
Mon, 13 May 2013 11:04:44 +0200
changeset 131 1c0ac68a3211
parent 130 0de6a4286bae
child 132 ebe7a4805f96
change return code in variate_image depending on return code of command
_modules/vm_create.py
--- a/_modules/vm_create.py	Mon Apr 29 10:32:07 2013 +0200
+++ b/_modules/vm_create.py	Mon May 13 11:04:44 2013 +0200
@@ -42,9 +42,8 @@
         salt '*' vm_create.variate_image /mnt/variation
 
     '''
-    _print_if_error(_chroot_exec(path, 'salt-call  --local state.highstate'),
+    return _print_if_error(_chroot_exec(path, 'salt-call  --local state.highstate'),
                     info=True)
-    return True
 
 def upload_to_glance(path):
     log.info('will now try to upload to glance server')
@@ -84,6 +83,8 @@
         log.info(ret['stdout'])
     if ret['retcode'] != 0:
         log.error(ret['stderr'])
+        return False
+    return True
 
 def _find_objects(path, substring):
     object_names = [element for element in listdir(path)