Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kitchen Converge does not return an error when chef-client executable cannot be found on Windows guests #1896

Open
carlosaya opened this issue May 26, 2022 · 0 comments

Comments

@carlosaya
Copy link

carlosaya commented May 26, 2022

👻 Brief Description

When running kitchen converge for a Windows guest, no error is returned if chef-client.bat is not found in the guest. Instead, converge exits successfully without running chef.

This was discovered when using CINC workstation locally against templates that were built with Chef Client instead of CINC Client.

Version

> chef --version
Redirecting to cinc
Cinc Workstation version: 22.4.861
Biome version: unknown
Test Kitchen version: 3.2.2
Cookstyle version: 7.32.1
Cinc Client version: 17.10.0
Cinc Auditor version: 4.56.19
Cinc CLI version: 5.6.1

Environment

Windows 10 with CINC Workstation 22.4.861.

Steps to Reproduce

  1. Install CINC workstation
  2. Create a new Windows cookbook
  3. Using a vagrant template with Chef Client installed, run kitchen converge

Expected Result

Kitchen should throw an error saying that the chef-client.bat could not be found.

Actual Result

Kitchen exits successfully without running Chef at all. Example output below:

> kitchen converge
-----> Starting Test Kitchen (v3.2.2)
-----> Converging <default-windows2016-windowsonly>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 7.2.2...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Installing Chef install only if missing package
       Downloading package from https://packages.chef.io/files/stable/chef/17.10.3/windows/2016/chef-client-17.10.3-1-x64.msi
       Download complete.
       Successfully verified C:\Users\packer\AppData\Local\Temp\chef-client-17.10.3-1-x64.msi
       Installing Chef package C:\Users\packer\AppData\Local\Temp\chef-client-17.10.3-1-x64.msi
       Installation complete
       Transferring files to <default-windows2016-windowsonly>
       Downloading files from <default-windows2016-windowsonly>
       Finished converging <default-windows2016-windowsonly> (2m39.81s).

Conversely, RHEL does throw an error in this same situation:
sudo: /opt/cinc/bin/chef-client: command not found

➕ Additional context

This behavior was reproduced using...

  • Vagrant driver with virtualbox provider
  • vCenter driver

The fact that chef-client could not be found was only discovered by enabling WinRM transcripts in the guest OS. This revealed the following error, which was not surfaced by kitchen:

The term 'C:\cinc-project\cinc\bin\chef-client.bat' is not recognized as the name of a cmdlet, function, script file, or operable program.  Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Workaround

Specify the path to chef-client in .kitchen.yml:

provisioner:
  chef_client_path: C:\opscode\chef\bin\chef-client.bat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant