From b7631b7818359f83ce7eaae09885904e744704da Mon Sep 17 00:00:00 2001 From: Carlos Camacho Date: Wed, 6 Jun 2018 16:26:12 +0200 Subject: [PATCH] Add validation to avoid the upgrade if the Overcloud stack name has underscores. We need to ensure the Overcloud is fixed before proceeding with an Upgrade. Fix only for stable/newton Resolves: rhbz#1576839 Change-Id: I203d1b4bee19d24e0cadd52d66556f3e6af68528 Closes-Bug: 1775404 --- ...re-in-overcloud-name-3d75e93916184cff.yaml | 6 ++++ .../check-underscores-in-stack-name.yaml | 30 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 releasenotes/notes/check-underscore-in-overcloud-name-3d75e93916184cff.yaml create mode 100644 validations/check-underscores-in-stack-name.yaml diff --git a/releasenotes/notes/check-underscore-in-overcloud-name-3d75e93916184cff.yaml b/releasenotes/notes/check-underscore-in-overcloud-name-3d75e93916184cff.yaml new file mode 100644 index 000000000..078bb8f98 --- /dev/null +++ b/releasenotes/notes/check-underscore-in-overcloud-name-3d75e93916184cff.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + We don't allow having an Overcloud deployed using + underscores in the stack name. If it's the case, the user + will need to ensure this is changed before proceeding. diff --git a/validations/check-underscores-in-stack-name.yaml b/validations/check-underscores-in-stack-name.yaml new file mode 100644 index 000000000..41e9c7872 --- /dev/null +++ b/validations/check-underscores-in-stack-name.yaml @@ -0,0 +1,30 @@ +--- +- hosts: undercloud + vars: + metadata: + name: Check Overcloud stack name with underscores + description: > + This validation will check if there is deployed + an Overcloud using underscores in the stack name. + groups: + - pre-upgrade + tasks: + - name: Check if the Overcloud stack name has underscores + shell: | + source ~/stackrc + overcloud_name=$(openstack stack list -f json | jq -r '.[]["Stack Name"]' | grep -Po "_") + if [[ ! -z "$overcloud_name" ]]; then + naming_error='Underscore_Not_Allowed'; + fi + echo $naming_error; + register: naming_error + changed_when: false + - name: Check Overcloud name + fail: + msg: > + Overcloud stack name can't contain underscores as they are not + supported in newer versions. + Update the Overcloud stack name with a string without underscores + before proceeding with the upgrade. + when: + - naming_error.stdout == 'Underscore_Not_Allowed'