Convert horizon url workflow to ansible
This change will now use an ansible playbook to parse the horizon URL information from a heat stack and return the connection string accordingly. Story: 2007212 Task: 38429 Depends-On: https://review.opendev.org/#/c/706196/ Depends-On: I85cb99d47cf3cb4f3093fc856e9f6892115ff5ef Change-Id: I78e68147fc30ff4d71edb023f553219d553b53a6 Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
4866ab8fde
commit
d76866404e
@ -27,9 +27,6 @@ class DeploymentWorkflowFixture(fixtures.Fixture):
|
||||
self.mock_config_download = self.useFixture(fixtures.MockPatch(
|
||||
'tripleoclient.workflows.deployment.config_download')
|
||||
).mock
|
||||
self.mock_get_horizon_url = self.useFixture(fixtures.MockPatch(
|
||||
'tripleoclient.workflows.deployment.get_horizon_url')
|
||||
).mock
|
||||
self.mock_set_deployment_status = self.useFixture(fixtures.MockPatch(
|
||||
'tripleoclient.workflows.deployment.set_deployment_status')
|
||||
).mock
|
||||
|
@ -109,6 +109,23 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
get_container = client.object_store.get_container = mock.MagicMock()
|
||||
get_container.return_value = ('container', [{'name': 'f1'}])
|
||||
|
||||
# Mock playbook runner
|
||||
playbook_runner = mock.patch(
|
||||
'tripleoclient.utils.run_ansible_playbook',
|
||||
autospec=True
|
||||
)
|
||||
playbook_runner.start()
|
||||
self.addCleanup(playbook_runner.stop)
|
||||
|
||||
# Mock horizon url return
|
||||
horizon_url = mock.patch(
|
||||
'tripleoclient.workflows.deployment.get_horizon_url',
|
||||
autospec=True
|
||||
)
|
||||
horizon_url.start()
|
||||
horizon_url.return_value = 'fake://url:12345'
|
||||
self.addCleanup(horizon_url.stop)
|
||||
|
||||
def tearDown(self):
|
||||
super(TestDeployOvercloud, self).tearDown()
|
||||
os.unlink(self.parameter_defaults_env_file)
|
||||
|
@ -1007,8 +1007,7 @@ class DeployOvercloud(command.Command):
|
||||
|
||||
overcloud_endpoint = utils.get_overcloud_endpoint(stack)
|
||||
|
||||
horizon_url = deployment.get_horizon_url(
|
||||
self.clients, stack=stack.stack_name)
|
||||
horizon_url = deployment.get_horizon_url(stack=stack.stack_name)
|
||||
|
||||
print("Overcloud Endpoint: {0}".format(overcloud_endpoint))
|
||||
print("Overcloud Horizon Dashboard URL: {0}".format(horizon_url))
|
||||
|
@ -12,6 +12,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import copy
|
||||
import os
|
||||
import pprint
|
||||
import time
|
||||
import yaml
|
||||
@ -334,22 +335,29 @@ def config_download_export(clients, **workflow_input):
|
||||
payload['message']))
|
||||
|
||||
|
||||
def get_horizon_url(clients, **workflow_input):
|
||||
workflow_client = clients.workflow_engine
|
||||
tripleoclients = clients.tripleoclient
|
||||
def get_horizon_url(stack):
|
||||
"""Return horizon URL string.
|
||||
|
||||
with tripleoclients.messaging_websocket() as ws:
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.deployment.v1.get_horizon_url',
|
||||
workflow_input=workflow_input
|
||||
:params stack: Stack name
|
||||
:type stack: string
|
||||
:returns: string
|
||||
"""
|
||||
|
||||
with utils.TempDirs() as tmp:
|
||||
horizon_tmp_file = os.path.join(tmp, 'horizon_url')
|
||||
utils.run_ansible_playbook(
|
||||
playbook='cli-undercloud-get-horizon-url.yaml',
|
||||
inventory='localhost,',
|
||||
workdir=tmp,
|
||||
playbook_dir=ANSIBLE_TRIPLEO_PLAYBOOKS,
|
||||
extra_vars={
|
||||
'stack_name': stack,
|
||||
'horizon_url_output_file': horizon_tmp_file
|
||||
}
|
||||
)
|
||||
|
||||
for payload in base.wait_for_messages(workflow_client, ws, execution,
|
||||
360):
|
||||
assert payload['status'] == "SUCCESS"
|
||||
|
||||
return payload['horizon_url']
|
||||
with open(horizon_tmp_file) as f:
|
||||
return f.read().strip()
|
||||
|
||||
|
||||
def get_deployment_status(clients, **workflow_input):
|
||||
|
Loading…
Reference in New Issue
Block a user