Merge "Use existing stack parameter for DeployIdentifier"
This commit is contained in:
commit
81669071ed
@ -26,6 +26,7 @@ FAKE_STACK = {
|
||||
'ObjectStorageCount': 0,
|
||||
'BlockStorageCount': 0,
|
||||
'CephStorageCount': 0,
|
||||
'DeployIdentifier': '',
|
||||
},
|
||||
'stack_name': 'overcloud',
|
||||
'stack_status': "CREATE_COMPLETE",
|
||||
|
@ -109,6 +109,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_events):
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsFixture()
|
||||
@ -578,6 +582,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
def test_missing_sat_url(self, mock_deploy_tht):
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
|
||||
arglist = ['--templates', '--rhel-reg',
|
||||
'--reg-method', 'satellite', '--reg-org', '123456789',
|
||||
@ -825,6 +833,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.useFixture(utils_fixture)
|
||||
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
|
||||
workflow_client = clients.workflow_engine
|
||||
workflow_client.action_executions.create.return_value = mock.MagicMock(
|
||||
output='{"result":[]}')
|
||||
@ -867,6 +879,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_deploy_postconfig,
|
||||
mock_breakpoints_cleanup,
|
||||
mock_events):
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
@ -1062,6 +1078,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
def test_dry_run(self, mock_create_tempest_deployer_input):
|
||||
utils_fixture = deployment.UtilsOvercloudFixture()
|
||||
self.useFixture(utils_fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
arglist = ['--templates', '--dry-run']
|
||||
verifylist = [
|
||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
||||
@ -1082,6 +1102,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_heat_deploy):
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsOvercloudFixture()
|
||||
@ -1202,6 +1226,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_create_parameters_env):
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
|
||||
arglist = ['--templates', '--control-scale', '3']
|
||||
verifylist = [
|
||||
@ -1429,7 +1457,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
clients.baremetal = mock.Mock()
|
||||
clients.compute = mock.Mock()
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
self.assertTrue(mock_deploy_tmpdir.called)
|
||||
@ -1467,7 +1495,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.useFixture(utils_fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
|
||||
|
||||
arglist = ['--templates', '--config-download']
|
||||
verifylist = [
|
||||
@ -1498,7 +1526,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.useFixture(utils_fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
|
||||
|
||||
arglist = ['--templates', '--config-download-only']
|
||||
verifylist = [
|
||||
@ -1533,7 +1561,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.useFixture(fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
|
||||
|
||||
arglist = ['--templates', '--config-download-only']
|
||||
verifylist = [
|
||||
@ -1569,7 +1597,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.useFixture(utils_fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
|
||||
|
||||
arglist = ['--templates',
|
||||
'--override-ansible-cfg', 'ansible.cfg']
|
||||
@ -1598,7 +1626,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.useFixture(utils_fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
|
||||
|
||||
arglist = ['--templates', '--config-download-timeout', '240']
|
||||
verifylist = [
|
||||
|
@ -51,7 +51,7 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
||||
def test_update_out(self, mock_deploy, mock_open, mock_copy, mock_yaml,
|
||||
mock_abspath, mock_update, mock_logger,
|
||||
mock_get_stack):
|
||||
mock_stack = mock.Mock()
|
||||
mock_stack = mock.Mock(parameters={'DeployIdentifier': ''})
|
||||
mock_stack.stack_name = 'overcloud'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
@ -74,6 +74,8 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
||||
container='overcloud',
|
||||
)
|
||||
|
||||
@mock.patch('tripleoclient.utils.get_stack',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.package_update.update',
|
||||
autospec=True)
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
@ -83,7 +85,11 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
def test_update_failed(self, mock_deploy, mock_copy, mock_yaml,
|
||||
mock_abspath, mock_open, mock_update):
|
||||
mock_abspath, mock_open, mock_update,
|
||||
mock_get_stack):
|
||||
mock_stack = mock.Mock(parameters={'DeployIdentifier': ''})
|
||||
mock_stack.stack_name = 'overcloud'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
mock_update.side_effect = exceptions.DeploymentError()
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
argslist = ['--stack', 'overcloud', '--templates', ]
|
||||
|
@ -68,7 +68,7 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
||||
mock_overcloudrc,
|
||||
mock_enable_ssh_admin):
|
||||
|
||||
mock_stack = mock.Mock()
|
||||
mock_stack = mock.Mock(parameters={'DeployIdentifier': ''})
|
||||
mock_stack.stack_name = 'overcloud'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
@ -96,6 +96,8 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
||||
parsed_args.overcloud_ssh_network,
|
||||
parsed_args.overcloud_ssh_user, parsed_args.overcloud_ssh_key)
|
||||
|
||||
@mock.patch('tripleoclient.utils.get_stack',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.prepend_environment', autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.package_update.update',
|
||||
autospec=True)
|
||||
@ -106,9 +108,13 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
def test_upgrade_failed(self, mock_deploy, mock_copy, mock_yaml,
|
||||
mock_abspath, mock_open, mock_upgrade, add_env):
|
||||
mock_abspath, mock_open, mock_upgrade,
|
||||
add_env, mock_get_stack):
|
||||
mock_upgrade.side_effect = exceptions.DeploymentError()
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
mock_stack = mock.Mock(parameters={'DeployIdentifier': ''})
|
||||
mock_stack.stack_name = 'overcloud'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
add_env = mock.Mock()
|
||||
add_env.return_value = True
|
||||
argslist = ['--stack', 'overcloud', '--templates', ]
|
||||
|
@ -71,7 +71,12 @@ class DeployOvercloud(command.Command):
|
||||
# *Identifier will be update to timestamp value during the deploy
|
||||
# workflow, but till then for all heat stack validations, we need
|
||||
# and entry for starting the deploy action.
|
||||
parameters['DeployIdentifier'] = ''
|
||||
if stack_is_new:
|
||||
parameters['DeployIdentifier'] = ''
|
||||
else:
|
||||
parameters[
|
||||
'DeployIdentifier'] = stack.parameters['DeployIdentifier']
|
||||
|
||||
parameters['UpdateIdentifier'] = ''
|
||||
parameters['StackAction'] = 'CREATE' if stack_is_new else 'UPDATE'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user