]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/mon/caps.sh
update sources to v12.1.2
[ceph.git] / ceph / qa / workunits / mon / caps.sh
CommitLineData
7c673cae
FG
1#!/bin/bash
2
3tmp=/tmp/cephtest-mon-caps-madness
4
5exit_on_error=1
6
7[[ ! -z $TEST_EXIT_ON_ERROR ]] && exit_on_error=$TEST_EXIT_ON_ERROR
8
9expect()
10{
11 cmd=$1
12 expected_ret=$2
13
14 echo $cmd
15 eval $cmd >&/dev/null
16 ret=$?
17
18 if [[ $ret -ne $expected_ret ]]; then
19 echo "Error: Expected return $expected_ret, got $ret"
20 [[ $exit_on_error -eq 1 ]] && exit 1
21 return 1
22 fi
23
24 return 0
25}
26
27expect "ceph auth get-or-create client.bazar > $tmp.bazar.keyring" 0
28expect "ceph -k $tmp.bazar.keyring --user bazar mon_status" 13
29ceph auth del client.bazar
30
c07f9fc5 31c="'allow command \"auth ls\", allow command mon_status'"
7c673cae
FG
32expect "ceph auth get-or-create client.foo mon $c > $tmp.foo.keyring" 0
33expect "ceph -k $tmp.foo.keyring --user foo mon_status" 0
c07f9fc5 34expect "ceph -k $tmp.foo.keyring --user foo auth ls" 0
7c673cae
FG
35expect "ceph -k $tmp.foo.keyring --user foo auth export" 13
36expect "ceph -k $tmp.foo.keyring --user foo auth del client.bazar" 13
37expect "ceph -k $tmp.foo.keyring --user foo osd dump" 13
38expect "ceph -k $tmp.foo.keyring --user foo pg dump" 13
39expect "ceph -k $tmp.foo.keyring --user foo quorum_status" 13
40ceph auth del client.foo
41
42c="'allow command service with prefix=list, allow command mon_status'"
43expect "ceph auth get-or-create client.bar mon $c > $tmp.bar.keyring" 0
44expect "ceph -k $tmp.bar.keyring --user bar mon_status" 0
c07f9fc5 45expect "ceph -k $tmp.bar.keyring --user bar auth ls" 13
7c673cae
FG
46expect "ceph -k $tmp.bar.keyring --user bar auth export" 13
47expect "ceph -k $tmp.bar.keyring --user bar auth del client.foo" 13
48expect "ceph -k $tmp.bar.keyring --user bar osd dump" 13
49expect "ceph -k $tmp.bar.keyring --user bar pg dump" 13
50expect "ceph -k $tmp.bar.keyring --user bar quorum_status" 13
51ceph auth del client.bar
52
53rm $tmp.bazar.keyring $tmp.foo.keyring $tmp.bar.keyring
54
c07f9fc5 55echo OK