Updates to CONFIG, RESOURCES and LIB 45/14745/5
authorDan Radez <dradez@redhat.com>
Thu, 26 May 2016 18:34:31 +0000 (14:34 -0400)
committerDan Radez <dradez@redhat.com>
Sat, 28 May 2016 03:10:36 +0000 (23:10 -0400)
- removing the -r and -c parameters
- relying on ENV vars for non-system locations
- abstracting the apex-python-utils to a var

Change-Id: I7ff1ca8b741c890647aee029c57e8342f0b5cb07
Signed-off-by: Dan Radez <dradez@redhat.com>
ci/clean.sh
ci/deploy.sh
ci/util.sh
lib/common-functions.sh

index 4209006..08c0d53 100755 (executable)
 
 # Use default if no param passed
 CONFIG=${CONFIG:-'/var/opt/opnfv'}
+RESOURCES=${RESOURCES:-"$CONFIG/images"}
+LIB=${LIB:-"$CONFIG/lib"}
 
 ##LIBRARIES
-source $CONFIG/lib/common-functions.sh
+source $LIB/common-functions.sh
 
 vm_index=4
 ovs_bridges="br-admin br-private br-public br-storage"
index b520827..1ca3bcd 100755 (executable)
@@ -38,9 +38,11 @@ declare -A NET_MAP
 
 SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o LogLevel=error)
 DEPLOY_OPTIONS=""
-RESOURCES=${RESOURCES:-'/var/opt/opnfv/images'}
 CONFIG=${CONFIG:-'/var/opt/opnfv'}
+RESOURCES=${RESOURCES:-"$CONFIG/images"}
+LIB=${LIB:-"$CONFIG/lib"}
 OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network"
+
 VM_CPUS=4
 VM_RAM=8
 # Netmap used to map networks to OVS bridge names
@@ -51,6 +53,11 @@ NET_MAP['storage_network']="br-storage"
 ext_net_type="interface"
 ip_address_family=4
 
+# Libraries
+source $LIB/common-functions.sh
+source $LIB/utility-functions.sh
+source $LIB/installer/onos/onos_gw_mac_update.sh
+
 ##FUNCTIONS
 ##translates yaml into variables
 ##params: filename, prefix (ex. "config_")
@@ -107,7 +114,7 @@ parse_setting_value() {
 ##parses network settings yaml into globals
 parse_network_settings() {
   local output
-  if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse_net_settings -n $NETSETS -i $net_isolation_enabled); then
+  if output=$(python3.4 -B $LIB/python/apex-python-utils.py parse_net_settings -n $NETSETS -i $net_isolation_enabled); then
       echo -e "${blue}${output}${reset}"
       eval "$output"
   else
@@ -119,7 +126,7 @@ parse_network_settings() {
 ##parses deploy settings yaml into globals
 parse_deploy_settings() {
   local output
-  if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse-deploy-settings -f $DEPLOY_SETTINGS_FILE); then
+  if output=$(python3.4 -B $LIB/python/apex-python-utils.py parse-deploy-settings -f $DEPLOY_SETTINGS_FILE); then
       echo -e "${blue}${output}${reset}"
       eval "$output"
   else
@@ -628,12 +635,12 @@ function configure_undercloud {
     echo -e "${blue}Network Environment set for Deployment: ${reset}"
     cat $CONFIG/network-environment.yaml
     scp ${SSH_OPTIONS[@]} $CONFIG/network-environment.yaml "stack@$UNDERCLOUD":
-    if ! controller_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+    if ! controller_nic_template=$(python3.4 -B $LIB/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
       echo -e "${red}ERROR: Failed to generate controller NIC heat template ${reset}"
       exit 1
     fi
 
-    if ! compute_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+    if ! compute_nic_template=$(python3.4 -B $LIB/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
       echo -e "${red}ERROR: Failed to generate compute NIC heat template ${reset}"
       exit 1
     fi
@@ -1021,15 +1028,13 @@ EOI
 
 display_usage() {
   echo -e "Usage:\n$0 [arguments] \n"
-  echo -e "   -c|--config : Directory to configuration files. Optional.  Defaults to /var/opt/opnfv/ \n"
-  echo -e "   -d|--deploy-settings : Full path to deploy settings yaml file. Optional.  Defaults to null \n"
-  echo -e "   -i|--inventory : Full path to inventory yaml file. Required only for baremetal \n"
-  echo -e "   -n|--net-settings : Full path to network settings file. Optional. \n"
-  echo -e "   -p|--ping-site : site to use to verify IP connectivity. Optional. Defaults to 8.8.8.8 \n"
-  echo -e "   -r|--resources : Directory to deployment resources. Optional.  Defaults to /var/opt/opnfv/stack \n"
-  echo -e "   -v|--virtual : Virtualize overcloud nodes instead of using baremetal. \n"
-  echo -e "   --no-ha : disable High Availability deployment scheme, this assumes a single controller and single compute node \n"
-  echo -e "   --flat : disable Network Isolation and use a single flat network for the underlay network.\n"
+  echo -e "   -d|--deploy-settings : Full path to deploy settings yaml file. Optional.  Defaults to null"
+  echo -e "   -i|--inventory : Full path to inventory yaml file. Required only for baremetal"
+  echo -e "   -n|--net-settings : Full path to network settings file. Optional."
+  echo -e "   -p|--ping-site : site to use to verify IP connectivity. Optional. Defaults to 8.8.8.8"
+  echo -e "   -v|--virtual : Virtualize overcloud nodes instead of using baremetal."
+  echo -e "   --no-ha : disable High Availability deployment scheme, this assumes a single controller and single compute node"
+  echo -e "   --flat : disable Network Isolation and use a single flat network for the underlay network."
   echo -e "   --no-post-config : disable Post Install configuration."
   echo -e "   --debug : enable debug output."
   echo -e "   --interactive : enable interactive deployment mode which requires user to confirm steps of deployment."
@@ -1052,11 +1057,6 @@ parse_cmdline() {
                 display_usage
                 exit 0
             ;;
-        -c|--config)
-                CONFIG=$2
-                echo "Deployment Configuration Directory Overridden to: $2"
-                shift 2
-            ;;
         -d|--deploy-settings)
                 DEPLOY_SETTINGS_FILE=$2
                 echo "Deployment Configuration file: $2"
@@ -1076,11 +1076,6 @@ parse_cmdline() {
                 echo "Using $2 as the ping site"
                 shift 2
             ;;
-        -r|--resources)
-                RESOURCES=$2
-                echo "Deployment Resources Directory Overridden to: $2"
-                shift 2
-            ;;
         -v|--virtual)
                 virtual="TRUE"
                 echo "Executing a Virtual Deployment"
@@ -1166,12 +1161,6 @@ parse_cmdline() {
     post_config="FALSE"
   fi
 
-  ##LIBRARIES
-  # Do this after cli parse so that $CONFIG is set properly
-  source $CONFIG/lib/common-functions.sh
-  source $CONFIG/lib/utility-functions.sh
-  source $CONFIG/lib/installer/onos/onos_gw_mac_update.sh
-
 }
 
 ##END FUNCTIONS
index 67748c0..b262c20 100755 (executable)
@@ -3,9 +3,11 @@
 # @author Tim Rozet (trozet@redhat.com)
 
 CONFIG=${CONFIG:-'/var/opt/opnfv'}
+RESOURCES=${RESOURCES:-"$CONFIG/images"}
+LIB=${LIB:-"$CONFIG/lib"}
 VALID_CMDS="undercloud debug-stack -h --help"
 
-source $CONFIG/lib/utility-functions.sh
+source $LIB/utility-functions.sh
 
 resolve_cmd() {
   local given=$1
index dfac008..244d758 100644 (file)
@@ -18,7 +18,7 @@ function find_ip {
     return 1
   fi
 
-  python3.4 -B $CONFIG/lib/python/apex-python-utils.py find_ip -i $1
+  python3.4 -B $LIB/python/apex-python-utils.py find_ip -i $1
 }
 
 ##attach interface to OVS and set the network config correctly