diff options
author | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-06-18 11:32:57 +0200 |
---|---|---|
committer | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-06-18 13:34:09 +0200 |
commit | 9469f7b952505ca142c8f9e996aee5fe011017d3 (patch) | |
tree | c0210e43afe4f3ec61d908c28095e6a9e32dd8db | |
parent | 2654b0628e30f54b0b8e89208ab04204858cfae5 (diff) |
Catching exit status from remote deployment process
JIRA: [BGS-2] Create Fuel deployment script
Change-Id: I21997df2534ef3cb0ae9ed47a01e6625b8404af9
Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
-rw-r--r-- | fuel/deploy/deploy.py | 7 | ||||
-rw-r--r-- | fuel/deploy/deploy_env.py | 6 | ||||
-rw-r--r-- | fuel/deploy/ssh_client.py | 1 |
3 files changed, 9 insertions, 5 deletions
diff --git a/fuel/deploy/deploy.py b/fuel/deploy/deploy.py index 3305aed..402d0f2 100644 --- a/fuel/deploy/deploy.py +++ b/fuel/deploy/deploy.py @@ -2,6 +2,7 @@ import os import shutil import io import re +import sys import netaddr import uuid import yaml @@ -138,7 +139,7 @@ class AutoDeploy(object): 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, @@ -157,7 +158,7 @@ class AutoDeploy(object): 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: @@ -215,7 +216,7 @@ def main(): 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 diff --git a/fuel/deploy/deploy_env.py b/fuel/deploy/deploy_env.py index 48aec18..084f37e 100644 --- a/fuel/deploy/deploy_env.py +++ b/fuel/deploy/deploy_env.py @@ -68,7 +68,9 @@ class CloudDeploy(object): 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): @@ -84,4 +86,4 @@ class CloudDeploy(object): self.upload_cloud_deployment_files() - self.run_cloud_deploy(CLOUD_DEPLOY_FILE) + return self.run_cloud_deploy(CLOUD_DEPLOY_FILE) diff --git a/fuel/deploy/ssh_client.py b/fuel/deploy/ssh_client.py index 8bf87bc..0ec2edc 100644 --- a/fuel/deploy/ssh_client.py +++ b/fuel/deploy/ssh_client.py @@ -70,6 +70,7 @@ class SSHClient(object): 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: |