New Question
0

Does LocalScriptsPlugin support a reboot based on script exit code?

asked Jun 3 '15

rynnoworld gravatar image

Looking to do a domain join using a PowerShell script. Currently the PowerShell script initiates a Restart-Computer before exiting, and it interrupts the rest of the Cloudbase-Init routine. If Cloudbase-Init can perform the reboot based on the exit code of the script, that would be preferable.

Preview: (hide)

3 answers

Sort by » oldest newest most voted
0

answered Jun 5 '15

updated Jun 5 '15

Currently it supports doing that if and only if you supply the script in the user data (first line starting with #ps1_sysnative or #ps1_x86). It'll be available soon a feature for taking care of return codes in this way even when you're dealing with stand-alone scripts. Also, documentation regarding this will be available, just stay tuned for updates.

Preview: (hide)
link

Comments

Hello again rynnoworld, A patch for solving this out has been merged. Like ader1990 said, your script has to return an exit code as 1000 + <2 bits> where the first one (LSB) is the reboot bit and the second one is for taking care of plugin reexecution. Batch example: http://sprunge.us/HEAB?bat

cmiN gravatar imagecmiN (Jun 29 '15)

Hello again, Search for these return codes and #ps1_... markers through the documentation (http://cloudbase-init.readthedocs.org/en/latest/index.html#) to find more info.

cmiN gravatar imagecmiN (Sep 2 '15)
0

answered Jun 4 '15

ader1990 gravatar image

For a working example, here is a working AD join performed by a PS script, when using HEAT. https://github.com/openstack/heat-templates/blob/master/hot/Windows/ActiveDirectoryController/ActiveDirectoryDomainController.ps1#L13

Preview: (hide)
link
0

answered Jun 4 '15

ader1990 gravatar image

updated Jun 5 '15

Hello there,

We already have this in place here: https://github.com/stackforge/cloudba...

Here are the exit codes:

  • 1001 - reboot and don’t run the plugin again on next boot
  • 1002 - don't reboot now and run the plugin again on next boot
  • 1003 - reboot and run the plugin again on next boot

Please let me know if it works for you.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: Jun 3 '15

Seen: 10,881 times

Last updated: Jun 05 '15