hashicorp / packer-plugin-googlecompute

Packer plugin for Google Compute Builder
https://www.packer.io/docs/builders/googlecompute
Mozilla Public License 2.0
25 stars 54 forks source link

fix: replace windows-startup-script-cmd with sysprep-specialize-script-cmd #118

Closed vandot closed 1 year ago

vandot commented 2 years ago

If you use windows-restart second boot will fail if windows-startup-script-cmd has action that cannot be executed twice, like New-NetFirewallRule. While sysprep-specialize-script-cmd will be executed only at first boot.

hashicorp-cla commented 2 years ago

CLA assistant check
All committers have signed the CLA.

nywilken commented 1 year ago

@vandot apologies for the delays here. I'm assigning myself to give this PR a review and understand the need for this change. By chance is there accompanying issue related to the problem you mention in the description?

vandot commented 1 year ago

@nywilken there isn't accompanying issue related to the problem, I can create it if needed? Proposed change is just to cover edge case if you reboot Windows machine as well. Using twice New-NetFirewallRule command is not possible and it's much cleaner fix to replace windows-startup-script-cmd with sysprep-specialize-script-cmd rather then write a powershell that first checks if NetFirewallRule exists etc. Here is described how and when are different Windows startup scripts executed. Checking all described cases inside docs I think it makes sense to execute scripts only once and not after each boot, thus replacing windows-startup-script-cmd with sysprep-specialize-script-cmd.

vandot commented 1 year ago

@nywilken any updates?

nywilken commented 1 year ago

Hi @vandot I have not had a chance to review. But the provided details is enough context to get me going. Sorry for not following up sooner.

nywilken commented 1 year ago

Changes merged with my additional on top. Closing PR as it has been merged.