397e40a89f
Update misc compute references to worker Tests Performed: Non-containerized deployment AIO-SX: Sanity and Nightly automated test suite AIO-DX: Sanity and Nightly automated test suite 2+2 System: Sanity and Nightly automated test suite 2+2 System: Horizon Patch Orchestration Kubernetes deployment: AIO-SX: Create, delete, reboot and rebuild instances 2+2+2 System: worker nodes are unlock enable and no alarms Story: 2004022 Task: 27013 Depends-On: https://review.openstack.org/#/c/624452/ Change-Id: I7b2de5c7202f2e86b55f5343c8d79d50e3a072a2 Signed-off-by: Tao Liu <tao.liu@windriver.com>
191 lines
7.2 KiB
Plaintext
Executable File
191 lines
7.2 KiB
Plaintext
Executable File
#
|
|
# Copyright (c) 2016-2017 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
#
|
|
# This file provides bash-completion functionality for the sw-manager CLI
|
|
#
|
|
|
|
function _swmanager()
|
|
{
|
|
COMPREPLY=()
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
local subcommand=${COMP_WORDS[1]}
|
|
|
|
#
|
|
# The available sw-manager subcommands
|
|
#
|
|
local subcommands="
|
|
patch-strategy
|
|
upgrade-strategy
|
|
"
|
|
|
|
if [ $COMP_CWORD -gt 1 ]; then
|
|
#
|
|
# Complete the arguments to the subcommands
|
|
#
|
|
case "$subcommand" in
|
|
patch-strategy)
|
|
local actions="
|
|
create
|
|
delete
|
|
apply
|
|
abort
|
|
show
|
|
"
|
|
if [ $COMP_CWORD -gt 2 ]; then
|
|
local action=${COMP_WORDS[2]}
|
|
#
|
|
# Complete the arguments for each action
|
|
#
|
|
case "$action" in
|
|
create)
|
|
local createopts="
|
|
--controller-apply-type
|
|
--storage-apply-type
|
|
--worker-apply-type
|
|
--max-parallel-worker-hosts
|
|
--instance-action
|
|
--alarm-restrictions
|
|
"
|
|
local createopt=${prev}
|
|
case "$createopt" in
|
|
--controller-apply-type)
|
|
COMPREPLY=($(compgen -W "serial ignore" -- ${cur}))
|
|
return 0
|
|
;;
|
|
--storage-apply-type|--worker-apply-type)
|
|
COMPREPLY=($(compgen -W "serial parallel ignore" -- ${cur}))
|
|
return 0
|
|
;;
|
|
--max-parallel-worker-hosts)
|
|
COMPREPLY=( $(compgen -- ${cur}))
|
|
return 0
|
|
;;
|
|
--instance-action)
|
|
COMPREPLY=($(compgen -W "migrate stop-start" -- ${cur}))
|
|
return 0
|
|
;;
|
|
--alarm-restrictions)
|
|
COMPREPLY=($(compgen -W "strict relaxed" -- ${cur}))
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
COMPREPLY=($(compgen -W "${createopts}" -- ${cur}))
|
|
return 0
|
|
;;
|
|
apply|abort)
|
|
if [ "${prev}" = "${action}" ]; then
|
|
COMPREPLY=($(compgen -W "--stage-id" -- ${cur}))
|
|
fi
|
|
return 0
|
|
;;
|
|
show)
|
|
if [ "${prev}" = "${action}" ]; then
|
|
COMPREPLY=($(compgen -W "--details" -- ${cur}))
|
|
fi
|
|
return 0
|
|
;;
|
|
delete)
|
|
# These subcommands have no options/arguments
|
|
COMPREPLY=( $(compgen -- ${cur}) )
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# Provide actions for completion
|
|
COMPREPLY=($(compgen -W "${actions}" -- ${cur}))
|
|
return 0
|
|
;;
|
|
upgrade-strategy)
|
|
local actions="
|
|
create
|
|
delete
|
|
apply
|
|
abort
|
|
show
|
|
"
|
|
if [ $COMP_CWORD -gt 2 ]; then
|
|
local action=${COMP_WORDS[2]}
|
|
#
|
|
# Complete the arguments for each action
|
|
#
|
|
case "$action" in
|
|
create)
|
|
local createopts="
|
|
--storage-apply-type
|
|
--worker-apply-type
|
|
--max-parallel-worker-hosts
|
|
--alarm-restrictions
|
|
"
|
|
local createopt=${prev}
|
|
case "$createopt" in
|
|
--storage-apply-type)
|
|
COMPREPLY=($(compgen -W "serial parallel ignore" -- ${cur}))
|
|
return 0
|
|
;;
|
|
--worker-apply-type)
|
|
COMPREPLY=($(compgen -W "serial parallel ignore" -- ${cur}))
|
|
return 0
|
|
;;
|
|
--max-parallel-worker-hosts)
|
|
COMPREPLY=( $(compgen -- ${cur}))
|
|
return 0
|
|
;;
|
|
--alarm-restrictions)
|
|
COMPREPLY=($(compgen -W "strict relaxed" -- ${cur}))
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
COMPREPLY=($(compgen -W "${createopts}" -- ${cur}))
|
|
return 0
|
|
;;
|
|
apply|abort)
|
|
if [ "${prev}" = "${action}" ]; then
|
|
COMPREPLY=($(compgen -W "--stage-id" -- ${cur}))
|
|
fi
|
|
return 0
|
|
;;
|
|
show)
|
|
if [ "${prev}" = "${action}" ]; then
|
|
COMPREPLY=($(compgen -W "--details" -- ${cur}))
|
|
fi
|
|
return 0
|
|
;;
|
|
delete)
|
|
# These subcommands have no options/arguments
|
|
COMPREPLY=( $(compgen -- ${cur}) )
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# Provide actions for completion
|
|
COMPREPLY=($(compgen -W "${actions}" -- ${cur}))
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# Provide subcommands for completion
|
|
COMPREPLY=($(compgen -W "${subcommands}" -- ${cur}))
|
|
return 0
|
|
}
|
|
|
|
# Bind the above function to the sw-manager CLI
|
|
complete -F _swmanager -o filenames sw-manager
|