summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2018-09-20 12:32:57 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-09-20 12:32:57 +0000
commit89ddab889df092ac9ed43834af534b9f5dea6b9d (patch)
tree1e6a6d7fe9d7e3a1583b292cc5b6be7f4e96615c
parentf5968f2ad1fe036bfca986ceb8987f7142bc72f8 (diff)
parentb6367aeb802a0032ff08bbf96af590c91c52d43e (diff)
Merge "xci: Add ability to pass command line options to xci-deploy.sh"
-rw-r--r--xci/files/xci-lib.sh29
-rwxr-xr-xxci/playbooks/dynamic_inventory.py4
-rwxr-xr-xxci/xci-deploy.sh5
3 files changed, 36 insertions, 2 deletions
diff --git a/xci/files/xci-lib.sh b/xci/files/xci-lib.sh
index 064b9f68..2f360e44 100644
--- a/xci/files/xci-lib.sh
+++ b/xci/files/xci-lib.sh
@@ -10,6 +10,35 @@
# Avoid double sourcing the file
[[ -n ${XCI_LIB_SOURCED:-} ]] && return 0 || export XCI_LIB_SOURCED=1
+function usage() {
+ echo "
+Usage: $(basename ${0}) [-i <idf>] [-p <pdf>]
+
+ -h: This message
+ -i: Installer Descriptor File (IDF). (Default ${XCI_PATH}/xci/var/idf.yml)
+ -p: Pod Descriptor File (PDF). (Default ${XCI_PATH}/xci/var/pdf.yml)
+ "
+ exit 0
+}
+
+function parse_cmdline_opts() {
+ IDF=${XCI_PATH}/xci/var/idf.yml
+ PDF=${XCI_PATH}/xci/var/pdf.yml
+
+ while getopts ":hi:p:" o; do
+ case "${o}" in
+ i) IDF="${OPTARG}" ;;
+ p) PDF="${OPTARG}" ;;
+ h) usage ;;
+ *) echo "ERROR: Invalid option '-${OPTARG}'"; usage ;;
+ esac
+ done
+
+ # Do all the exports
+ export PDF=$(realpath ${PDF})
+ export IDF=$(realpath ${IDF})
+}
+
function bootstrap_xci_env() {
# Declare our virtualenv
export XCI_VENV=${XCI_PATH}/venv/
diff --git a/xci/playbooks/dynamic_inventory.py b/xci/playbooks/dynamic_inventory.py
index 9a1624b0..f6e93398 100755
--- a/xci/playbooks/dynamic_inventory.py
+++ b/xci/playbooks/dynamic_inventory.py
@@ -74,8 +74,8 @@ class XCIInventory(object):
self.args = parser.parse_args()
def read_pdf_idf(self):
- pdf_file = os.path.dirname(os.path.realpath(__file__)) + "/../var/pdf.yml"
- idf_file = os.path.dirname(os.path.realpath(__file__)) + "/../var/idf.yml"
+ pdf_file = os.environ['PDF']
+ idf_file = os.environ['IDF']
nodes = []
host_networks = {}
diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh
index c1654151..d9c41968 100755
--- a/xci/xci-deploy.sh
+++ b/xci/xci-deploy.sh
@@ -50,6 +50,11 @@ done
unset user_local_dev_vars local_user_var
#
+# Parse command line options
+#
+parse_cmdline_opts $*
+
+#
# Bootstrap environment for XCI Deployment
#
echo "Info: Preparing host environment for the XCI deployment"