Skip to content

Commit 9c11ca4

Browse files
author
Laura Flores
committed
qa/workunits/cephtool: add extra privileges to cephtool script
This is more of a workaround to an issue in the infrastructure where files are made with root privileges, causing permission issues when operations are used on them without sudo. Fixes: https://tracker.ceph.com/issues/66881 Signed-off-by: Laura Flores <[email protected]>
1 parent d526572 commit 9c11ca4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

qa/workunits/cephtool/test.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -888,32 +888,32 @@ function test_tell_output_file()
888888
# only one line of json
889889
expect_true sed '2q1' < /tmp/foo > /dev/null
890890
expect_true jq -e '.version | length > 0' < /tmp/foo
891-
rm -f /tmp/foo
891+
sudo rm -f /tmp/foo
892892

893893
J=$(ceph tell --format=json-pretty --daemon-output-file=/tmp/foo "$name" version)
894894
expect_true jq -e '.path == "/tmp/foo"' <<<"$J"
895895
expect_true test -e /tmp/foo
896896
# more than one line of json
897897
expect_false sed '2q1' < /tmp/foo > /dev/null
898898
expect_true jq -e '.version | length > 0' < /tmp/foo
899-
rm -f /tmp/foo
899+
sudo rm -f /tmp/foo
900900

901901
# Test --daemon-output-file=:tmp:
902902
J=$(ceph tell --format=json --daemon-output-file=":tmp:" "$name" version)
903903
path=$(jq -r .path <<<"$J")
904904
expect_true test -e "$path"
905905
# only one line of json
906-
expect_true sed '2q1' < "$path" > /dev/null
907-
expect_true jq -e '.version | length > 0' < "$path"
908-
rm -f "$path"
906+
expect_true sudo sh -c "sed '2q1' < \"$path\" > /dev/null"
907+
expect_true sudo sudo sh -c "jq -e '.version | length > 0' < \"$path\""
908+
sudo rm -f "$path"
909909

910910
J=$(ceph tell --format=json-pretty --daemon-output-file=":tmp:" "$name" version)
911911
path=$(jq -r .path <<<"$J")
912912
expect_true test -e "$path"
913913
# only one line of json
914-
expect_false sed '2q1' < "$path" > /dev/null
915-
expect_true jq -e '.version | length > 0' < "$path"
916-
rm -f "$path"
914+
expect_false sudo sh -c "sed '2q1' < \"$path\" > /dev/null"
915+
expect_true sudo sh -c "jq -e '.version | length > 0' < \"$path\""
916+
sudo rm -f "$path"
917917
}
918918

919919
function test_mds_tell()

0 commit comments

Comments
 (0)