
This change adds a script in /usr/local/bin that "wraps" the ceph command so that ceph cluster queries look the same regardless of which ceph backend is enabled ("ceph" or "ceph-rook). Obtaining which backend is defined is done through flags '/etc/platform/.node_rook_configured' and '/etc/platform/.node_ceph_configured'. If none of them exist, a message will be displayed that ceph is not enabled. Test Plan: - PASS: Build rook-ceph package - PASS: Install the deb file on SX (with ceph defined and another with rook-ceph) - PASS: Run ceph commands - PASS: Validate bash completion - PASS: Delete rook-ceph-tools pod and run ceph command - PASS: Delete the defined backend flag - PASS: Using "-o": ceph osd getcrushmap -o crushmap.bin - PASS: Using "-i": ceph dashboard \ ac-user-set-password admin -i password.txt Story: 2011066 Task: 50435 Change-Id: Id40108d28f59c0b7b8a3dfb859ae599557b4c247 Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
51 lines
1.4 KiB
Bash
51 lines
1.4 KiB
Bash
#
|
|
# Ceph - scalable distributed file system
|
|
#
|
|
# This is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
# License version 2.1, as published by the Free Software
|
|
# Foundation.
|
|
#
|
|
|
|
_ceph()
|
|
{
|
|
local options_noarg="-h --help -s --status -w --watch --watch-debug --watch-info --watch-sec --watch-warn --watch-error --version -v --verbose --concise"
|
|
local options_arg="-c --conf -i --in-file -o --out-file --id --user -n --name --cluster --admin-daemon --admin-socket -f --format --connect-timeout"
|
|
local cnt=${#COMP_WORDS[@]}
|
|
local cur=${COMP_WORDS[COMP_CWORD]}
|
|
local prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
if [[ " -c --conf -i --in-file -o --out-file " =~ " ${prev} " ]]
|
|
then
|
|
#default autocomplete for options (file autocomplete)
|
|
compopt -o default
|
|
COMPREPLY=()
|
|
return 0
|
|
fi
|
|
if [[ "${cur:0:1}" == "-" ]] ;
|
|
then
|
|
COMPREPLY=( $(compgen -W "${options_noarg} ${options_arg}" -- $cur) )
|
|
return 0
|
|
fi
|
|
declare -a hint_args
|
|
for (( i=1 ; i<cnt ; i++ ))
|
|
do
|
|
#skip this word if it is option
|
|
if [[ " ${options_noarg} " =~ " ${COMP_WORDS[i]} " ]]
|
|
then
|
|
continue
|
|
fi
|
|
#skip this word and next if it is option with arg
|
|
if [[ " ${options_arg} " =~ " ${COMP_WORDS[i]} " ]]
|
|
then
|
|
((i++));
|
|
continue
|
|
fi
|
|
hint_args[$((i-1))]="${COMP_WORDS[i]}"
|
|
done
|
|
|
|
local IFS=$'\n'
|
|
COMPREPLY=( $(${COMP_WORDS[0]} --completion "${hint_args[@]}" 2>/dev/null) )
|
|
}
|
|
complete -F _ceph ceph
|