devstack-heat: Make parameters overridable
Up until now, if you wanted to change the defaults in the parameters, you had to go and edit the hot/parameters.yml file. This was inconvenient because it would then show up in git diff and prevent git review from normal operation. This patch makes it so that now you can pass the parameters just like if it was the openstack-cli. For example: ./devstack-heat stack \ --parameter \ "public_net=fbf9bcc6-cbaa-4c24-8d56-8010915a6494" \ --parameter \ "image=CentOS-7-x86_64-GenericCloud-1801-01" Change-Id: Icf4fb124d03f56c8cf383971c5161520a1734d94 Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
This commit is contained in:
parent
c2b81a2adf
commit
cfa3d1121b
3
.gitignore
vendored
3
.gitignore
vendored
@ -65,6 +65,9 @@ contrib/vagrant/user_local.conf
|
||||
# Log files
|
||||
*.log
|
||||
|
||||
# devstack-heat
|
||||
*.pem
|
||||
|
||||
# Binaries from docker images builds
|
||||
kuryr-cni-bin
|
||||
kuryr-cni
|
||||
|
@ -7,14 +7,53 @@ CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source "${CURR_DIR}/lib/devstack-heat"
|
||||
|
||||
function sub_stack() {
|
||||
local deployment=${1:-master_}
|
||||
local deployment
|
||||
local environment
|
||||
local key
|
||||
local parameters
|
||||
local positional
|
||||
|
||||
parameters=()
|
||||
positional=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
case $key in
|
||||
-e|--environment)
|
||||
environment="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--parameter)
|
||||
parameters+=("$key")
|
||||
parameters+=("$2")
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
positional+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [[ ${#positional[@]} -eq 0 ]]; then
|
||||
deployment=master_
|
||||
else
|
||||
deployment="${positional[0]}"
|
||||
fi
|
||||
deployment=$(_generate_deployment_name "${deployment}")
|
||||
|
||||
if [[ -z "$environment" ]]; then
|
||||
environment="hot/parameters.yml"
|
||||
fi
|
||||
|
||||
# create stack
|
||||
_confirm_or_exit "Deploying the stack ${deployment}"
|
||||
echo "Starting..."
|
||||
|
||||
openstack stack create -e hot/parameters.yml -t hot/devstack_heat_template.yml "$deployment"
|
||||
set -- "${parameters[@]}"
|
||||
set -x
|
||||
openstack stack create -e "$environment" -t hot/devstack_heat_template.yml "$@" "$deployment"
|
||||
set +x
|
||||
|
||||
sub_show "$deployment"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
parameters:
|
||||
parameter_defaults:
|
||||
image: centos7
|
||||
flavor: m1.medium
|
||||
public_net: public
|
||||
|
Loading…
x
Reference in New Issue
Block a user