hashicorp / packer-plugin-chef

This Packer provisioner is no longer being maintained and has been archived. Users are encouraged to use the shell or shell-local provisioner to run the provisioning tools made available by this plugin. If interested in maintaining this plugin please reach out to us at packer@hashicorp.com.
https://www.packer.io/docs/provisioners/chef-solo
Mozilla Public License 2.0
0 stars 6 forks source link

chef-client provisioner failing on Windows Server 2012 R2: Failed to read the private key #12

Open ghost opened 3 years ago

ghost commented 3 years ago

This issue was originally opened by @kbrowns as hashicorp/packer#6366. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


I'm seeing issues with the chef-provisioner starting in build 1.2.0. I"m pretty confident the issue is a bug because downgrading packer to 1.1.3 reliably fixes the issue, but if I upgrade to any version above that (1.2.0+) I reliably see failures with the chef-client being unable to find private key. Full log is listed below, but the consistent failure I see is:

        csg-simple-packer-build: 'skipping chmod 0777 C:/Windows/Temp/packer-chef-client'

        csg-simple-packer-build: Uploading ****...

        csg-simple-packer-build: Creating configuration file 'client.rb'

        csg-simple-packer-build: Creating JSON attribute file

        csg-simple-packer-build: Executing Chef: c:/opscode/chef/bin/chef-client.bat --no-color -c C:/Windows/Temp/packer-chef-client/client.rb -j C:/Windows/Temp/packer-chef-client/first-boot.json

        csg-simple-packer-build: Creating configuration file 'knife.rb'

    ==> csg-simple-packer-build: Cleaning up chef node...

        csg-simple-packer-build: WARN: Failed to read the private key C:/Windows/Temp/packer-chef-client/client.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - C:/Windows/Temp/packer-chef-client/client.pem>

        csg-simple-packer-build: ERROR: Your private key could not be loaded from C:/Windows/Temp/packer-chef-client/client.pem

        csg-simple-packer-build: Check your configuration file and ensure that your private key is readable

    ==> csg-simple-packer-build: Terminating the source AWS instance...

==> csg-simple-packer-build: Cleaning up any extra volumes...

    ==> csg-simple-packer-build: No volumes to clean up, skipping

    Build 'csg-simple-packer-build' errored: Error cleaning up chef node: Failed to cleanup node: Non-zero exit status. See output above for more info.

Given that it's complaining there is no client.pem, this seems to suggest that the bootstrap process is somehow short circuited - i.e. the validation key is not uploaded an used maybe?

nywilken commented 2 years ago

With the archival of this repository all open issues will be marked as read-only. If you wish to further discuss this plugin or any of its open issues we invite you to open a discussion on the Packer community forum.

More details on the plugin archiving process for this provisioner can be found on the Plans to Archive Unmaintained Packer Provisioner Plugins blog post.