From 9c11ca4eb41512e650f3fa874a235c295c6e878c Mon Sep 17 00:00:00 2001 From: Laura Flores Date: Thu, 11 Jul 2024 17:20:50 -0500 Subject: [PATCH] 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 --- qa/workunits/cephtool/test.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index ee8b6029a52d..89fdcaf05933 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -888,7 +888,7 @@ function test_tell_output_file() # only one line of json expect_true sed '2q1' < /tmp/foo > /dev/null expect_true jq -e '.version | length > 0' < /tmp/foo - rm -f /tmp/foo + sudo rm -f /tmp/foo J=$(ceph tell --format=json-pretty --daemon-output-file=/tmp/foo "$name" version) expect_true jq -e '.path == "/tmp/foo"' <<<"$J" @@ -896,24 +896,24 @@ function test_tell_output_file() # more than one line of json expect_false sed '2q1' < /tmp/foo > /dev/null expect_true jq -e '.version | length > 0' < /tmp/foo - rm -f /tmp/foo + sudo rm -f /tmp/foo # Test --daemon-output-file=:tmp: J=$(ceph tell --format=json --daemon-output-file=":tmp:" "$name" version) path=$(jq -r .path <<<"$J") expect_true test -e "$path" # only one line of json - expect_true sed '2q1' < "$path" > /dev/null - expect_true jq -e '.version | length > 0' < "$path" - rm -f "$path" + expect_true sudo sh -c "sed '2q1' < \"$path\" > /dev/null" + expect_true sudo sudo sh -c "jq -e '.version | length > 0' < \"$path\"" + sudo rm -f "$path" J=$(ceph tell --format=json-pretty --daemon-output-file=":tmp:" "$name" version) path=$(jq -r .path <<<"$J") expect_true test -e "$path" # only one line of json - expect_false sed '2q1' < "$path" > /dev/null - expect_true jq -e '.version | length > 0' < "$path" - rm -f "$path" + expect_false sudo sh -c "sed '2q1' < \"$path\" > /dev/null" + expect_true sudo sh -c "jq -e '.version | length > 0' < \"$path\"" + sudo rm -f "$path" } function test_mds_tell() -- 2.47.3