Use vars for color definition
This commit is contained in:
parent
778231eff5
commit
4d1a881339
|
@ -3,6 +3,12 @@
|
|||
# Vars {{{
|
||||
debug="0"
|
||||
|
||||
## Colors {{{
|
||||
c_redb='\033[1;31m'
|
||||
c_magentab='\033[1;35m'
|
||||
c_reset='\033[0m'
|
||||
## }}}
|
||||
|
||||
osd_id_start="0"
|
||||
osd_id_end=$(sudo ceph osd getmaxosd | cut -d" " -f3)
|
||||
# }}}
|
||||
|
@ -12,7 +18,7 @@ osd_id_end=$(sudo ceph osd getmaxosd | cut -d" " -f3)
|
|||
check_osd() {
|
||||
_osd_id="${1}"
|
||||
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : check_osd func − OSD ID to check : ${_osd_id}."
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : check_osd func − OSD ID to check : ${_osd_id}."
|
||||
|
||||
sudo ceph osd find "${_osd_id}" > /dev/null 2>&1
|
||||
return $?
|
||||
|
@ -23,7 +29,7 @@ get_osd_host() {
|
|||
_osd_id="${1}"
|
||||
osd_id_host=""
|
||||
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : get_osd_host func − OSD ID to check : ${_osd_id}."
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : get_osd_host func − OSD ID to check : ${_osd_id}."
|
||||
|
||||
osd_id_host=$(sudo ceph osd find "${_osd_id}" | awk -F\" '$2 ~ /host/ {print $4}')
|
||||
}
|
||||
|
@ -33,17 +39,17 @@ osd_id="${osd_id_start}"
|
|||
|
||||
while [ "${osd_id}" -lt "${osd_id_end}" ]; do
|
||||
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Check if OSD ${osd_id} exists."
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : Check if OSD ${osd_id} exists."
|
||||
|
||||
if check_osd "${osd_id}"
|
||||
then
|
||||
get_osd_host "${osd_id}"
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : OSD ${osd_id} exists on ${osd_id_host}."
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : OSD ${osd_id} exists on ${c_redb}${osd_id_host}."
|
||||
else
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : ! OSD ${osd_id} does exists !"
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : ! OSD ${osd_id} does exists !"
|
||||
fi
|
||||
|
||||
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "-----------------------------------------------"
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "-----------------------------------------------"
|
||||
|
||||
## Increment OSD ID
|
||||
osd_id=$((osd_id+1))
|
||||
|
|
Loading…
Reference in New Issue