Browse Source

Merge "Complete overcloud deploy --baremetal-deployment" into stable/train

changes/96/701296/3
Zuul Gerrit Code Review 3 weeks ago
parent
commit
66c3fabfd4
2 changed files with 28 additions and 1 deletions
  1. +11
    -1
      tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py
  2. +17
    -0
      tripleoclient/v1/overcloud_deploy.py

+ 11
- 1
tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py View File

@@ -1504,11 +1504,14 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.cmd.take_action,
parsed_args)

@mock.patch('tripleoclient.workflows.baremetal.undeploy_roles',
autospec=True)
@mock.patch('tripleoclient.workflows.baremetal.deploy_roles',
autospec=True)
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_write_user_environment', autospec=True)
def test_provision_baremetal(self, mock_write, mock_deploy_roles):
def test_provision_baremetal(self, mock_write, mock_deploy_roles,
mock_undeploy_roles):
mock_write.return_value = (
'/tmp/tht/user-environments/baremetal-deployed.yaml',
'overcloud/user-environments/baremetal-deployed.yaml'
@@ -1542,16 +1545,23 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):

tht_root = '/tmp/tht'
result = self.cmd._provision_baremetal(parsed_args, tht_root)
self.cmd._unprovision_baremetal(parsed_args)
self.assertEqual(
['/tmp/tht/user-environments/baremetal-deployed.yaml'],
result
)
mock_deploy_roles.assert_called_once_with(
self.app.client_manager,
plan='overcloud',
roles=deploy_data,
ssh_keys=['sekrit'],
ssh_user_name='heat-admin'
)
mock_undeploy_roles.assert_called_once_with(
self.app.client_manager,
plan='overcloud',
roles=deploy_data
)
mock_write.assert_called_once_with(
self.cmd,
{'parameter_defaults': {'foo': 'bar'}},


+ 17
- 0
tripleoclient/v1/overcloud_deploy.py View File

@@ -471,6 +471,8 @@ class DeployOvercloud(command.Command):
parsed_args.plan_environment_file,
deployment_options=deployment_options)

self._unprovision_baremetal(parsed_args)

def _try_overcloud_deploy_with_compat_yaml(self, tht_root, stack,
stack_name, parameters,
env_files, timeout,
@@ -625,6 +627,7 @@ class DeployOvercloud(command.Command):

parameter_defaults = baremetal.deploy_roles(
self.app.client_manager,
plan=parsed_args.stack,
roles=roles, ssh_keys=[ssh_key],
ssh_user_name=parsed_args.overcloud_ssh_user)

@@ -635,6 +638,20 @@ class DeployOvercloud(command.Command):
parsed_args.stack)
return [env_path]

def _unprovision_baremetal(self, parsed_args):

if not parsed_args.baremetal_deployment:
return

with open(parsed_args.baremetal_deployment, 'r') as fp:
roles = yaml.safe_load(fp)

baremetal.undeploy_roles(
self.app.client_manager,
plan=parsed_args.stack,
roles=roles
)

def get_parser(self, prog_name):
# add_help doesn't work properly, set it to False:
parser = argparse.ArgumentParser(


Loading…
Cancel
Save