I wanted to get the list of mounted partition by getting the sixth field of df using awk:
$ df|awk '{ print $6}' Mounted /dev /run / /dev/shm /run/lock /sys/fs/cgroup
With cumin the whole line is printed:
sudo cumin --trace --force 'name:1053 'df| awk "{ print $6}"' ----- OUTPUT of 'df| awk "{ print $6}"' ----- Filesystem 1K-blocks Used Available Use% Mounted on udev 10240 0 10240 0% /dev tmpfs 810132 82332 727800 11% /run /dev/vda3 19479208 3585896 14880784 20% / tmpfs 2025328 0 2025328 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 2025328 0 2025328 0% /sys/fs/cgroup /dev/mapper/vd-second--local--disk 21023324 834336 19098020 5% /srv ================
And in the cumin log:
INFO cumin.cli.main] Cumin called by user 'hashar' with args: Namespace(backend=None, batch_size={'value': None, 'ratio': None}, batch_sleep=None, commands=['df| awk "{ print $6}"'], config='/etc/cumin/config.yaml', debug=False, dry_run=False, force=True, global_timeout=None, hosts='name:docker-1053', ignore_exit_codes=False, interactive=False, mode='sync', output=None, success_percentage=100, timeout=None, trace=True, transport=None ) INFO cumin.transports.clustershell.ClusterShellWorker.execute] Executing commands [cumin.transports.Command('df| awk "{ print $6}"')] on '1' hosts: integration-slave-docker-1053.integration.eqiad.wmflabs
I am not sure what happens to $6, but it seems to be expanded by the shell. I guess because it executes literally: df | awk "{ print $6}", the variable being in double quote, it gets expanded to an empty string.
If switch double and single quotes with: sudo cumin --trace --force 'name:docker-1053' "df| awk '{ print $6}'", the variable is not passed at all. From the output:
100.0% (1/1) success ratio (>= 100.0% threshold) for command: 'df| awk '{ print }''.
In cumin.log:
commands=["df| awk '{ print }'"]
The not so straightforward way is to backslash the variable: 'df| awk "{ print \$6}"'.
That is with cumin 3.0.2-2