Display Horizon URL at the end of a deployment
Change-Id: Ie736926e6dfd6ac964956255048b5e3e31e30597 Depends-On: I966fc5c4d285f15a8d528aa3105c90fe5a3fbba1 Depends-On: I81eaf6ae00ee18e1bec4bb39a18a54e90e1ce5d5
This commit is contained in:
parent
fc7399df70
commit
24cd624e05
@ -61,6 +61,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
super(TestDeployOvercloud, self).tearDown()
|
||||
os.unlink(self.parameter_defaults_env_file)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
autospec=True)
|
||||
@mock.patch("heatclient.common.event_utils.get_events")
|
||||
@ -90,7 +92,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_deploy_postconfig,
|
||||
mock_create_parameters_env,
|
||||
mock_breakpoints_cleanupm,
|
||||
mock_events, mock_tarball):
|
||||
mock_events, mock_tarball,
|
||||
mock_get_horizon_url):
|
||||
|
||||
arglist = ['--templates', '--ceph-storage-scale', '3']
|
||||
verifylist = [
|
||||
@ -162,6 +165,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
|
||||
mock_create_tempest_deployer_input.assert_called_with()
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.parameters.invoke_plan_env_workflows',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.get_overcloud_endpoint', autospec=True)
|
||||
@ -197,7 +202,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_validate_args,
|
||||
mock_breakpoints_cleanup, mock_tarball,
|
||||
mock_postconfig, mock_get_overcloud_endpoint,
|
||||
mock_invoke_plan_env_wf):
|
||||
mock_invoke_plan_env_wf,
|
||||
mock_get_horizon_url):
|
||||
|
||||
arglist = ['--templates', '--ceph-storage-scale', '3',
|
||||
'--control-flavor', 'oooq_control', '--no-cleanup']
|
||||
@ -291,6 +297,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.assertEqual(env_map.get('parameter_defaults'),
|
||||
parameters_env.get('parameter_defaults'))
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.parameters.invoke_plan_env_workflows',
|
||||
autospec=True)
|
||||
@mock.patch('shutil.rmtree', autospec=True)
|
||||
@ -327,7 +335,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_validate_args, mock_breakpoints_cleanup,
|
||||
mock_tarball, mock_postconfig,
|
||||
mock_get_overcloud_endpoint, mock_shutil_rmtree,
|
||||
mock_invoke_plan_env_wf):
|
||||
mock_invoke_plan_env_wf, mock_get_horizon_url):
|
||||
arglist = ['--templates', '-p', 'the-plan-environment.yaml']
|
||||
verifylist = [
|
||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
||||
@ -424,6 +432,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
clients.tripleoclient.object_store.put_object.assert_called()
|
||||
self.assertTrue(mock_invoke_plan_env_wf.called)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.parameters.'
|
||||
'check_deprecated_parameters', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.get_overcloud_endpoint', autospec=True)
|
||||
@ -461,7 +471,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_create_parameters_env, mock_validate_args,
|
||||
mock_breakpoints_cleanup, mock_tarball,
|
||||
mock_postconfig, mock_get_overcloud_endpoint,
|
||||
mock_deprecated_params):
|
||||
mock_deprecated_params, mock_get_horizon_url):
|
||||
|
||||
arglist = ['--templates', '--skip-deploy-identifier']
|
||||
verifylist = [
|
||||
@ -518,6 +528,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
deploy_plan_call_input = deploy_plan_call[1]['workflow_input']
|
||||
self.assertTrue(deploy_plan_call_input['skip_deploy_identifier'])
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
autospec=True)
|
||||
@mock.patch("heatclient.common.event_utils.get_events", autospec=True)
|
||||
@ -542,7 +554,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_deploy_postconfig,
|
||||
mock_breakpoints_cleanup,
|
||||
mock_events, mock_tarball):
|
||||
mock_events, mock_tarball,
|
||||
mock_get_horizon_url):
|
||||
|
||||
arglist = ['--templates', '/home/stack/tripleo-heat-templates']
|
||||
verifylist = [
|
||||
@ -626,6 +639,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.cmd.take_action, parsed_args)
|
||||
self.assertFalse(mock_deploy_tht.called)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
||||
@ -642,7 +657,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
def test_environment_dirs(self, mock_copy, mock_deploy_heat,
|
||||
mock_update_parameters, mock_post_config,
|
||||
mock_utils_endpoint, mock_utils_createrc,
|
||||
mock_utils_tempest, mock_tarball):
|
||||
mock_utils_tempest, mock_tarball,
|
||||
mock_get_horizon_url):
|
||||
|
||||
clients = self.app.client_manager
|
||||
workflow_client = clients.workflow_engine
|
||||
@ -841,6 +857,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
parsed_args)
|
||||
self.assertIn('/tmp/notthere', str(error))
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.write_overcloudrc', autospec=True)
|
||||
@ -851,7 +869,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
def test_rhel_reg_params_provided(self, mock_copytree, mock_deploy_tht,
|
||||
mock_oc_endpoint,
|
||||
mock_create_ocrc,
|
||||
mock_create_tempest_deployer_input):
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_get_horizon_url):
|
||||
|
||||
clients = self.app.client_manager
|
||||
workflow_client = clients.workflow_engine
|
||||
@ -878,6 +897,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
|
||||
mock_create_tempest_deployer_input.assert_called_with()
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
autospec=True)
|
||||
@mock.patch("heatclient.common.event_utils.get_events", autospec=True)
|
||||
@ -907,7 +928,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_deploy_postconfig,
|
||||
mock_breakpoints_cleanup,
|
||||
mock_events, mock_tarball):
|
||||
mock_events, mock_tarball,
|
||||
mock_get_horizon_url):
|
||||
|
||||
arglist = ['--templates', '--rhel-reg',
|
||||
'--reg-sat-url', 'https://example.com',
|
||||
@ -1116,6 +1138,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.assertFalse(mock_create_ocrc.called)
|
||||
self.assertFalse(mock_create_tempest_deployer_input.called)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
||||
@ -1132,7 +1156,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_oc_endpoint,
|
||||
mock_create_ocrc,
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_tarball):
|
||||
mock_tarball, mock_get_horizon_url):
|
||||
clients = self.app.client_manager
|
||||
|
||||
workflow_client = clients.workflow_engine
|
||||
@ -1283,6 +1307,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.cmd.take_action,
|
||||
parsed_args)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_postconfig', autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.plan_management.tarball',
|
||||
@ -1317,7 +1343,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_validate_args,
|
||||
mock_breakpoints_cleanup,
|
||||
mock_tarball,
|
||||
mock_deploy_post_config):
|
||||
mock_deploy_post_config,
|
||||
mock_get_horizon_url):
|
||||
|
||||
arglist = ['--templates', '--ceph-storage-scale', '3',
|
||||
'--control-scale', '3', '--ntp-server', 'ntp']
|
||||
@ -1467,6 +1494,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.assertRaises(exceptions.StackInProgress,
|
||||
self.cmd.take_action, parsed_args)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.get_overcloud_endpoint', autospec=True)
|
||||
@ -1479,7 +1508,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self, mock_deploy_tmpdir,
|
||||
mock_overcloudrc, mock_write_overcloudrc,
|
||||
mock_overcloud_endpoint,
|
||||
mock_create_tempest_deployer_input):
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_get_horizon_url):
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
@ -1494,6 +1524,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.assertNotCalled(self.cmd._predeploy_verify_capabilities)
|
||||
mock_create_tempest_deployer_input.assert_called_with()
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.get_overcloud_endpoint', autospec=True)
|
||||
@ -1506,7 +1538,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self, mock_deploy_tmpdir,
|
||||
mock_overcloudrc, mock_write_overcloudrc,
|
||||
mock_overcloud_endpoint,
|
||||
mock_create_tempest_deployer_input):
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_get_horizon_url):
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
@ -1521,6 +1554,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.assertTrue(self.cmd._predeploy_verify_capabilities.called)
|
||||
mock_create_tempest_deployer_input.assert_called_with()
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.get_overcloud_endpoint', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.write_overcloudrc', autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.deployment.overcloudrc',
|
||||
@ -1530,7 +1565,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
def test_validations_failure_raises_exception(
|
||||
self, mock_deploy_tmpdir,
|
||||
mock_overcloudrc, mock_write_overcloudrc,
|
||||
mock_overcloud_endpoint):
|
||||
mock_overcloud_endpoint, mock_get_horizon_url):
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
@ -1546,6 +1581,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.assertRaises(exceptions.InvalidConfiguration,
|
||||
self.cmd.take_action, parsed_args)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.wait_for_provision_state')
|
||||
@ -1561,7 +1598,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_write_overcloudrc,
|
||||
mock_get_overcloud_endpoint,
|
||||
mock_baremetal, mock_workflows_bm,
|
||||
mock_provision, mock_tempest_deploy_input):
|
||||
mock_provision, mock_tempest_deploy_input,
|
||||
mock_get_horizon_url):
|
||||
arglist = ['--templates', '--deployed-server', '--disable-validations']
|
||||
verifylist = [
|
||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
||||
@ -1601,6 +1639,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
parsed_args)
|
||||
self.assertFalse(mock_deploy_tmpdir.called)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.deployment.config_download')
|
||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
||||
autospec=True)
|
||||
@ -1615,7 +1655,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_overcloudrc, mock_write_overcloudrc,
|
||||
mock_overcloud_endpoint,
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_config_download):
|
||||
mock_config_download, mock_get_horizon_url):
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
orchestration_client.stacks.get.return_value = mock.Mock()
|
||||
|
@ -1030,6 +1030,11 @@ class DeployOvercloud(command.Command):
|
||||
self._deploy_postconfig(stack, parsed_args)
|
||||
|
||||
overcloud_endpoint = utils.get_overcloud_endpoint(stack)
|
||||
|
||||
horizon_url = deployment.get_horizon_url(
|
||||
self.clients, stack=stack.stack_name)
|
||||
|
||||
print("Overcloud Endpoint: {0}".format(overcloud_endpoint))
|
||||
print("Overcloud Horizon Dashboard URL: {0}".format(horizon_url))
|
||||
print("Overcloud rc file: {0}".format(rcpath))
|
||||
print("Overcloud Deployed")
|
||||
|
@ -157,3 +157,21 @@ def config_download(log, clients, stack, templates, deployed_server,
|
||||
print("Overcloud configuration completed.")
|
||||
else:
|
||||
raise exceptions.DeploymentError("Overcloud configuration failed.")
|
||||
|
||||
|
||||
def get_horizon_url(clients, **workflow_input):
|
||||
workflow_client = clients.workflow_engine
|
||||
tripleoclients = clients.tripleoclient
|
||||
|
||||
with tripleoclients.messaging_websocket() as ws:
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.deployment.v1.get_horizon_url',
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
|
||||
for payload in base.wait_for_messages(workflow_client, ws, execution,
|
||||
360):
|
||||
assert payload['status'] == "SUCCESS"
|
||||
|
||||
return payload['horizon_url']
|
||||
|
Loading…
x
Reference in New Issue
Block a user