summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/bash_completion_apex56
-rw-r--r--build/rpm_specs/opnfv-apex-common.spec6
-rwxr-xr-xci/deploy.sh12
-rwxr-xr-xci/util.sh18
4 files changed, 77 insertions, 15 deletions
diff --git a/build/bash_completion_apex b/build/bash_completion_apex
new file mode 100644
index 00000000..b3c963e3
--- /dev/null
+++ b/build/bash_completion_apex
@@ -0,0 +1,56 @@
+# bash/zsh completion support for OPNFV Apex
+##############################################################################
+# Copyright (c) 2016 Dan Radez (Red Hat) and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Pieces of this script are derived from the git bash completion script
+
+___main () {
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts=" -h $(${COMP_WORDS[0]} -h | grep -Eo '^ [^ ]+')"
+ if [[ ! $opts =~ $prev ]]; then
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ fi
+}
+
+# these functions are setup like this in the thought that
+# deploy and util will eventually diverge from each other
+# for now they can use the same main logic so it's just
+# abstracted to another function
+__deploy_main () {
+ ___main
+}
+
+
+__util_main () {
+ ___main
+}
+
+
+__apex_func_wrap () {
+ local cur words cword prev
+ _get_comp_words_by_ref -n =: cur words cword prev
+ $1
+}
+
+# Setup function for bash completion
+__apex_complete () {
+ local wrapper="__apex_wrap${2}"
+ eval "$wrapper () { __apex_func_wrap $2 ; }"
+ complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \
+ || complete -o default -o nospace -F $wrapper $1
+}
+
+# run completion setup
+__apex_complete ./deploy.sh __deploy_main
+__apex_complete opnfv-deploy __deploy_main
+__apex_complete ./util.sh __util_main
+__apex_complete opnfv-util __util_main
diff --git a/build/rpm_specs/opnfv-apex-common.spec b/build/rpm_specs/opnfv-apex-common.spec
index 8fd241b4..443c3e40 100644
--- a/build/rpm_specs/opnfv-apex-common.spec
+++ b/build/rpm_specs/opnfv-apex-common.spec
@@ -33,6 +33,9 @@ install ci/deploy.sh %{buildroot}%{_bindir}/opnfv-deploy
install ci/clean.sh %{buildroot}%{_bindir}/opnfv-clean
install ci/util.sh %{buildroot}%{_bindir}/opnfv-util
+mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/
+install build/bash_completion_apex %{buildroot}%{_sysconfdir}/bash_completion.d/apex
+
mkdir -p %{buildroot}%{_sysconfdir}/opnfv-apex/
install config/deploy/os-nosdn-nofeature-noha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-nosdn-nofeature-noha.yaml
install config/deploy/os-nosdn-fdio-noha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-nosdn-fdio-noha.yaml
@@ -105,6 +108,7 @@ install config/inventory/pod_example_settings.yaml %{buildroot}%{_docdir}/opnfv/
%{python3_sitelib}/apex/
%{_var}/opt/opnfv/lib/installer/onos/onos_gw_mac_update.sh
%{_var}/opt/opnfv/lib/installer/domain.xml
+%{_sysconfdir}/bash_completion.d/apex
%{_sysconfdir}/opnfv-apex/os-nosdn-nofeature-noha.yaml
%{_sysconfdir}/opnfv-apex/os-nosdn-fdio-noha.yaml
%{_sysconfdir}/opnfv-apex/os-nosdn-ovs-noha.yaml
@@ -132,6 +136,8 @@ install config/inventory/pod_example_settings.yaml %{buildroot}%{_docdir}/opnfv/
%doc %{_docdir}/opnfv/inventory.yaml.example
%changelog
+* Fri Sep 16 2016 Dan Radez <dradez@redhat.com> - 3.0-13
+- adding bash completion script
* Tue Aug 30 2016 Tim Rozet <trozet@redhat.com> - 3.0-12
- Add clean library.
* Mon Aug 1 2016 Tim Rozet <trozet@redhat.com> - 3.0-11
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 0a2eec2e..7f92702c 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -77,11 +77,11 @@ done
display_usage() {
echo -e "Usage:\n$0 [arguments] \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 " --deploy-settings | -d : Full path to deploy settings yaml file. Optional. Defaults to null"
+ echo -e " --inventory | -i : Full path to inventory yaml file. Required only for baremetal"
+ echo -e " --net-settings | -n : Full path to network settings file. Optional."
+ echo -e " --ping-site | -p : site to use to verify IP connectivity. Optional. Defaults to 8.8.8.8"
+ echo -e " --virtual | -v : Virtualize overcloud nodes instead of using baremetal."
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."
@@ -96,7 +96,6 @@ display_usage() {
parse_cmdline() {
echo -e "\n\n${blue}This script is used to deploy the Apex Installer and Provision OPNFV Target System${reset}\n\n"
echo "Use -h to display help"
- sleep 2
while [ "${1:0:1}" = "-" ]
do
@@ -171,6 +170,7 @@ parse_cmdline() {
;;
esac
done
+ sleep 2
if [[ ! -z "$NETSETS" && "$net_isolation_enabled" == "FALSE" ]]; then
echo -e "${red}INFO: Single flat network requested. Only admin_network settings will be used!${reset}"
diff --git a/ci/util.sh b/ci/util.sh
index 8c09278a..480858d0 100755
--- a/ci/util.sh
+++ b/ci/util.sh
@@ -23,19 +23,19 @@ resolve_cmd() {
display_usage() {
echo -e "Usage:\n$0 subcommand [ arguments ]\n"
echo -e "Arguments:\n"
- echo -e " undercloud [ user [ command ] ] Connect to Undercloud VM as user and optionally execute a command\n"
- echo -e " user Optional: Defaults to 'stack'\n"
- echo -e " command Optional: Defaults to none\n"
+ echo -e " undercloud [ user [ command ] ] Connect to Undercloud VM as user and optionally execute a command"
+ echo -e " user Optional: Defaults to 'stack'"
+ echo -e " command Optional: Defaults to none"
echo -e ""
- echo -e " opendaylight Connect to OpenDaylight Karaf console\n"
+ echo -e " opendaylight Connect to OpenDaylight Karaf console"
echo -e ""
- echo -e " overcloud [ node [ command ] ] Connect to an Overcloud node and optionally execute a command\n"
- echo -e " node Required: in format controller|compute<number>. Example: controller0\n"
- echo -e " command Optional: Defaults to none\n"
+ echo -e " overcloud [ node [ command ] ] Connect to an Overcloud node and optionally execute a command"
+ echo -e " node Required: in format controller|compute<number>. Example: controller0"
+ echo -e " command Optional: Defaults to none"
echo -e ""
- echo -e " debug-stack Print parsed deployment failures to stdout \n"
+ echo -e " debug-stack Print parsed deployment failures to stdout"
echo -e ""
- echo -e " mock-detached on | off Add firewall rules to the jump host to mock a detached deployment \n"
+ echo -e " mock-detached on | off Add firewall rules to the jump host to mock a detached deployment\n"
}
##translates the command line argument