51441fef44
This commit disables the security hardening role during major upgrades by creating a temporary file. It removes the file after a sucessful upgrade. Change-Id: Ib32e0e317a84a443fb7fc9d3a364a16bd469b6e3 Closes-Bug: #1568029
93 lines
2.9 KiB
Bash
Executable File
93 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2015, Rackspace US, Inc.
|
|
#
|
|
# 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.
|
|
|
|
# NOTICE: To run this in an automated fashion run the script via
|
|
# root@HOSTNAME:/opt/openstack-ansible# echo "YES" | bash scripts/run-upgrade.sh
|
|
|
|
|
|
## Shell Opts ----------------------------------------------------------------
|
|
set -e -u -v
|
|
|
|
## Functions -----------------------------------------------------------------
|
|
|
|
function check_for_juno {
|
|
if [ -d "/etc/rpc_deploy" ];then
|
|
echo "--------------ERROR--------------"
|
|
echo "/etc/rpc_deploy directory found, which looks like you're trying to upgrade from Juno."
|
|
echo "Please upgrade your environment to Kilo before proceeding."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
|
|
function check_for_kilo {
|
|
if [[ ! -d "/etc/openstack_deploy" ]]; then
|
|
echo "--------------ERROR--------------"
|
|
echo "/etc/openstack_deploy directory not found."
|
|
echo "It appears you do not have a Kilo environment installed."
|
|
exit 2
|
|
fi
|
|
}
|
|
|
|
function pre_flight {
|
|
## Library Check -------------------------------------------------------------
|
|
echo "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh
|
|
## Pre-flight Check ----------------------------------------------------------
|
|
# Clear the screen and make sure the user understands whats happening.
|
|
clear
|
|
|
|
# Notify the user.
|
|
echo -e "
|
|
This script will perform a v11.x to v12.x upgrade.
|
|
Once you start the upgrade there's no going back.
|
|
|
|
Note, this is an online upgrade and while the
|
|
in progress running VMs will not be impacted.
|
|
However, you can expect some hiccups with OpenStack
|
|
API services while the upgrade is running.
|
|
|
|
Are you ready to perform this upgrade now?
|
|
"
|
|
|
|
# Confirm the user is ready to upgrade.
|
|
read -p 'Enter "YES" to continue or anything else to quit: ' UPGRADE
|
|
if [ "${UPGRADE}" == "YES" ]; then
|
|
echo "Running Upgrade from v11.x to v12.x"
|
|
else
|
|
exit 99
|
|
fi
|
|
}
|
|
|
|
function disable_security_hardening {
|
|
echo 'apply_security_hardening: False' > /etc/openstack_deploy/user_zzz_disable_security_hardening.yml
|
|
}
|
|
|
|
|
|
function reset_security_hardening {
|
|
rm /etc/openstack_deploy/user_zzz_disable_security_hardening.yml
|
|
}
|
|
|
|
## Main ----------------------------------------------------------------------
|
|
|
|
function main {
|
|
pre_flight
|
|
disable_security_hardening
|
|
check_for_juno
|
|
check_for_kilo
|
|
reset_security_hardening
|
|
}
|
|
|
|
main
|