Merge "Change ceph-ansible fetch directory format on upgrade from Q to R"
This commit is contained in:
@@ -285,7 +285,7 @@ workflows:
|
|||||||
|
|
||||||
create_ceph_ansible_fetch_directory_backup_plan:
|
create_ceph_ansible_fetch_directory_backup_plan:
|
||||||
workflow: tripleo.swift_backup.v1.create_swift_backup_container_plan
|
workflow: tripleo.swift_backup.v1.create_swift_backup_container_plan
|
||||||
on-success: update_plan
|
on-success: does_ceph_ansible_fetch_directory_backup_need_rename
|
||||||
on-error: create_ceph_ansible_fetch_directory_backup_plan_set_status_failed
|
on-error: create_ceph_ansible_fetch_directory_backup_plan_set_status_failed
|
||||||
input:
|
input:
|
||||||
container: <% $.container %>
|
container: <% $.container %>
|
||||||
@@ -296,6 +296,16 @@ workflows:
|
|||||||
put_url_parm: SwiftFetchDirPutTempurl
|
put_url_parm: SwiftFetchDirPutTempurl
|
||||||
use_default_templates: true
|
use_default_templates: true
|
||||||
|
|
||||||
|
does_ceph_ansible_fetch_directory_backup_need_rename:
|
||||||
|
workflow: tripleo.rename_ceph_ansible_fetch_directory.v1.check_and_rename
|
||||||
|
on-success: update_plan
|
||||||
|
on-error: does_ceph_ansible_fetch_directory_backup_need_rename_set_status_failed
|
||||||
|
input:
|
||||||
|
container: <% $.container %>
|
||||||
|
queue_name: <% $.queue_name %>
|
||||||
|
container_suffix: "_ceph_ansible_fetch_dir"
|
||||||
|
swift_tar: "temporary_dir.tar.gz"
|
||||||
|
|
||||||
update_plan:
|
update_plan:
|
||||||
on-success:
|
on-success:
|
||||||
- ensure_passwords_exist: <% $.generate_passwords = true %>
|
- ensure_passwords_exist: <% $.generate_passwords = true %>
|
||||||
@@ -343,6 +353,12 @@ workflows:
|
|||||||
status: FAILED
|
status: FAILED
|
||||||
message: <% task(create_ceph_ansible_fetch_directory_backup_plan).result %>
|
message: <% task(create_ceph_ansible_fetch_directory_backup_plan).result %>
|
||||||
|
|
||||||
|
does_ceph_ansible_fetch_directory_backup_need_rename_set_status_failed:
|
||||||
|
on-success: send_message
|
||||||
|
publish:
|
||||||
|
status: FAILED
|
||||||
|
message: <% task(create_ceph_ansible_fetch_directory_backup_plan).result %>
|
||||||
|
|
||||||
clone_git_repo_set_status_failed:
|
clone_git_repo_set_status_failed:
|
||||||
on-success: send_message
|
on-success: send_message
|
||||||
publish:
|
publish:
|
||||||
|
105
workbooks/rename_ceph_ansible_fetch_directory.yaml
Normal file
105
workbooks/rename_ceph_ansible_fetch_directory.yaml
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
---
|
||||||
|
version: '2.0'
|
||||||
|
name: tripleo.rename_ceph_ansible_fetch_directory.v1
|
||||||
|
description: TripleO rename ceph-ansible fetch directory backup in Swift Workflow v1
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
check_and_rename:
|
||||||
|
description: >
|
||||||
|
If the name of the tarball containing the ceph-ansible fetch directory
|
||||||
|
matches the format found in Queens, then rename it to match the format
|
||||||
|
expected in Rocky. I.e if temporary_dir-20180915-191756.tar.gz is found
|
||||||
|
then rename it to temporary_dir.tar.gz. This workflow is idempotent and
|
||||||
|
should be run before upgrading from Queens to Rocky.
|
||||||
|
input:
|
||||||
|
- container: overcloud
|
||||||
|
- queue_name: tripleo
|
||||||
|
- container_suffix: "_ceph_ansible_fetch_dir"
|
||||||
|
- swift_tar: "temporary_dir.tar.gz"
|
||||||
|
tags:
|
||||||
|
- tripleo-common-managed
|
||||||
|
tasks:
|
||||||
|
swift_container:
|
||||||
|
publish:
|
||||||
|
swift_container: "<% $.container %><% $.container_suffix %>"
|
||||||
|
on-complete: verify_container_exists
|
||||||
|
|
||||||
|
verify_container_exists:
|
||||||
|
action: swift.head_container container=<% $.swift_container %>
|
||||||
|
on-success: get_object_list
|
||||||
|
on-error: verify_container_exists_set_status_failed
|
||||||
|
|
||||||
|
get_object_list:
|
||||||
|
# the get_container result[1] will be a list of objects (even if list is empty)
|
||||||
|
action: swift.get_container container=<% $.swift_container %>
|
||||||
|
publish:
|
||||||
|
object_list: <% task().result[1] %>
|
||||||
|
on-success: set_need_rename
|
||||||
|
on-error: get_object_list_set_status_failed
|
||||||
|
|
||||||
|
set_need_rename:
|
||||||
|
# if the list is empty, do not rename; otherwise check if name matches queens pattern
|
||||||
|
publish:
|
||||||
|
need_rename: <% switch($.object_list.len() = 0 => false, $.object_list.len() = 1 => $.object_list.first().get("name").matches("temporary_dir-[0-9]{4}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])-(2[0-3]|[01][0-9])[0-5][0-9][0-5][0-9].tar.gz")) %>
|
||||||
|
on-success: switch_on_need_rename
|
||||||
|
on-error: set_need_rename_set_status_failed
|
||||||
|
|
||||||
|
switch_on_need_rename:
|
||||||
|
on-success:
|
||||||
|
- copy_to_new_name: <% $.need_rename = true %>
|
||||||
|
- set_status_success: <% $.need_rename != true %>
|
||||||
|
|
||||||
|
copy_to_new_name:
|
||||||
|
action: swift.copy_object container=<% $.swift_container %> obj=<% $.object_list.first().get("name") %> destination=<% concat($.swift_container, '/', $.swift_tar) %>
|
||||||
|
on-success: remove_old_name
|
||||||
|
on-error: copy_to_new_name_set_status_failed
|
||||||
|
|
||||||
|
remove_old_name:
|
||||||
|
action: swift.delete_object container=<% $.swift_container %> obj=<% $.object_list.first().get("name") %>
|
||||||
|
on-success: set_status_success
|
||||||
|
on-error: remove_old_name_set_status_failed
|
||||||
|
|
||||||
|
set_status_success:
|
||||||
|
on-success: notify_zaqar
|
||||||
|
publish:
|
||||||
|
status: SUCCESS
|
||||||
|
message: <% task(need_rename).result %>
|
||||||
|
|
||||||
|
verify_container_exists_set_status_failed:
|
||||||
|
on-success: notify_zaqar
|
||||||
|
publish:
|
||||||
|
status: FAILED
|
||||||
|
message: <% task(verify_container_exists).result %>
|
||||||
|
|
||||||
|
get_object_list_set_status_failed:
|
||||||
|
on-success: notify_zaqar
|
||||||
|
publish:
|
||||||
|
status: FAILED
|
||||||
|
message: <% task(get_object_list).result %>
|
||||||
|
|
||||||
|
set_need_rename_set_status_failed:
|
||||||
|
on-success: notify_zaqar
|
||||||
|
publish:
|
||||||
|
status: FAILED
|
||||||
|
message: <% task(set_need_rename).result %>
|
||||||
|
|
||||||
|
copy_to_new_name_set_status_failed:
|
||||||
|
on-success: notify_zaqar
|
||||||
|
publish:
|
||||||
|
status: FAILED
|
||||||
|
message: <% task(copy_to_new_name).result %>
|
||||||
|
|
||||||
|
remove_old_name_set_status_failed:
|
||||||
|
on-success: notify_zaqar
|
||||||
|
publish:
|
||||||
|
status: FAILED
|
||||||
|
message: <% task(remove_old_name).result %>
|
||||||
|
|
||||||
|
notify_zaqar:
|
||||||
|
workflow: tripleo.messaging.v1.send
|
||||||
|
input:
|
||||||
|
queue_name: <% $.queue_name %>
|
||||||
|
type: <% execution().name %>
|
||||||
|
status: <% $.get('status', 'SUCCESS') %>
|
||||||
|
message: <% $.get('message', '') %>
|
||||||
|
execution: <% execution() %>
|
Reference in New Issue
Block a user