Merge "Remove unused tripleo.networks.v1 workbook"
This commit is contained in:
commit
be9afc46b4
|
@ -121,7 +121,6 @@ mistral.actions =
|
||||||
tripleo.plan.delete = tripleo_common.actions.plan:DeletePlanAction
|
tripleo.plan.delete = tripleo_common.actions.plan:DeletePlanAction
|
||||||
tripleo.plan.list = tripleo_common.actions.plan:ListPlansAction
|
tripleo.plan.list = tripleo_common.actions.plan:ListPlansAction
|
||||||
tripleo.plan.export = tripleo_common.actions.plan:ExportPlanAction
|
tripleo.plan.export = tripleo_common.actions.plan:ExportPlanAction
|
||||||
tripleo.plan.update_networks = tripleo_common.actions.plan:UpdateNetworksAction
|
|
||||||
tripleo.plan.update_roles = tripleo_common.actions.plan:UpdateRolesAction
|
tripleo.plan.update_roles = tripleo_common.actions.plan:UpdateRolesAction
|
||||||
tripleo.plan.validate_roles = tripleo_common.actions.plan:ValidateRolesDataAction
|
tripleo.plan.validate_roles = tripleo_common.actions.plan:ValidateRolesDataAction
|
||||||
tripleo.plan.remove_noop_deploystep = tripleo_common.actions.plan:RemoveNoopDeployStepAction
|
tripleo.plan.remove_noop_deploystep = tripleo_common.actions.plan:RemoveNoopDeployStepAction
|
||||||
|
|
|
@ -214,29 +214,6 @@ class ExportPlanAction(base.TripleOAction):
|
||||||
shutil.rmtree(tmp_dir)
|
shutil.rmtree(tmp_dir)
|
||||||
|
|
||||||
|
|
||||||
class UpdateNetworksAction(base.TripleOAction):
|
|
||||||
def __init__(self, networks, current_networks, replace_all=False):
|
|
||||||
super(UpdateNetworksAction, self).__init__()
|
|
||||||
self.networks = networks
|
|
||||||
self.current_networks = current_networks
|
|
||||||
self.replace_all = replace_all
|
|
||||||
|
|
||||||
def run(self, context):
|
|
||||||
network_data_to_save = self.networks or []
|
|
||||||
|
|
||||||
# if replace_all flag is true, discard current networks and save input
|
|
||||||
# if replace_all flag is false, merge input into current networks
|
|
||||||
if not self.replace_all:
|
|
||||||
# merge the networks_data and the network_input into networks
|
|
||||||
# to be saved
|
|
||||||
network_data_to_save = [net for net in {
|
|
||||||
x['name']: x for x in
|
|
||||||
self.current_networks + self.networks
|
|
||||||
}.values()]
|
|
||||||
|
|
||||||
return actions.Result(data={'network_data': network_data_to_save})
|
|
||||||
|
|
||||||
|
|
||||||
class ValidateRolesDataAction(base.TripleOAction):
|
class ValidateRolesDataAction(base.TripleOAction):
|
||||||
"""Validates Roles Data
|
"""Validates Roles Data
|
||||||
|
|
||||||
|
|
|
@ -467,52 +467,6 @@ class ExportPlanActionTest(base.TestCase):
|
||||||
self.assertIn(error, result.error)
|
self.assertIn(error, result.error)
|
||||||
|
|
||||||
|
|
||||||
class UpdateNetworksActionTest(base.TestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(UpdateNetworksActionTest, self).setUp()
|
|
||||||
self.current_networks = [
|
|
||||||
{
|
|
||||||
'name': 'FirstCurrentNetwork'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
self.ctx = mock.MagicMock()
|
|
||||||
|
|
||||||
def test_run_success(self):
|
|
||||||
networks = [
|
|
||||||
{
|
|
||||||
'name': 'MyFirstNetwork'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
action = plan.UpdateNetworksAction(networks, self.current_networks,
|
|
||||||
replace_all=False)
|
|
||||||
result = action.run(self.ctx)
|
|
||||||
|
|
||||||
expected = [
|
|
||||||
{'name': 'FirstCurrentNetwork'},
|
|
||||||
{'name': 'MyFirstNetwork'}
|
|
||||||
]
|
|
||||||
self.assertEqual(expected,
|
|
||||||
sorted(result.data['network_data'],
|
|
||||||
key=lambda k: k['name']))
|
|
||||||
|
|
||||||
def test_run_success_replace(self):
|
|
||||||
networks = [
|
|
||||||
{
|
|
||||||
'name': 'MyReplacementNetwork'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
action = plan.UpdateNetworksAction(networks, self.current_networks,
|
|
||||||
replace_all=True)
|
|
||||||
result = action.run(self.ctx)
|
|
||||||
expected = [
|
|
||||||
{'name': 'MyReplacementNetwork'}
|
|
||||||
]
|
|
||||||
self.assertEqual({"network_data": expected}, result.data)
|
|
||||||
|
|
||||||
|
|
||||||
class ValidateRolesDataActionTest(base.TestCase):
|
class ValidateRolesDataActionTest(base.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -1,199 +0,0 @@
|
||||||
---
|
|
||||||
version: '2.0'
|
|
||||||
name: tripleo.networks.v1
|
|
||||||
description: TripleO Overcloud Networks Workflows v1
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
|
|
||||||
validate_networks_input:
|
|
||||||
description: >
|
|
||||||
Validate that required fields are present.
|
|
||||||
|
|
||||||
input:
|
|
||||||
- networks
|
|
||||||
- queue_name: tripleo
|
|
||||||
|
|
||||||
output:
|
|
||||||
result: <% task(validate_network_names).result %>
|
|
||||||
|
|
||||||
tags:
|
|
||||||
- tripleo-common-managed
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
validate_network_names:
|
|
||||||
publish:
|
|
||||||
network_name_present: <% $.networks.all($.containsKey('name')) %>
|
|
||||||
on-success:
|
|
||||||
- set_status_success: <% $.network_name_present = true %>
|
|
||||||
- set_status_error: <% $.network_name_present = false %>
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
set_status_success:
|
|
||||||
on-success: send_message
|
|
||||||
publish:
|
|
||||||
status: SUCCESS
|
|
||||||
message: <% task(validate_network_names).result %>
|
|
||||||
|
|
||||||
set_status_error:
|
|
||||||
on-success: send_message
|
|
||||||
publish:
|
|
||||||
status: FAILED
|
|
||||||
message: "One or more entries did not contain the required field 'name'"
|
|
||||||
|
|
||||||
send_message:
|
|
||||||
workflow: tripleo.messaging.v1.send
|
|
||||||
input:
|
|
||||||
queue_name: <% $.queue_name %>
|
|
||||||
type: <% execution().name %>
|
|
||||||
status: <% $.status %>
|
|
||||||
execution: <% execution() %>
|
|
||||||
message: <% $.get('message', '') %>
|
|
||||||
|
|
||||||
update_networks:
|
|
||||||
description: >
|
|
||||||
Takes data in networks parameter in json format, validates its contents,
|
|
||||||
and persists them in network_data.yaml. After successful update,
|
|
||||||
templates are regenerated.
|
|
||||||
|
|
||||||
input:
|
|
||||||
- container: overcloud
|
|
||||||
- networks
|
|
||||||
- network_data_file: 'network_data.yaml'
|
|
||||||
- queue_name: tripleo
|
|
||||||
|
|
||||||
output:
|
|
||||||
network_data: <% $.network_data %>
|
|
||||||
|
|
||||||
tags:
|
|
||||||
- tripleo-common-managed
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
validate_input:
|
|
||||||
description: >
|
|
||||||
validate the format of input (input includes required fields for
|
|
||||||
each network)
|
|
||||||
workflow: validate_networks_input
|
|
||||||
input:
|
|
||||||
networks: <% $.networks %>
|
|
||||||
on-success: validate_network_files
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
validate_network_files:
|
|
||||||
description: >
|
|
||||||
validate that Network names exist in Swift container
|
|
||||||
workflow: tripleo.plan_management.v1.validate_network_files
|
|
||||||
input:
|
|
||||||
container: <% $.container %>
|
|
||||||
network_data: <% $.networks %>
|
|
||||||
queue_name: <% $.queue_name %>
|
|
||||||
publish:
|
|
||||||
network_data: <% task().network_data %>
|
|
||||||
on-success: get_available_networks
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
get_available_networks:
|
|
||||||
workflow: tripleo.plan_management.v1.list_available_networks
|
|
||||||
input:
|
|
||||||
container: <% $.container %>
|
|
||||||
queue_name: <% $.queue_name %>
|
|
||||||
publish:
|
|
||||||
available_networks: <% task().result.available_networks %>
|
|
||||||
on-success: get_current_networks
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
get_current_networks:
|
|
||||||
workflow: tripleo.plan_management.v1.get_network_data
|
|
||||||
input:
|
|
||||||
container: <% $.container %>
|
|
||||||
network_data_file: <% $.network_data_file %>
|
|
||||||
queue_name: <% $.queue_name %>
|
|
||||||
publish:
|
|
||||||
current_networks: <% task().result.network_data %>
|
|
||||||
on-success: update_network_data
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
update_network_data:
|
|
||||||
description: >
|
|
||||||
Combine (or replace) the network data
|
|
||||||
action: tripleo.plan.update_networks
|
|
||||||
input:
|
|
||||||
networks: <% $.available_networks %>
|
|
||||||
current_networks: <% $.current_networks %>
|
|
||||||
remove_all: false
|
|
||||||
publish:
|
|
||||||
new_network_data: <% task().result.network_data %>
|
|
||||||
on-success: update_network_data_in_swift
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
update_network_data_in_swift:
|
|
||||||
description: >
|
|
||||||
update network_data.yaml object in Swift with data from workflow input
|
|
||||||
action: swift.put_object
|
|
||||||
input:
|
|
||||||
container: <% $.container %>
|
|
||||||
obj: <% $.network_data_file %>
|
|
||||||
contents: <% yaml_dump($.new_network_data) %>
|
|
||||||
on-success: regenerate_templates
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
regenerate_templates:
|
|
||||||
action: tripleo.templates.process container=<% $.container %>
|
|
||||||
on-success: get_networks
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
get_networks:
|
|
||||||
description: >
|
|
||||||
run GetNetworksAction to get updated contents of network_data.yaml and
|
|
||||||
provide it as output
|
|
||||||
workflow: tripleo.plan_management.v1.get_network_data
|
|
||||||
input:
|
|
||||||
container: <% $.container %>
|
|
||||||
network_data_file: <% $.network_data_file %>
|
|
||||||
queue_name: <% $.queue_name %>
|
|
||||||
publish:
|
|
||||||
network_data: <% task().network_data %>
|
|
||||||
on-success: set_status_success
|
|
||||||
publish-on-error:
|
|
||||||
status: FAILED
|
|
||||||
message: <% task().result %>
|
|
||||||
on-error: send_message
|
|
||||||
|
|
||||||
set_status_success:
|
|
||||||
on-success: send_message
|
|
||||||
publish:
|
|
||||||
status: SUCCESS
|
|
||||||
message: <% task(get_networks).result %>
|
|
||||||
|
|
||||||
send_message:
|
|
||||||
workflow: tripleo.messaging.v1.send
|
|
||||||
input:
|
|
||||||
queue_name: <% $.queue_name %>
|
|
||||||
type: <% execution().name %>
|
|
||||||
status: <% $.status %>
|
|
||||||
execution: <% execution() %>
|
|
||||||
message: <% $.get('message', '') %>
|
|
||||||
plan_name: <% $.container %>
|
|
Loading…
Reference in New Issue