SkynetLabs / ansible-playbooks

SkynetLabs Ansible Playbooks
6 stars 5 forks source link

xargs -r not supported on MacOS #122

Open firyx opened 3 years ago

firyx commented 3 years ago

Describe the bug

On MacOS we get an error (when executing a playbook and ansiblecm container is not running):

scripts/portals-block-skylinks.sh -e @my-vars/skylinks-block.yml --limit eu-pol-5
Stopping Ansible Control Machine...
xargs: illegal option -- r
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
             [-L number] [-n number [-x]] [-P maxprocs] [-s size]
             [utility [argument ...]]
ERROR: Error 1

caused by calling xargs with -r flag:
docker ps -a | grep ansiblecm | awk '{print $1;}' | xargs -r docker stop > /dev/null

To Reproduce

Expected behavior

Screenshots

Version Information (please complete the following information):

Additional context

ro-tex commented 2 years ago

We could play around with adding something like this as a previous step, so we can replicate the behaviour:

if [ $# -eq 0 ]; then
    exit 1
fi
echo $*

Or maybe we can just drop the -r parameter? Looking at all the uses of -r in ansible-playbooks, removing it will just result in a bunch of errors where we have a no-op today.