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
This commit is contained in:
Carlos Camacho 2018-06-06 16:26:12 +02:00
parent 3130bc4129
commit b7631b7818
2 changed files with 36 additions and 0 deletions

View File

@ -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.

View File

@ -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'