Remove mistral from the generate_fencing_parameters deploy workflow
This change removes all of mistral from the generate_fencing_parameters function by calling the required functions directly. Story: 2007212 Task: 38425 Change-Id: Iadcfb34e296144d82fde1d32acfffa1e01c5c997 Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
c923a4de9b
commit
dbe5169d97
@ -280,16 +280,23 @@ class TestParameterWorkflows(utils.TestCommand):
|
||||
workflow_input={'container': 'container-name'})
|
||||
mock_log.warning.assert_called_once_with(msg)
|
||||
|
||||
def test_generate_fencing_parameters(self):
|
||||
self.websocket.wait_for_messages.return_value = iter([{
|
||||
"execution_id": "IDID",
|
||||
"status": "SUCCESS",
|
||||
"fencing_parameters": "{}"
|
||||
}])
|
||||
@mock.patch(
|
||||
'tripleo_common.actions.parameters.GenerateFencingParametersAction'
|
||||
'.run',
|
||||
autospec=True
|
||||
)
|
||||
def test_generate_fencing_parameters(self, mock_params):
|
||||
mock_params.return_value = {"parameter_defaults": {}}
|
||||
|
||||
parameters.generate_fencing_parameters(
|
||||
self.app.client_manager, **{})
|
||||
|
||||
self.workflow.executions.create.assert_called_once_with(
|
||||
'tripleo.parameters.v1.generate_fencing_parameters',
|
||||
workflow_input={})
|
||||
workflow_input = {
|
||||
'nodes_json': [],
|
||||
'delay': 0,
|
||||
'ipmi_level': 'test',
|
||||
'ipmi_cipher': 'test',
|
||||
'ipmi_lanplus': True
|
||||
}
|
||||
params = parameters.generate_fencing_parameters(
|
||||
self.app.client_manager,
|
||||
**workflow_input
|
||||
)
|
||||
self.assertEqual(params, {"parameter_defaults": {}})
|
||||
|
@ -101,17 +101,14 @@ class GenerateFencingParameters(command.Command):
|
||||
def take_action(self, parsed_args):
|
||||
nodes_config = utils.parse_env_file(parsed_args.instackenv)
|
||||
parsed_args.instackenv.close()
|
||||
|
||||
workflow_input = {
|
||||
'nodes_json': nodes_config,
|
||||
'delay': parsed_args.delay,
|
||||
'ipmi_level': parsed_args.ipmi_level,
|
||||
'ipmi_cipher': parsed_args.ipmi_cipher,
|
||||
'ipmi_lanplus': parsed_args.ipmi_lanplus,
|
||||
}
|
||||
|
||||
result = parameters.generate_fencing_parameters(
|
||||
self.app.client_manager, **workflow_input)
|
||||
clients=self.app.client_manager,
|
||||
nodes_json=nodes_config,
|
||||
delay=parsed_args.delay,
|
||||
ipmi_level=parsed_args.ipmi_level,
|
||||
ipmi_cipher=parsed_args.ipmi_cipher,
|
||||
ipmi_lanplus=parsed_args.ipmi_lanplus,
|
||||
)
|
||||
|
||||
fencing_parameters = yaml.safe_dump(result, default_flow_style=False)
|
||||
if parsed_args.output:
|
||||
|
@ -13,6 +13,8 @@ import logging
|
||||
import re
|
||||
import yaml
|
||||
|
||||
from tripleo_common.actions import parameters
|
||||
|
||||
from tripleoclient.constants import UNUSED_PARAMETER_EXCLUDES_RE
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient.workflows import base
|
||||
@ -133,22 +135,36 @@ def check_deprecated_parameters(clients, container):
|
||||
invalid_join=invalid_join))
|
||||
|
||||
|
||||
def generate_fencing_parameters(clients, **workflow_input):
|
||||
workflow_client = clients.workflow_engine
|
||||
tripleoclients = clients.tripleoclient
|
||||
def generate_fencing_parameters(clients, nodes_json, delay, ipmi_level,
|
||||
ipmi_cipher, ipmi_lanplus):
|
||||
"""Generate and return fencing parameters.
|
||||
|
||||
with tripleoclients.messaging_websocket() as ws:
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.parameters.v1.generate_fencing_parameters',
|
||||
workflow_input=workflow_input)
|
||||
:param clients: application client object.
|
||||
:type clients: Object
|
||||
|
||||
for payload in base.wait_for_messages(workflow_client,
|
||||
ws, execution, 600):
|
||||
if payload['status'] != 'SUCCESS':
|
||||
raise exceptions.WorkflowServiceError(
|
||||
'Exception generating fencing parameters: {}'.format(
|
||||
payload['message']))
|
||||
if ('fencing_parameters' in payload and
|
||||
(payload.get('status', 'FAILED') == "SUCCESS")):
|
||||
return payload['fencing_parameters']
|
||||
:param nodes_json: list of nodes & attributes in json format
|
||||
:type nodes_json: List
|
||||
|
||||
:param delay: time to wait before taking fencing action
|
||||
:type delay: Integer
|
||||
|
||||
:param ipmi_level: IPMI user level to use
|
||||
:type ipmi_level: String
|
||||
|
||||
:param ipmi_cipher: IPMI cipher suite to use
|
||||
:type ipmi_cipher: String
|
||||
|
||||
:param ipmi_lanplus: whether to use IPMIv2.0
|
||||
:type ipmi_lanplus: Boolean
|
||||
|
||||
:returns: Dictionary
|
||||
"""
|
||||
context = clients.tripleoclient.create_mistral_context()
|
||||
fencing_params = parameters.GenerateFencingParametersAction(
|
||||
nodes_json=nodes_json,
|
||||
delay=delay,
|
||||
ipmi_level=ipmi_level,
|
||||
ipmi_cipher=ipmi_cipher,
|
||||
ipmi_lanplus=ipmi_lanplus
|
||||
)
|
||||
return fencing_params.run(context=context)
|
||||
|
Loading…
Reference in New Issue
Block a user