From: David Galloway Date: Tue, 10 Mar 2020 19:27:23 +0000 (-0400) Subject: multiple: Use --no-run-if-empty flag with `xargs dirname` X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1520%2Fhead;p=ceph-build.git multiple: Use --no-run-if-empty flag with `xargs dirname` I was seeing `dirname: missing operand` when there was no output from the `find | grep` We want the output to just be empty instead of throwing an error Signed-off-by: David Galloway --- diff --git a/ceph-ansible-prs/build/build b/ceph-ansible-prs/build/build index a2745e4b..6086d586 100644 --- a/ceph-ansible-prs/build/build +++ b/ceph-ansible-prs/build/build @@ -18,7 +18,7 @@ update_vagrant_boxes # crashes before teardown is executed, it means we keep leftofver from previous build. # We ensure before the test is launched that no fetch directory from previous build is present. pushd $WORKSPACE/tests -scenarios=$(find . -name Vagrantfile | xargs dirname) +scenarios=$(find . -name Vagrantfile | xargs -r dirname) for scenario in $scenarios; do pushd $scenario rm -rf fetch/ diff --git a/ceph-container-nighlity/build/teardown b/ceph-container-nighlity/build/teardown index 5790664a..7fcc4e7c 100644 --- a/ceph-container-nighlity/build/teardown +++ b/ceph-container-nighlity/build/teardown @@ -4,7 +4,7 @@ cd $WORKSPACE/ceph-ansible/tests/functional -scenarios=$(find . | grep Vagrantfile | xargs dirname) +scenarios=$(find . | grep Vagrantfile | xargs -r dirname) for scenario in $scenarios; do cd $scenario diff --git a/ceph-container-prs/build/teardown b/ceph-container-prs/build/teardown index 5790664a..7fcc4e7c 100644 --- a/ceph-container-prs/build/teardown +++ b/ceph-container-prs/build/teardown @@ -4,7 +4,7 @@ cd $WORKSPACE/ceph-ansible/tests/functional -scenarios=$(find . | grep Vagrantfile | xargs dirname) +scenarios=$(find . | grep Vagrantfile | xargs -r dirname) for scenario in $scenarios; do cd $scenario diff --git a/ceph-volume-nightly/build/teardown b/ceph-volume-nightly/build/teardown index ce026872..d4518338 100644 --- a/ceph-volume-nightly/build/teardown +++ b/ceph-volume-nightly/build/teardown @@ -5,7 +5,7 @@ cd $WORKSPACE/src/ceph-volume/ceph_volume/tests/functional -scenarios=$(find . | grep vagrant_ssh_config | xargs dirname) +scenarios=$(find . | grep vagrant_ssh_config | xargs -r dirname) # the method exists in scripts/build_utils.sh teardown_vagrant_tests diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index e4d80c47..e631757f 100644 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -985,7 +985,7 @@ collect_ceph_logs() { teardown_vagrant_tests() { # collect ceph logs and teardown any running vagrant vms # this also cleans up any lingering livirt networks - scenarios=$(find . | grep vagrant_ssh_config | xargs dirname) + scenarios=$(find . | grep vagrant_ssh_config | xargs -r dirname) for scenario in $scenarios; do cd $scenario