I am trying to execute a shell command from Jenkins to do a Salt call. I am able to get the command to work without having parameters in.
#!/bin/sh
sudo salt '*' test.ping
but when I execute with a parameter I get an error:
[TestUpgrade] $ /bin/sh /tmp/hudson6841559319172934172.sh ERROR: No return received No minions matched the target. No command was sent, no jid was assigned. Build step 'Execute shell' marked build as failure
The command looks like this:
#!/bin/sh
sudo salt $Minion_Group test.ping
I am trying to insert '*' as the string parameter. When I echo the command, everything looks good.
Any ideas?
I expect this is a quotation issue.
Salt doesn't interpret asterisk as a wildcard, instead, it tries to find '*'
minion id. And you cannot remove single quotes as it would lead to wildcard expanding before salt
command is run.
Try to set $Minion_Group
to *
and temporary disable glob expanding:
#!/bin/sh
set -f
sudo salt ${Minion_Group} test.ping
set +f