From e0434359dd291d283b8c5c6246aeb48171995dbf Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Wed, 6 Sep 2017 16:46:11 +0100 Subject: [PATCH] Add "tripleo-common-managed" to all workflows in tripleo_common At the moment instack-undercloud deletes all workflows with "tripleo" in the name. This has caused an issue when workflows come from other locations but shouldn't be deleted. Adding the tag allows instack-undercloud to delete only workflows with this tag. It shouldn't delete or touch workflows outside of the tripleo-common package. Parital-Bug: #1715389 Change-Id: Ieeb51f8e705b8988fb4d0f5d17d7fce6b5b04f36 --- tripleo_common/tests/test_workflows.py | 41 ++++++++++++++++++ workbooks/access.yaml | 6 +++ workbooks/baremetal.yaml | 60 ++++++++++++++++++++++++++ workbooks/ceph-ansible.yaml | 2 + workbooks/deployment.yaml | 9 ++++ workbooks/derive_params.yaml | 9 ++++ workbooks/derive_params_formulas.yaml | 9 ++++ workbooks/fernet-key-rotate.yaml | 3 ++ workbooks/package_update.yaml | 6 +++ workbooks/plan_management.yaml | 22 ++++++++++ workbooks/scale.yaml | 3 ++ workbooks/stack.yaml | 12 ++++++ workbooks/support.yaml | 15 +++++++ workbooks/swift_rings_backup.yaml | 2 + workbooks/validations.yaml | 34 +++++++++++++++ 15 files changed, 233 insertions(+) create mode 100644 tripleo_common/tests/test_workflows.py diff --git a/tripleo_common/tests/test_workflows.py b/tripleo_common/tests/test_workflows.py new file mode 100644 index 000000000..9a0798791 --- /dev/null +++ b/tripleo_common/tests/test_workflows.py @@ -0,0 +1,41 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import yaml + +from tripleo_common.tests import base + + +WORKBOOK_DIRECTORY = os.path.join(os.path.dirname(__file__), + '..', '..', 'workbooks') + + +class TestWorkflowStructure(base.TestCase): + + def setUp(self): + self.workbooks = os.listdir(WORKBOOK_DIRECTORY) + super(TestWorkflowStructure, self).setUp() + + def test_tags_are_set(self): + for workbook in self.workbooks: + full_path = os.path.join(WORKBOOK_DIRECTORY, workbook) + with open(full_path) as f: + wb_yaml = yaml.load(f) + message = ("tripleo-common-managed tag is missing from a " + "workflow in {}").format(full_path) + for wf_name, wf_spec in wb_yaml['workflows'].items(): + self.assertIn('tags', wf_spec, message) + self.assertIn('tripleo-common-managed', wf_spec['tags'], + message) diff --git a/workbooks/access.yaml b/workbooks/access.yaml index 1a141009c..a0aa957cf 100644 --- a/workbooks/access.yaml +++ b/workbooks/access.yaml @@ -18,6 +18,8 @@ workflows: of servers) need to be provided -- these are only used temporarily to create the actual ssh admin user for use by Mistral. + tags: + - tripleo-common-managed input: - ssh_private_key: null - ssh_user: null @@ -86,6 +88,8 @@ workflows: input: - tasks - queue_name: tripleo + tags: + - tripleo-common-managed tasks: get_servers: action: nova.servers_list @@ -113,6 +117,8 @@ workflows: - ssh_private_key - ssh_user - ssh_servers + tags: + - tripleo-common-managed tasks: write_tmp_playbook: action: tripleo.ansible-playbook diff --git a/workbooks/baremetal.yaml b/workbooks/baremetal.yaml index a1e1a9f2f..90bca8a47 100644 --- a/workbooks/baremetal.yaml +++ b/workbooks/baremetal.yaml @@ -11,6 +11,9 @@ workflows: - state_action - target_state + tags: + - tripleo-common-managed + tasks: set_provision_state: @@ -31,6 +34,9 @@ workflows: - state_action - target_state + tags: + - tripleo-common-managed + tasks: set_provision_state: @@ -54,6 +60,9 @@ workflows: - retry_count: 720 - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: set_provision_state: @@ -98,6 +107,9 @@ workflows: - nodes_json - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: validate_nodes: @@ -140,6 +152,9 @@ workflows: - instance_boot_option: local - initial_state: manageable + tags: + - tripleo-common-managed + tasks: validate_input: @@ -236,6 +251,9 @@ workflows: - node_uuids - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: set_nodes_available: @@ -314,6 +332,9 @@ workflows: input: - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: get_manageable_nodes: @@ -360,6 +381,9 @@ workflows: - node_uuids - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: set_nodes_manageable: @@ -406,6 +430,9 @@ workflows: output: result: <% task(start_introspection).result %> + tags: + - tripleo-common-managed + tasks: start_introspection: action: baremetal_introspection.introspect uuid=<% $.node_uuid %> @@ -482,6 +509,9 @@ workflows: - max_retry_attempts: 2 - node_timeout: 1200 + tags: + - tripleo-common-managed + tasks: initialize: publish: @@ -590,6 +620,9 @@ workflows: - run_validations: False - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: get_manageable_nodes: @@ -653,6 +686,9 @@ workflows: - root_device_minimum_size: 4 - overwrite_root_device_hints: False + tags: + - tripleo-common-managed + tasks: configure_boot: @@ -709,6 +745,9 @@ workflows: - root_device_minimum_size: 4 - overwrite_root_device_hints: False + tags: + - tripleo-common-managed + tasks: get_manageable_nodes: @@ -771,6 +810,9 @@ workflows: task-defaults: on-error: send_message + tags: + - tripleo-common-managed + tasks: update_node: @@ -807,6 +849,9 @@ workflows: task-defaults: on-error: send_message + tags: + - tripleo-common-managed + tasks: tag_nodes: @@ -856,6 +901,9 @@ workflows: - profile - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: get_available_nodes: action: ironic.node_list maintenance=false provision_state='available' detail=true @@ -905,6 +953,9 @@ workflows: - configuration - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: set_configuration: @@ -967,6 +1018,9 @@ workflows: - node_uuids - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: cell_v2_discover_hosts: @@ -1017,6 +1071,9 @@ workflows: - ports: [623] - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: get_all_nodes: @@ -1102,6 +1159,9 @@ workflows: - initial_state: manageable - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: discover_nodes: diff --git a/workbooks/ceph-ansible.yaml b/workbooks/ceph-ansible.yaml index 373a9a17e..5871fe478 100644 --- a/workbooks/ceph-ansible.yaml +++ b/workbooks/ceph-ansible.yaml @@ -11,6 +11,8 @@ workflows: - ansible_skip_tags: 'package-install,with_pkg' - ceph_ansible_extra_vars: {} - ceph_ansible_playbook: /usr/share/ceph-ansible/site-docker.yml.sample + tags: + - tripleo-common-managed tasks: enable_ssh_admin: workflow: tripleo.access.v1.enable_ssh_admin diff --git a/workbooks/deployment.yaml b/workbooks/deployment.yaml index d523b321d..3a92cf4e2 100644 --- a/workbooks/deployment.yaml +++ b/workbooks/deployment.yaml @@ -15,6 +15,9 @@ workflows: - group - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: deploy_config: @@ -54,6 +57,9 @@ workflows: - group: script - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: get_servers_matching: @@ -113,6 +119,9 @@ workflows: - skip_deploy_identifier: False - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: add_validation_ssh_key: diff --git a/workbooks/derive_params.yaml b/workbooks/derive_params.yaml index 735d3f80e..50ac72e9d 100644 --- a/workbooks/derive_params.yaml +++ b/workbooks/derive_params.yaml @@ -13,6 +13,9 @@ workflows: - queue_name: tripleo - user_inputs: {} + tags: + - tripleo-common-managed + tasks: get_flattened_parameters: action: tripleo.parameters.get_flatten container=<% $.plan %> @@ -151,6 +154,9 @@ workflows: # Need role_name in output parameter to display the status for all roles in main workflow when any role fails here. role_name: <% $.role_name %> + tags: + - tripleo-common-managed + tasks: get_role_info: workflow: _get_role_info @@ -319,6 +325,9 @@ workflows: - role_name - heat_resource_tree + tags: + - tripleo-common-managed + tasks: get_resource_chains: publish: diff --git a/workbooks/derive_params_formulas.yaml b/workbooks/derive_params_formulas.yaml index 36a691d16..3c2a3686b 100644 --- a/workbooks/derive_params_formulas.yaml +++ b/workbooks/derive_params_formulas.yaml @@ -19,6 +19,9 @@ workflows: output: derived_parameters: <% $.derived_parameters.mergeWith($.get('dpdk_parameters', {})) %> + tags: + - tripleo-common-managed + tasks: get_network_config: action: tripleo.parameters.get_network_config @@ -227,6 +230,9 @@ workflows: output: derived_parameters: <% $.derived_parameters.mergeWith($.get('host_parameters', {})) %> + tags: + - tripleo-common-managed + tasks: get_cpus: @@ -355,6 +361,9 @@ workflows: output: derived_parameters: <% $.derived_parameters.mergeWith($.get('hci_parameters', {})) %> + tags: + - tripleo-common-managed + tasks: get_hci_inputs: publish: diff --git a/workbooks/fernet-key-rotate.yaml b/workbooks/fernet-key-rotate.yaml index 793791a8e..48ba4a96d 100644 --- a/workbooks/fernet-key-rotate.yaml +++ b/workbooks/fernet-key-rotate.yaml @@ -11,6 +11,9 @@ workflows: - container - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: rotate_keys: diff --git a/workbooks/package_update.yaml b/workbooks/package_update.yaml index 756d564bd..8f536e3bb 100644 --- a/workbooks/package_update.yaml +++ b/workbooks/package_update.yaml @@ -14,6 +14,9 @@ workflows: - timeout: 240 - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: update: action: tripleo.package_update.update_stack container=<% $.container %> timeout=<% $.timeout %> @@ -49,6 +52,9 @@ workflows: - refs - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: clear: action: tripleo.package_update.clear_breakpoints stack_id=<% $.stack_id %> refs=<% $.refs %> diff --git a/workbooks/plan_management.yaml b/workbooks/plan_management.yaml index be69d57b1..e20a73b38 100644 --- a/workbooks/plan_management.yaml +++ b/workbooks/plan_management.yaml @@ -13,6 +13,8 @@ workflows: - container - queue_name: tripleo - generate_passwords: true + tags: + - tripleo-common-managed tasks: call_create_deployment_plan: workflow: tripleo.plan_management.v1.create_deployment_plan @@ -63,6 +65,9 @@ workflows: - generate_passwords: true - use_default_templates: false + tags: + - tripleo-common-managed + tasks: container_required_check: description: > @@ -200,6 +205,8 @@ workflows: - source_url: null - queue_name: tripleo - generate_passwords: true + tags: + - tripleo-common-managed tasks: templates_source_check: on-success: @@ -313,6 +320,9 @@ workflows: - container - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: verify_container_exists: @@ -363,6 +373,9 @@ workflows: - plan - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: export_plan: @@ -423,6 +436,9 @@ workflows: - container: overcloud - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: get_flatten_data: action: tripleo.parameters.get_flatten container=<% $.container %> @@ -483,6 +499,9 @@ workflows: - logging_queue_name: tripleo-ui-logging - logging_container: tripleo-ui-logs + tags: + - tripleo-common-managed + tasks: get_messages: @@ -552,6 +571,9 @@ workflows: - downloads_container: "tripleo-ui-logs-downloads" - delete_after: 3600 + tags: + - tripleo-common-managed + tasks: prepare_log_download: diff --git a/workbooks/scale.yaml b/workbooks/scale.yaml index 7a5086b14..6e5a70dcd 100644 --- a/workbooks/scale.yaml +++ b/workbooks/scale.yaml @@ -14,6 +14,9 @@ workflows: - timeout: 240 - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: delete_node: diff --git a/workbooks/stack.yaml b/workbooks/stack.yaml index 289852c46..43279a017 100644 --- a/workbooks/stack.yaml +++ b/workbooks/stack.yaml @@ -10,6 +10,9 @@ workflows: - stack - timeout: 14400 # 4 hours. Default timeout of stack deployment + tags: + - tripleo-common-managed + tasks: wait_for_stack_status: @@ -25,6 +28,9 @@ workflows: - stack - timeout: 600 # 10 minutes. Should not take much longer for a stack to transition to IN_PROGRESS + tags: + - tripleo-common-managed + tasks: wait_for_stack_status: @@ -40,6 +46,9 @@ workflows: - stack - timeout: 3600 + tags: + - tripleo-common-managed + tasks: wait_for_stack_does_not_exist: action: heat.stacks_list @@ -54,6 +63,9 @@ workflows: - stack - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: delete_the_stack: action: heat.stacks_delete stack_id=<% $.stack %> diff --git a/workbooks/support.yaml b/workbooks/support.yaml index 18ea30232..3ddf68228 100644 --- a/workbooks/support.yaml +++ b/workbooks/support.yaml @@ -15,6 +15,9 @@ workflows: - sos_options: boot,cluster,hardware,kernel,memory,nfs,openstack,packagemanager,performance,services,storage,system,webserver,virt - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: collect_logs_on_servers: workflow: tripleo.deployment.v1.deploy_on_servers @@ -65,6 +68,9 @@ workflows: - sos_dir: /var/tmp/tripleo-sos - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: # actions get_swift_information: @@ -138,6 +144,9 @@ workflows: - container - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: check_container: action: swift.head_container container=<% $.container %> @@ -187,6 +196,9 @@ workflows: - timeout: 900 - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: # actions check_container: @@ -275,6 +287,9 @@ workflows: - timeout: 1800 - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: # actions create_container: diff --git a/workbooks/swift_rings_backup.yaml b/workbooks/swift_rings_backup.yaml index 870e176c7..2d93c7c8f 100644 --- a/workbooks/swift_rings_backup.yaml +++ b/workbooks/swift_rings_backup.yaml @@ -11,6 +11,8 @@ workflows: input: - container - queue_name: tripleo + tags: + - tripleo-common-managed tasks: check_container: action: swift.head_container container=<% $.container %> diff --git a/workbooks/validations.yaml b/workbooks/validations.yaml index 2c383157a..5cb9ad7b7 100644 --- a/workbooks/validations.yaml +++ b/workbooks/validations.yaml @@ -11,6 +11,9 @@ workflows: - plan: overcloud - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: notify_running: @@ -68,6 +71,9 @@ workflows: - plan: overcloud - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: notify_running: @@ -120,6 +126,9 @@ workflows: - plan: overcloud - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: find_validations: @@ -177,11 +186,15 @@ workflows: list: input: - group_names: [] + tags: + - tripleo-common-managed tasks: find_validations: action: tripleo.validations.list_validations groups=<% $.group_names %> list_groups: + tags: + - tripleo-common-managed tasks: find_groups: action: tripleo.validations.list_groups @@ -191,6 +204,9 @@ workflows: - container - queue_name: tripleo + tags: + - tripleo-common-managed + tasks: test_validations_enabled: action: tripleo.validations.enabled @@ -225,6 +241,8 @@ workflows: # have it present - overcloud_admin: heat-admin - queue_name: tripleo + tags: + - tripleo-common-managed tasks: get_servers: action: nova.servers_list @@ -264,6 +282,8 @@ workflows: warnings: <% $.warnings %> kernel_id: <% $.kernel_id %> ramdisk_id: <% $.ramdisk_id %> + tags: + - tripleo-common-managed tasks: check_run_validations: on-complete: @@ -330,6 +350,9 @@ workflows: warnings: <% $.warnings %> flavors: <% $.flavors %> + tags: + - tripleo-common-managed + tasks: check_run_validations: on-complete: @@ -385,6 +408,9 @@ workflows: errors: <% $.errors %> warnings: <% $.warnings %> + tags: + - tripleo-common-managed + tasks: check_run_validations: on-complete: @@ -456,6 +482,9 @@ workflows: errors: <% $.errors %> warnings: <% $.warnings %> + tags: + - tripleo-common-managed + tasks: check_run_validations: on-complete: @@ -527,6 +556,9 @@ workflows: errors: <% $.errors %> warnings: <% $.warnings %> + tags: + - tripleo-common-managed + tasks: check_run_validations: on-complete: @@ -656,6 +688,8 @@ workflows: ramdisk_id: <% $.ramdisk_id %> flavors: <% $.flavors %> statistics: <% $.statistics %> + tags: + - tripleo-common-managed tasks: init_messages: on-success: check_boot_images