packer-community / packer-windows-plugins

A suite of Packer plugins for provisioning Windows machines
113 stars 20 forks source link

Error 259 during WinRM Provisioning #33

Closed mefellows closed 9 years ago

mefellows commented 9 years ago

I've had a number of these occur over the past couple of days when using the Elevated Powershell runner:

==> buildagent: Inspecting the source AMI...
==> buildagent: Creating temporary security group for this instance...
==> buildagent: Authorizing WinRM access on the temporary security group...
==> buildagent: Launching a source AWS instance...
    buildagent: Instance ID: i-9209d54e
==> buildagent: Waiting for instance (i-9209d54e) to become ready...
==> buildagent: Waiting for WinRM to become available...
==> buildagent: Connected to WinRM!
==> buildagent: Provisioning with Powershell...
==> buildagent: Provisioning with shell script: /var/folders/kf/4sgp93ys2t3_9t3yyzr07c3r0000gn/T/packer-powershell-provisioner400494783
==> buildagent: Provisioning with Powershell...
==> buildagent: Provisioning with shell script: ./scripts/provision-agent.ps1
    buildagent: !!ATTENTION!!
    buildagent: The next version of Chocolatey (v0.9.9) will require -y to perform
    buildagent: behaviors that change state without prompting for confirmation. Start
    buildagent: using it now in your automated scripts.
    buildagent:
    buildagent: For details on the all new Chocolatey, visit http://bit.ly/new_choco
==> buildagent: Terminating the source AWS instance...
==> buildagent: Deleting temporary security group...
Build 'buildagent' errored: Script exited with non-zero exit status: 259

As it turns out, this issue has also been experienced in Vagrant and has recently been [fixed](https://github.com/mitchellh/vagrant/pull/5469].

This potentially raises another issue with some powershell scripts which may return error codes that aren't really error codes (Chocolatey explicitly deals with this situation by asking for an array of valid exit codes - for example 0,3010 for installing VS). For now, this should be the responsibility of the powershell script and perhaps we ought to update the docu to spell out the obvious - non-0 exit codes result in build failures.

Anyway, I'll implement the same change locally and if these issues disappear i'll push later on today.

mefellows commented 9 years ago

Haven't experienced this issue since c3fcd2b and fixes for #37 and #36