ReleaseEngineering/How To/Reboot Multiple Slaves Using Slaveapi

From MozillaWiki
Jump to: navigation, search

You might find it easiest to do this by creating a text file containing the list of the slaves you want to reboot (let's call it naughty_slaves.list), set MY_LDAP_USER and MY_LDAP_PASSWORD environment variables to your LDAP credentials, making sure you are on the VPN; and then run:

cat naughty_slaves.list | \
  while read slave; do \
    curl -u "${MY_LDAP_USER}:${MY_LDAP_PASSWORD}" \
         -dfoo=bar "https://secure.pub.build.mozilla.org/slaveapi/slaves/${slave}/actions/reboot"; \
  done

This should reboot the lot in one fell swoop.

Please note, if you need to call other Slave API actions, such as "shutdown" instead of reboot, see the API docs here: http://mozilla-slaveapi.readthedocs.org/en/latest/api/#endpoints