GoSecure/malboxes

Chocolatey exit on 3010, Packer failed.

hypnot0ad opened this issue · 3 comments

Running through a build where I have an app Im testing with that requires a reboot after install.

This is possibly an upstream question, but is there support for rebooting a client if an install code of 3010 is returned?
Currently any error code that is not 0 will fail the build.

==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 3010

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Script exited with non-zero exit status: 3010

==> Builds finished but no artifacts were created.
----------------------------------
packer completed with return code: 1
Packer failed. Build failed. Exiting...

You should probably install the app post build in a Vagrant provisioning step instead.

For Windows guest machines that are configured to use WinRM, the shell provisioner executes PowerShell and Batch scripts over WinRM.

But if your use case requires it to happen in malboxes packer build step then here is a related example:

	{
		"type": "powershell",
		"scripts": [
			"installscript.ps1"
		],
		"valid_exit_codes": [ 0, 3010 ]
	},
	{
		"type": "windows-restart"
	}

The above will accept the return value of 0 or 3010 for the given powershell script (best to use inline if your script is simple otherwise you need to do a file copy). After the powershell script's execution, a restart will be issued and then the next provisioners in the sequence will be run.

See packer provisioners' doc. The problem is you'll need to patch malboxes' code since we have no way of inlining your own custom packer config into the config we generate right now.

hmm so if I'm using a chocolately package in the windows-shell provisioner then I will need to fix the exit code there as "valid_exit_codes" is not a valid variable for windows-shell.

Perhaps this is a good excuse for me to learn PowerSheel properly and write a script to do all the chocolately installs rather than rely on the windows-shell provisioner.

I'll also give the Vagrant Provisioner a go as well.

Thanks! btw, sorry for the late reply

No confirmed solution to this issue was ever provided, please remove or reopen, thanks!