diff options
Diffstat (limited to 'deploy')
-rw-r--r-- | deploy/cloud/deploy.py | 17 | ||||
-rwxr-xr-x | deploy/deploy.py | 19 | ||||
-rw-r--r-- | deploy/deploy_env.py | 9 |
3 files changed, 34 insertions, 11 deletions
diff --git a/deploy/cloud/deploy.py b/deploy/cloud/deploy.py index 07d5d578f..e00934bd9 100644 --- a/deploy/cloud/deploy.py +++ b/deploy/cloud/deploy.py @@ -22,6 +22,7 @@ from common import ( check_file_exists, commafy, ArgParser, + log, ) YAML_CONF_DIR = '/var/lib/opnfv' @@ -29,10 +30,12 @@ YAML_CONF_DIR = '/var/lib/opnfv' class Deploy(object): - def __init__(self, dea_file, no_health_check, deploy_timeout): + def __init__(self, dea_file, no_health_check, deploy_timeout, + no_deploy_environment): self.dea = DeploymentEnvironmentAdapter(dea_file) self.no_health_check = no_health_check self.deploy_timeout = deploy_timeout + self.no_deploy_environment = no_deploy_environment self.macs_per_blade = {} self.blades = self.dea.get_node_ids() self.blade_node_dict = self.dea.get_blade_node_map() @@ -62,7 +65,10 @@ class Deploy(object): dep = Deployment(self.dea, YAML_CONF_DIR, self.env_id, self.node_roles_dict, self.no_health_check, self.deploy_timeout) - dep.deploy() + if not self.no_deploy_environment: + dep.deploy() + else: + log('Configuration is done. Deployment is not launched.') def deploy(self): @@ -81,14 +87,19 @@ def parse_arguments(): parser.add_argument('-dt', dest='deploy_timeout', action='store', default=240, help='Deployment timeout (in minutes) ' '[default: 240]') + parser.add_argument('-nde', dest='no_deploy_environment', + action='store_true', default=False, + help=('Do not launch environment deployment')) parser.add_argument('dea_file', action='store', help='Deployment Environment Adapter: dea.yaml') + args = parser.parse_args() check_file_exists(args.dea_file) kwargs = {'dea_file': args.dea_file, 'no_health_check': args.no_health_check, - 'deploy_timeout': args.deploy_timeout} + 'deploy_timeout': args.deploy_timeout, + 'no_deploy_environment': args.no_deploy_environment} return kwargs diff --git a/deploy/deploy.py b/deploy/deploy.py index bc1dfdb49..f86f2be12 100755 --- a/deploy/deploy.py +++ b/deploy/deploy.py @@ -61,7 +61,7 @@ class AutoDeploy(object): def __init__(self, no_fuel, fuel_only, no_health_check, cleanup_only, cleanup, storage_dir, pxe_bridge, iso_file, dea_file, dha_file, fuel_plugins_dir, fuel_plugins_conf_dir, - no_plugins, deploy_timeout): + no_plugins, deploy_timeout, no_deploy_environment): self.no_fuel = no_fuel self.fuel_only = fuel_only self.no_health_check = no_health_check @@ -76,6 +76,7 @@ class AutoDeploy(object): self.fuel_plugins_conf_dir = fuel_plugins_conf_dir self.no_plugins = no_plugins self.deploy_timeout = deploy_timeout + self.no_deploy_environment = no_deploy_environment self.dea = (DeploymentEnvironmentAdapter(dea_file) if not cleanup_only else None) self.dha = DeploymentHardwareAdapter(dha_file) @@ -198,7 +199,8 @@ class AutoDeploy(object): dep = CloudDeploy(self.dea, self.dha, self.fuel_conf['ip'], self.fuel_username, self.fuel_password, self.dea_file, self.fuel_plugins_conf_dir, - WORK_DIR, self.no_health_check, self.deploy_timeout) + WORK_DIR, self.no_health_check, self.deploy_timeout, + self.no_deploy_environment) return dep.deploy() def setup_execution_environment(self): @@ -224,7 +226,8 @@ class AutoDeploy(object): self.install_fuel_master() if not self.fuel_only: return self.deploy_env() - return True + # Exit status + return 0 def run(self): check_if_root() @@ -235,7 +238,9 @@ class AutoDeploy(object): if self.cleanup: self.cleanup_execution_environment() return deploy_success - return True + # Exit status + return 0 + def check_bridge(pxe_bridge, dha_path): with io.open(dha_path) as yaml_file: @@ -317,6 +322,9 @@ def parse_arguments(): parser.add_argument('-dt', dest='deploy_timeout', action='store', default=240, help='Deployment timeout (in minutes) ' '[default: 240]') + parser.add_argument('-nde', dest='no_deploy_environment', + action='store_true', default=False, + help=('Do not launch environment deployment')) args = parser.parse_args() log(args) @@ -343,7 +351,8 @@ def parse_arguments(): 'fuel_plugins_dir': args.fuel_plugins_dir, 'fuel_plugins_conf_dir': args.fuel_plugins_conf_dir, 'no_plugins': args.no_plugins, - 'deploy_timeout': args.deploy_timeout} + 'deploy_timeout': args.deploy_timeout, + 'no_deploy_environment': args.no_deploy_environment} return kwargs diff --git a/deploy/deploy_env.py b/deploy/deploy_env.py index 3d1cdf430..aa861e102 100644 --- a/deploy/deploy_env.py +++ b/deploy/deploy_env.py @@ -35,7 +35,7 @@ class CloudDeploy(object): def __init__(self, dea, dha, fuel_ip, fuel_username, fuel_password, dea_file, fuel_plugins_conf_dir, work_dir, no_health_check, - deploy_timeout): + deploy_timeout, no_deploy_environment): self.dea = dea self.dha = dha self.fuel_ip = fuel_ip @@ -50,6 +50,7 @@ class CloudDeploy(object): self.work_dir = work_dir self.no_health_check = no_health_check self.deploy_timeout = deploy_timeout + self.no_deploy_environment = no_deploy_environment self.file_dir = os.path.dirname(os.path.realpath(__file__)) self.ssh = SSHClient(self.fuel_ip, self.fuel_username, self.fuel_password) @@ -105,10 +106,12 @@ class CloudDeploy(object): deploy_app = '%s/%s' % (self.work_dir, deploy_app) dea_file = '%s/%s' % (self.work_dir, os.path.basename(self.dea_file)) with self.ssh as s: - status = s.run('python %s %s %s %s' % ( + status = s.run('python %s %s %s %s %s' % ( deploy_app, ('-nh' if self.no_health_check else ''), - ('-dt %s' % self.deploy_timeout if self.deploy_timeout else ''), + ('-dt %s' % + self.deploy_timeout if self.deploy_timeout else ''), + ('-nde' if self.no_deploy_environment else ''), dea_file)) return status |