diff --git a/common/generate_bundle_base b/common/generate_bundle_base index 31091384..9ff2aa3a 100644 --- a/common/generate_bundle_base +++ b/common/generate_bundle_base @@ -9,13 +9,19 @@ declare -a overlay_opts=() # Catch any changes/additions to master opts update_master_opts ${MOD_PASSTHROUGH_OPTS[@]} +type=$(get_cloud_type) vip_start=${MASTER_OPTS[VIP_ADDR_START]} +cidr="" if [[ -z $vip_start ]] && [[ -e ~/novarc ]]; then - # prodstack - cidr=$(source ~/novarc; openstack subnet show subnet_${OS_USERNAME}-psd -c cidr -f value 2>/dev/null) + if [[ $type = openstack ]]; then + # prodstack + cidr=$(source ~/novarc; openstack subnet show subnet_${OS_USERNAME}-psd -c cidr -f value 2>/dev/null) + fi if [[ -z $cidr ]]; then - # stsstack - cidr=$(source ~/novarc; openstack subnet show ${OS_USERNAME}_admin_subnet -c cidr -f value 2>/dev/null) + if [[ $type = openstack ]]; then + # stsstack + cidr=$(source ~/novarc; openstack subnet show ${OS_USERNAME}_admin_subnet -c cidr -f value 2>/dev/null) + fi if [[ -n $cidr ]]; then vip_start=$(echo $cidr| sed -r 's/([0-9]+\.[0-9]+).+/\1/g').150.0 fi diff --git a/common/helpers b/common/helpers index 83f0e8bf..d3b7aa80 100644 --- a/common/helpers +++ b/common/helpers @@ -43,6 +43,13 @@ list_overlays () } | sort -u } +get_cloud_type () +{ + local cloud=`juju show-model| sed -rn 's/.+cloud:\s*(.+).*/\1/p'| uniq` + local type=`juju show-cloud $cloud| sed -rn 's/^type:\s*(.+).*/\1/p'| uniq` + echo "$type" +} + _usage () { cat << EOF USAGE: `basename $0` OPTIONS [OVERLAYS] [MODULE_OPTS] @@ -791,8 +798,7 @@ ensure_model # Establish what cloud provider is in use and if it's MAAS, use unit placement. # NOTE: this has to be done AFTER the model has been created and we have # switched context. -cloud=`juju show-model| sed -rn 's/.+cloud:\s*(.+).*/\1/p'| uniq` -type=`juju show-cloud $cloud| sed -rn 's/^type:\s*(.+).*/\1/p'| uniq` +type=$(get_cloud_type) if [[ $type = maas ]]; then echo "INFO: maas provider detected - enabling hyperconverged deployment" MASTER_OPTS[HYPERCONVERGED_DEPLOYMENT]=true