diff options
author | Tim Rozet <trozet@redhat.com> | 2016-08-31 01:40:12 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-08-31 01:40:13 +0000 |
commit | f01595f801e1d78f84b43c111f2955f67573e263 (patch) | |
tree | 37d553b3b2ced09a87923fd9e1328d7608aec048 /ci | |
parent | 04a7bf2596ea69def02e8aaedd32f091b35ba7ce (diff) | |
parent | 4b84887ed2322db6b04924bdee7b44d3dcf7c32d (diff) |
Merge "Adds ability to power off nodes in clean"
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/clean.sh | 63 | ||||
-rwxr-xr-x | ci/dev_deploy_check.sh | 3 |
2 files changed, 62 insertions, 4 deletions
diff --git a/ci/clean.sh b/ci/clean.sh index 4cf6b64a..e4b2d106 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 68a9ac2b..0ce135ad 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 |