Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Test Kitchen does not apply my Policyfile-style cookbook on Windows Server #632

Closed
tpetchel opened this issue Dec 30, 2015 · 3 comments
Closed
Labels
Platform: Windows Type: Bug Doesn't work as expected.

Comments

@tpetchel
Copy link

I created a Policyfile-style cookbook that targets Windows Server. My .kitchen.yml file looks like this:


---
driver:
  name: vagrant

transport:
  username: Administrator
  password: Pass@word1

provisioner:
  name: policyfile_zero
  client_rb:
    audit_mode: :enabled

verifier:
  name: inspec

platforms:
  - name: windows-2012R2
    driver_config:
      box: mwrock/Windows2012R2

suites:
  - name: default
    attributes:

When I run chef install and then kitchen converge, my cookbook is not run on the Windows Server instance:

$ kitchen converge
-----> Starting Kitchen (v1.4.2)
-----> Using policyfile mode for chef-client
-----> Converging <default-windows-2012R2>...
       Preparing files for transfer
       Preparing dna.json
       Preparing validation.pem
       Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
       Transferring files to <default-windows-2012R2>
       Finished converging <default-windows-2012R2> (0m4.00s).
-----> Kitchen is finished. (0m6.82s)

When I convert my cookbook to a Berkshelf-style one, everything returns to normal:

$ kitchen converge
-----> Starting Kitchen (v1.4.2)
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.6.0.1/lib/httpclient/webagent-cookie.rb:458: warning: already initialized constant HTTPClient::CookieManager
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:8: warning: previous definition of CookieManager was here
-----> Converging <default-windows-2012R2>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 4.0.1...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
       Transferring files to <default-windows-2012R2>
       Starting Chef Client, version 12.6.0
       resolving cookbooks for run list: ["learn-the-basics-windows::default"]
       Synchronizing Cookbooks:
         - learn-the-basics-windows (0.1.0)
         - workflow (0.1.0)
       Compiling Cookbooks...
@emachnic
Copy link

Has anyone taken a look at this? I'm running the latest ChefDK and changing from chef_zero to policyfile_zero has this behavior. The chef_zero converge works fine but policyfile_zero finishes without actually converging and this seems to only happen with Windows guests. This is causing issues for wanting to fully test Policyfiles. Let me know if you need anymore information.

Thanks!
Evan

@danielsdeleo
Copy link
Contributor

I'm hoping test-kitchen/test-kitchen#1014 fixes it. If you have the ruby skills to pull that in with bundler and give it a try, I'd appreciate it, otherwise I'll try to see if that fixes this when I have time.

@danielsdeleo
Copy link
Contributor

I've verified that the above patch works for me. I used the following kitchen config with an example cookbook (just runs the chef-sugar cookbook and then prints stuff to stdout).

---
driver:
  name: vagrant

transport:
  username: Administrator
  password: Pass@word1

provisioner: chef_zero

platforms:
  - name: windows-2012R2
    driver_config:
      box: mwrock/Windows2012R2
      communicator: winrm
      vm_hostname: false

suites:
  - name: default
    attributes:
      rando_attr: hello from rando
    named_run_list: foo

Unfortunately, this will probably not make it into the April ChefDK release, since the package was already built, so you will have to use the appbundle updater method to install it.

@thommay thommay added Type: Bug Doesn't work as expected. and removed Bug labels Feb 1, 2017
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Windows Type: Bug Doesn't work as expected.
Development

No branches or pull requests

5 participants