New Question
0

Does LocalScriptsPlugin support a reboot based on script exit code?

asked 2015-06-03 21:14:14 +0200

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.

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted
0

answered 2015-06-05 18:04:29 +0200

updated 2015-06-05 18:05:17 +0200

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.

edit flag offensive delete link more

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 ( 2015-06-29 19:41:09 +0200 )edit

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 ( 2015-09-02 07:11:41 +0200 )edit
0

answered 2015-06-04 18:40:41 +0200

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

edit flag offensive delete link more
0

answered 2015-06-04 18:36:54 +0200

ader1990 gravatar image

updated 2015-06-05 13:56:19 +0200

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.

edit flag offensive delete link more

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: 2015-06-03 21:14:14 +0200

Seen: 10,765 times

Last updated: Jun 05 '15