import shutil
 import io
 import re
+import sys
 import netaddr
 import uuid
 import yaml
     def deploy_env(self):
         dep = CloudDeploy(self.dha, self.fuel_conf['ip'], self.fuel_username,
                           self.fuel_password, self.dea_file, WORK_DIR)
-        dep.deploy()
+        return dep.deploy()
 
     def setup_execution_environment(self):
         exec_env = ExecutionEnvironment(self.storage_dir, self.pxe_bridge,
             self.create_tmp_dir()
             self.install_fuel_master()
             shutil.rmtree(self.tmp_dir)
-        self.deploy_env()
+        return self.deploy_env()
 
 def check_bridge(pxe_bridge, dha_path):
     with io.open(dha_path) as yaml_file:
 
     d = AutoDeploy(without_fuel, storage_dir, pxe_bridge, iso_file,
                    dea_file, dha_file)
-    d.deploy()
+    sys.exit(d.deploy())
 
 if __name__ == '__main__':
     main()
\ No newline at end of file
 
         dea_file = '%s/%s' % (self.work_dir, os.path.basename(self.dea_file))
         macs_file = '%s/%s' % (self.work_dir, os.path.basename(self.macs_file))
         with self.ssh as s:
-            s.run('python %s %s %s' % (deploy_app, dea_file, macs_file))
+            status = s.run('python %s %s %s'
+                           % (deploy_app, dea_file, macs_file))
+        return status
 
     def deploy(self):
 
 
         self.upload_cloud_deployment_files()
 
-        self.run_cloud_deploy(CLOUD_DEPLOY_FILE)
+        return self.run_cloud_deploy(CLOUD_DEPLOY_FILE)
 
                 while error_buff:
                     log(error_buff.strip())
                     error_buff = chan.recv_stderr(1024)
+        return chan.recv_exit_status()
 
     def scp_get(self, remote, local='.', dir=False):
         try: