summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2016-08-30 13:06:33 -0400
committerTim Rozet <trozet@redhat.com>2016-08-30 21:47:55 +0000
commitae26e2717c408225534033726614a25e16fe18ca (patch)
treec71cc3f99a03d42a8ec794337c15d10a3a3afbe8 /ci
parent2eaa43854eb4abfcae8566c37cfb63f187f6696f (diff)
Adds ability to power off nodes in clean
Now if an inventory file is provided to clean, those nodes will be powered off. JIRA: APEX-250 Change-Id: I2d78285717726c3d1c9d7d88c38e706d4617e337 Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'ci')
-rwxr-xr-xci/clean.sh63
-rwxr-xr-xci/dev_deploy_check.sh3
2 files changed, 62 insertions, 4 deletions
diff --git a/ci/clean.sh b/ci/clean.sh
index 4cf6b64..e4b2d10 100755
--- a/ci/clean.sh
+++ b/ci/clean.sh
@@ -16,17 +16,72 @@
CONFIG=${CONFIG:-'/var/opt/opnfv'}
RESOURCES=${RESOURCES:-"$CONFIG/images"}
LIB=${LIB:-"$CONFIG/lib"}
+reset=$(tput sgr0 || echo "")
+blue=$(tput setaf 4 || echo "")
+red=$(tput setaf 1 || echo "")
+green=$(tput setaf 2 || echo "")
##LIBRARIES
-if ! source $LIB/common-functions.sh; then
- echo "Failed to source $LIB/common-functions.sh"
- exit 1
-fi
+for lib in common-functions parse-functions; do
+ if ! source $LIB/${lib}.sh; then
+ echo "Failed to source $LIB/${lib}.sh"
+ exit 1
+ fi
+done
vm_index=4
ovs_bridges="br-admin br-private br-public br-storage"
OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network api_network"
+
+display_usage() {
+ echo -e "Usage:\n$0 [arguments] \n"
+ echo -e " -i|--inventory : Full path to inventory yaml file. Required only for baremetal node clean"
+}
+
+##translates the command line parameters into variables
+##params: $@ the entire command line is passed
+##usage: parse_cmd_line() "$@"
+parse_cmdline() {
+ echo -e "\n\n${blue}This script is used to deploy the Apex Installer and Provision OPNFV Target System${reset}\n\n"
+ echo "Use -h to display help"
+ sleep 2
+
+ while [ "${1:0:1}" = "-" ]
+ do
+ case "$1" in
+ -h|--help)
+ display_usage
+ exit 0
+ ;;
+ -i|--inventory)
+ INVENTORY_FILE=$2
+ shift 2
+ ;;
+ *)
+ display_usage
+ exit 1
+ ;;
+ esac
+ done
+
+ if [[ ! -z "$INVENTORY_FILE" && ! -f "$INVENTORY_FILE" ]]; then
+ echo -e "{$red}ERROR: Inventory File: ${INVENTORY_FILE} does not exist! Exiting...${reset}"
+ exit 1
+ fi
+}
+
+parse_cmdline "$@"
+
+if [ -n "$INVENTORY_FILE" ]; then
+ echo -e "${blue}INFO: Parsing inventory file...${reset}"
+ if ! python3.4 -B $LIB/python/apex_python_utils.py clean -f ${INVENTORY_FILE}; then
+ echo -e "${red}WARN: Unable to shutdown all nodes! Please check /var/log/apex.log${reset}"
+ else
+ echo -e "${blue}INFO: Node shutdown complete...${reset}"
+ fi
+fi
+
# Clean off instack/undercloud VM
for vm in instack undercloud; do
virsh destroy $vm 2> /dev/null | xargs echo -n
diff --git a/ci/dev_deploy_check.sh b/ci/dev_deploy_check.sh
index 68a9ac2..0ce135a 100755
--- a/ci/dev_deploy_check.sh
+++ b/ci/dev_deploy_check.sh
@@ -42,6 +42,9 @@ for i in epel-release python34-PyYAML openvswitch openstack-tripleo libguestfs l
fi
done
+# install pip dependencies
+easy_install-3.4 pip
+sudo pip3 install python-ipmi
# Make sure jinja2 is installed
easy_install-3.4 jinja2