Remove update parameters workflows

This workflow is no longer required becuase it has been converted to an
ansible playbook.

Story: 2007212
Task: 39045

Depends-On: I3d1c736f6d1ee704ece0101134f95582a5d060eb
Change-Id: I829217c99456f8ac8f49542eb1842c451fe77ad1
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2020-03-31 08:15:58 -05:00
parent a671c96ea0
commit 7decad8399
7 changed files with 30 additions and 84 deletions

View File

@ -258,9 +258,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env.side_effect = _custom_create_params_env
mock_rm = shutil.rmtree = mock.MagicMock()
self.cmd.take_action(parsed_args)
mock_rm.assert_called_once()
self.assertFalse(orchestration_client.stacks.update.called)
@ -348,9 +346,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'UndercloudHostsEntries':
['192.168.0.1 uc.ctlplane.localhost uc.ctlplane']}}
mock_rm = shutil.rmtree = mock.MagicMock()
self.cmd.take_action(parsed_args)
mock_rm.assert_not_called()
self.assertFalse(orchestration_client.stacks.create.called)
@ -386,17 +382,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
object_client = clients.tripleoclient.object_store
object_client.put_object.assert_has_calls(calls)
tmp_param_env = self.tmp_dir.join(
'tripleo-heat-templates',
'user-environments/tripleoclient-parameters.yaml')
self.assertTrue(os.path.isfile(tmp_param_env))
with open(tmp_param_env, 'r') as f:
env_map = yaml.safe_load(f)
self.assertEqual(env_map.get('parameter_defaults'),
parameters_env.get('parameter_defaults'))
mock_copy.assert_called_once()
object_client.put_container.assert_called_once_with(
'overcloud', headers={'x-container-meta-usage-tripleo': 'plan'})
@mock.patch('os.chdir')
@mock.patch('tripleoclient.utils.copy_clouds_yaml')
@ -530,9 +515,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
tarball_extract_to_swift_container.assert_called_with(
clients.tripleoclient.object_store, mock.ANY, 'overcloud')
workflow_client.action_executions.create.assert_called()
# workflow_client.executions.create.assert_called()
mock_open_context.assert_has_calls(
[mock.call('the-plan-environment.yaml')])
clients.tripleoclient.object_store.put_object.assert_called()
@ -624,9 +606,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env.side_effect = _custom_create_params_env
mock_rm = shutil.rmtree = mock.MagicMock()
self.cmd.take_action(parsed_args)
mock_rm.assert_called_once()
mock_copy.assert_called_once()
object_client.put_container.assert_called_once_with(
'overcloud', headers={'x-container-meta-usage-tripleo': 'plan'})

View File

@ -52,18 +52,16 @@ class TestSetParameters(utils.TestCommand):
})
)
playbook_runner = mock.patch(
'tripleoclient.utils.run_ansible_playbook',
autospec=True
)
playbook_runner.start()
self.addCleanup(playbook_runner.stop)
# Run
self.cmd.take_action(parsed_args)
# Verify
self.workflow.action_executions.create.assert_called_once_with(
'tripleo.parameters.update',
{
'container': 'overcast',
'parameters': data.get('parameter_defaults', data)
},
run_sync=True, save_result=True)
def test_json_params_file(self):
self._test_set_parameters(".json", json.dumps, {
"param1": "value1",

View File

@ -154,28 +154,6 @@ class TestBaseWorkflows(utils.TestCommand):
websocket.wait_for_messages.assert_called_with(timeout=None)
def test_call_action_success(self):
mistral = mock.Mock()
action = 'test-action'
result = mock.Mock()
result.output = '{"result":"test-result"}'
mistral.action_executions.create = mock.Mock(return_value=result)
self.assertEqual(base.call_action(mistral, action), "test-result")
def test_call_action_fail(self):
mistral = mock.Mock()
action = 'test-action'
result = mock.Mock()
result.output = '{"result":"test-result"}'
result.state = 'ERROR'
mistral.action_executions.create = mock.Mock(return_value=result)
self.assertRaises(ex.WorkflowActionError,
base.call_action, mistral, action)
def test_wait_for_messages_execution_complete(self):
payload_a = {
'status': 'RUNNING',

View File

@ -293,9 +293,17 @@ class DeployOvercloud(command.Command):
# Parameters are sent to the update parameters action, this stores them
# in the plan environment and means the UI can find them.
if params:
workflow_params.update_parameters(
self.workflow_client, container=container_name,
parameters=params)
with utils.TempDirs() as tmp:
utils.run_ansible_playbook(
playbook='cli-update-params.yaml',
inventory='localhost,',
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
extra_vars={
"container": container_name,
"parameters": params
}
)
def _upload_missing_files(self, container_name, files_dict, tht_root):
"""Find the files referenced in custom environments and upload them

View File

@ -18,6 +18,7 @@ import yaml
from osc_lib.i18n import _
from tripleoclient import command
from tripleoclient import constants
from tripleoclient import exceptions
from tripleoclient import utils
from tripleoclient.workflows import parameters
@ -53,16 +54,17 @@ class SetParameters(command.Command):
if 'parameter_defaults' in params:
params = params['parameter_defaults']
clients = self.app.client_manager
workflow_client = clients.workflow_engine
name = parsed_args.name
parameters.update_parameters(
workflow_client,
container=name,
parameters=params
)
with utils.TempDirs() as tmp:
utils.run_ansible_playbook(
playbook='cli-update-params.yaml',
inventory='localhost,',
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
extra_vars={
"container": parsed_args.name,
"parameters": params
}
)
class GenerateFencingParameters(command.Command):

View File

@ -17,21 +17,6 @@ from tripleoclient import exceptions
LOG = logging.getLogger(__name__)
def call_action(workflow_client, action, **input_):
"""Trigger a Mistral action and parse the JSON response"""
result = workflow_client.action_executions.create(
action, input_,
save_result=True, run_sync=True)
# Parse the JSON output. Mistral client should do this for us really.
output = json.loads(result.output)['result']
if result.state == 'ERROR':
raise exceptions.WorkflowActionError(action, output)
return output
def start_workflow(workflow_client, identifier, workflow_input):
execution = workflow_client.executions.create(

View File

@ -28,11 +28,6 @@ from tripleoclient.workflows import roles
LOG = logging.getLogger(__name__)
def update_parameters(workflow_client, **input_):
return base.call_action(workflow_client, 'tripleo.parameters.update',
**input_)
def invoke_plan_env_workflows(clients, stack_name, plan_env_file):
"""Invokes the workflows in plan environment file"""