hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.12k stars 3.33k forks source link

Windows shell provisioner not invoked #6298

Open dparasam opened 6 years ago

dparasam commented 6 years ago

I am noticing that the windows-shell provisioner is not being invoked when I am using the vmware-iso builder (along with VMWare Fusion locally on Mac OS). The guest OS I am trying to provision runs Windows Server 2016. Oddly the provisioner works fine when I use "amazon-ebs" builder.

Also note that I am using OpenSSH from https://github.com/PowerShell/Win32-OpenSSH/ and using the ssh communicator.

rickard-von-essen commented 6 years ago

Please supply the information requested in the issue template:

dparasam commented 6 years ago

Added packer logs and scripts to the gist: https://gist.github.com/dparasam/3f93fd84652f200658104708789ab204

Some more notes: uname -a Darwin user 15.6.0 Darwin Kernel Version 15.6.0: Mon Oct 2 22:20:08 PDT 2017; root:xnu-3248.71.4~1/RELEASE_X86_64 x86_64

If noop.bat is removed from provisioning, then script1 is not invoked on AWS as well. This may be a separate bug and sounds somewhat similar to https://github.com/hashicorp/packer/issues/5064

Once the machine is built, there is no hello.txt on VMWare image built with vmware-iso builder. When I look at C:\Windows\Temp\script1.bat, it only contains "47" bytes of spaces (the same number of bytes that packer log claims to have written in "uploadData") which could explain why script1.bat didn't write the expected hello.txt. So this might very well be an issue with file transfer.

I however see hello.txt on AWS if I use the amazon-ebs builder, so script1.bat is being executed there.

arizvisa commented 6 years ago

I'm kind of guessing here because I don't have a darwin environment, but check to see if ssh_file_transfer_method for the ssh communicator being set to scp makes a difference. (https://www.packer.io/docs/templates/communicator.html#ssh-communicator)