Debian Codegraph @

bin/ct-osd-config

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 source /usr/share/ceph-tools/_ct-commonscip-shell source . . `/usr/share/ceph-tools/_ct-common`.
3
4 help_msgscip-shell shell ceph-tools 0.0.40 help_msg(). () {
5 printfscip-shell system . . printf. """
6 usage: $0 [-h] KEY
7
8 Description
9 -h, --help show this help message and exit
10 -g, --get get the configuration
11 -s, --set set the configuration
12 KEY config key to show
13 [VALUE] value for the key (optionnal)
14
15 Example
16 $0 -g osd_recovery_sleep
17 $0 -s osd_recovery_sleep 0.1
18 """
19 }
20
21 get_configscip-shell shell ceph-tools 0.0.40 get_config().() {
22 osd_list=$(ceph osd df -f json | jqscip-shell system . . jq. '.nodes[]["id"]' |sortscip-shell system . . sort. -n -u)
23 search=$'\'.[]|select(.name|test(\"'${1}$'\")).value\''
24 for id in ${osd_list}
25 do
26 echoscip-shell system . . echo. -n "osd.${id} : "
27 eval "ceph config show osd.${id} -f json | jq -e ${search}|| echo -n -e '\r'"
28 done
29 }
30 set_configscip-shell shell ceph-tools 0.0.40 set_config().(){
31 ceph tell "osd.*" injectargs "--${1}=${2}"
32 }
33
34 ct_help_min $# 1
35
36 while [scip-shell system . . `[`. $# -gt 0 ] ; do
37 arg="$1"
38 case $arg in
39 -h|--help)
40 help_msgscip-shell shell ceph-tools 0.0.40 help_msg().
41 ct_on_exit 0
42 ;;
43 -g|--get)
44 key="^${2}$"$
45 get_configscip-shell shell ceph-tools 0.0.40 get_config(). $key
46 ct_on_exit 0
47 ;;
48 -s|--set)
49 key="${2}"
50 value=$3
51 set_configscip-shell shell ceph-tools 0.0.40 set_config(). $key $value
52 ct_on_exit 0
53 ;;
54 esac
55 done
56
57 ct_on_exit 0