Allow baremetal-networks to be passed to devtest

Previously change I6e89dc98 allowed custom baremetal networks to be
configured in testenv.json.
This change allows you to pass in those custom entries as a json
file.

Change-Id: Iad5eb781fa236e71a40245d893f8f0b632b5c370
This commit is contained in:
John Brooker 2014-04-04 18:43:15 +00:00 committed by Gerrit Code Review
parent d87d326b23
commit d132adee99
2 changed files with 20 additions and 3 deletions

View File

@ -20,6 +20,10 @@ function show_options () {
echo " --existing-environment -- use an existing test environment. The JSON file"
echo " for it may be overridden via the TE_DATAFILE"
echo " environment variable."
echo " --bm-networks NETFILE -- You are supplying your own network layout."
echo " The schema for baremetal-network can be found in"
echo " the devtest_setup documentation."
echo
echo " --nodes NODEFILE -- You are supplying your own list of hardware."
echo " The schema for nodes can be found in the devtest_setup"
echo " documentation."
@ -34,12 +38,13 @@ function show_options () {
}
NODES_ARG=
NETS_ARG=
CONTINUE=
USE_CACHE=0
export TRIPLEO_CLEANUP=1
DEVTEST_START=$(date +%s) #nodocs
TEMP=$(getopt -o h,c -l existing-environment,trash-my-machine,nodes: -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o h,c -l existing-environment,trash-my-machine,nodes:,bm-networks: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -50,6 +55,7 @@ while true ; do
--trash-my-machine) CONTINUE=--trash-my-machine; shift 1;;
--existing-environment) TRIPLEO_CLEANUP=0; shift 1;;
--nodes) NODES_ARG="--nodes $2"; shift 2;;
--bm-networks) NETS_ARG="--bm-networks $2"; shift 2;;
-c) USE_CACHE=1; shift 1;;
-h) show_options 0;;
--) shift ; break ;;
@ -187,7 +193,7 @@ devtest_setup.sh $CONTINUE
if [ "$TRIPLEO_CLEANUP" = "1" ]; then #nodocs
#XXX: When updating, also update the header in devtest_testenv.sh #nodocs
devtest_testenv.sh $TE_DATAFILE $NODES_ARG
devtest_testenv.sh $TE_DATAFILE $NODES_ARG $NETS_ARG
fi #nodocs
## #. See :doc:`devtest_ramdisk` for documentation::

View File

@ -22,6 +22,10 @@ function show_options () {
echo " The schema for nodes can be found in the devtest_setup"
echo " documentation."
echo
echo " --bm-networks NETFILE -- You are supplying your own network layout."
echo " The schema for baremetal-network can be found in"
echo " the devtest_setup documentation."
echo
echo "JSON-filename -- the path to write the environment description to."
echo
echo "Note: This adds a unique key to your authorised_keys file to permit "
@ -31,10 +35,11 @@ function show_options () {
}
NODES_PATH=
NETS_PATH=
NUM=
OVSBRIDGE=
TEMP=$(getopt -o h,n:,b: -l nodes: -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o h,n:,b: -l nodes:,bm-networks: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -43,6 +48,7 @@ eval set -- "$TEMP"
while true ; do
case "$1" in
--nodes) NODES_PATH="$2"; shift 2;;
--bm-networks) NETS_PATH="$2"; shift 2;;
-b) OVSBRIDGE="$2" ; shift 2 ;;
-h) show_options 0;;
-n) NUM="$2" ; shift 2 ;;
@ -175,6 +181,11 @@ jq "." <<EOF > $JSONFILE
}
EOF
if [ -n "$NETS_PATH" ]; then #nodocs
JSON=$(jq -s '.[0]["baremetal-network"]=.[1] | .[0]' $JSONFILE $NETS_PATH)
echo "${JSON}" > $JSONFILE
fi
## #. If you have an existing set of nodes to use, use them.
## ::