2 # Utility script used to interact with a deployment
3 # @author Tim Rozet (trozet@redhat.com)
5 CONFIG=${CONFIG:-'/var/opt/opnfv'}
6 RESOURCES=${RESOURCES:-"$CONFIG/images"}
7 LIB=${LIB:-"$CONFIG/lib"}
8 VALID_CMDS="undercloud debug-stack -h --help"
10 source $LIB/utility-functions.sh
16 local inv=(${list[*]##${given}*})
17 local OIFS=$IFS; IFS='|'; local pat="${inv[*]}"; IFS=$OIFS
19 echo "${list[*]##+($pat)}"
24 echo -e "Usage:\n$0 [arguments] \n"
25 echo -e " undercloud <user> : Connect to Undercloud VM as <user>\n"
26 echo -e " debug-stack : Print parsed deployment failures to stdout \n"
29 ##translates the command line argument
30 ##params: $@ the entire command line is passed
31 ##usage: parse_cmd_line() "$@"
35 match=($(resolve_cmd $1 $VALID_CMDS))
36 if [ ${#match[*]} -gt 1 ]; then
37 echo "$1 is ambiguous, possible matches: ${match[*]}" >&2
39 elif [ ${#match[*]} -lt 1 ]; then
40 echo "$1 is not a recognized command. Use -h to see acceptable list" >&2
43 match=$(echo $match | tr -d ' ')
53 # connect as stack by default
54 undercloud_connect stack
61 undercloud_connect stack "$(typeset -f debug_stack); debug_stack"
65 echo -e "\n\nThis script is used to interact with Apex deployments\n\n"
66 echo "Use -h to display help"