Hi,
I'm reporting a bug (or at least it doesn't make any sense to me). I'm attaching my rspec (in a simplified version).
When I tried to create sliver, with following service on a node,
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup 10.10.13.1 10.10.12.2; sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="bash"/>
</services>
I got following error message:
Failed CreateSliver for slice urn:publicid:IDN+ch.geni.net:GPOInterns2014+slice+ddos at nysernet-ig. Error from Aggregate: code 1. protogeni AM code: 1: Invalid startup command
Changing "bash" to "sh" doesn't fix the problem. (I will talk about this later)
If I remove the arguments for the first command, that resolves the error and resources get reserved correctly:
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup; sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="bash"/>
</services>
However, this is not an acceptable solution as I do need to pass arguments to my script.
You may ask: why do you put all commands in one execute tag? That's because of another bug(?) I had.
So if I have multiple execute tags,
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup" shell="bash"/>
<execute command="sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1" shell="bash"/>
<execute command="sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1" shell="bash"/>
<execute command="sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="bash"/>
</services>
I got following error message:
This was fixed by combining all commands in one execute tag like I showed previously, though I don't know why......
However, when Sarah told me to change "bash" to "sh", the error was resolved:
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup" shell="sh"/>
<execute command="sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="sh"/>
</services>
This kind of make sense to the error message "Invalid shell in execute". But it doesn't explain why putting all commands in one execute tag and using shell="bash" can also work.
Equally surprisingly (to me), now I can pass arguments:
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup 10.10.13.1 10.10.12.2" shell="sh"/>
<execute command="sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="sh"/>
</services>
Then I don't understand why I can pass arguments in separate executes but cannot in one execute tag. And what is more confusing is: I have arguments in other commands ( sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1 ) and that works all the time.
So I really appreciate if anyone can explain the reason of the error and tell what is the correct way to write my rspec.
Thank you for your time
Zhe (Joe) Wang