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

Add default pathing fixes for windows provisioner and verifier #1131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

seryl
Copy link

@seryl seryl commented Sep 26, 2016

This patch should resolve behavior differences with both provisioners and verifiers for windows machines.

This is likely to resolve the following issue:

And, although not the primary issue, another example of the incorrect pathing is shown here:

> kitchen diagnose  -l debug 2012
D      [Vagrant command] BEGIN (vagrant --version)
D      [Vagrant command] END (0m0.31s)
D      Berksfile found at /Users/josh/src/wf/cookbooks/wf_ohai/Berksfile, loading Berkshelf
D      Berkshelf 5.1.0 library loaded
D      Berksfile found at /Users/josh/src/wf/cookbooks/wf_ohai/Berksfile, loading Berkshelf
D      Berkshelf 5.1.0 previously loaded
D      [Vagrant command] BEGIN (vagrant plugin list)
D      [Vagrant command] END (0m0.94s)
D      Berksfile found at /Users/josh/src/wf/cookbooks/wf_ohai/Berksfile, loading Berkshelf
D      Berkshelf 5.1.0 previously loaded
D      winrm requested, loading winrm gem (["~> 2.0"])
D      winrm is loaded.
D      winrm-fs requested, loading winrm-fs gem (["~> 1.0"])
D      winrm-fs is loaded.

Yaml output below, with pathing issues commented.

Keys:

  • provisioner.chef_client_path
  • provisioner.ruby_bindir
---
timestamp: 2016-09-26 20:37:54 UTC
kitchen_version: 1.13.0
instances:
  default-windows2012:
    platform:
      os_type: windows
      shell_type: powershell
    state_file:
      hostname: 127.0.0.1
      last_action: converge
      password: vagrant
      port: '55985'
      rdp_port: '3389'
      username: vagrant
    driver:
      boot_timeout:
      box: windows2012
      box_check_update:
      box_download_insecure:
      box_url: https://REDACTED/windows_2012_r2.box
      box_version:
      customize: {}
      gui:
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      linked_clone:
      log_level: :debug
      name: vagrant
      network: []
      pre_create_command:
      provider: virtualbox
      provision: false
      ssh: {}
      synced_folders: []
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      vagrant_binary: vagrant
      vagrantfile_erb: "/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/kitchen-vagrant-0.20.0/templates/Vagrantfile.erb"
      vagrantfiles: []
      vm_hostname:
    provisioner:
      always_update_cookbooks: false
      attributes: {}
      chef_client_path: "\\bin\\chef-client.bat"    # <----- Here
      chef_omnibus_install_options:
      chef_omnibus_url: https://omnitruck.chef.io/install.sh
      chef_zero_host:
      chef_zero_port: 8889
      client_rb: {}
      clients_path:
      command_prefix:
      config_path:
      cookbook_files_glob: README.*,metadata.{json,rb},attributes/**/*,definitions/**/*,files/**/*,libraries/**/*,providers/**/*,recipes/**/*,resources/**/*,templates/**/*
      data_bags_path:
      data_path:
      encrypted_data_bag_secret_key_path:
      environments_path:
      ftp_proxy:
      http_proxy:
      https_proxy:
      json_attributes: true
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      log_file:
      log_level: auto
      max_retries: 1
      name: chef_zero
      named_run_list: {}
      nodes_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration/nodes"
      policyfile:
      policyfile_path:
      profile_ruby: false
      require_chef_omnibus: false
      retry_on_exit_code: []
      roles_path:
      root_path: "$env:TEMP\\kitchen"
      ruby_bindir: "\\embedded\\bin"    # <----- Here
      run_list:
      - recipe[wf_ohai]
      - recipe[export-node]
      sudo:
      sudo_command:
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      wait_for_retry: 30
    transport:
      connection_retries: 5
      connection_retry_sleep: 1
      elevated: false
      endpoint_template: http://%{hostname}:%{port}/wsman
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      log_level: :debug
      max_wait_until_ready: 600
      name: winrm
      password:
      port: 5985
      rdp_port: 3389
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      username: administrator
      winrm_transport: :negotiate
    verifier:
      busser_bin: "$env:TEMP\\verifier\\bin\\busser.bat"
      chef_omnibus_root: "/opt/chef"
      command_prefix:
      ftp_proxy:
      http_proxy:
      https_proxy:
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      log_level: :debug
      name: busser
      root_path: "$env:TEMP\\verifier"
      ruby_bindir: "$env:systemdrive\\opscode\\chef\\embedded\\bin"
      sudo:
      sudo_command:
      suite_name: default
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      version: busser

Finally; here is the diagnose run with the patch:

> kitchen diagnose 2012

---
timestamp: 2016-09-26 23:08:30 UTC
kitchen_version: 1.13.0
instances:
  default-windows2012:
    platform:
      os_type: windows
      shell_type: powershell
    state_file:
      hostname: 127.0.0.1
      last_action: converge
      password: vagrant
      port: '55985'
      rdp_port: '3389'
      username: vagrant
    driver:
      boot_timeout:
      box: windows2012
      box_check_update:
      box_download_insecure:
      box_url: https://REDACTED/windows_2012_r2.box
      box_version:
      customize: {}
      gui:
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      linked_clone:
      log_level: :info
      name: vagrant
      network: []
      pre_create_command:
      provider: virtualbox
      provision: false
      ssh: {}
      synced_folders: []
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      vagrant_binary: vagrant
      vagrantfile_erb: "/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/kitchen-vagrant-0.20.0/templates/Vagrantfile.erb"
      vagrantfiles: []
      vm_hostname:
    provisioner:
      always_update_cookbooks: false
      attributes: {}
      chef_client_path: "$env:systemdrive\\opscode\\chef\\bin\\chef-client.bat"     # <--- pathing fixed
      chef_omnibus_install_options:
      chef_omnibus_root: "$env:systemdrive\\opscode\\chef"     # <--- set for child dependencies
      chef_omnibus_url: https://omnitruck.chef.io/install.sh
      chef_zero_host:
      chef_zero_port: 8889
      client_rb: {}
      clients_path:
      command_prefix:
      config_path:
      cookbook_files_glob: README.*,metadata.{json,rb},attributes/**/*,definitions/**/*,files/**/*,libraries/**/*,providers/**/*,recipes/**/*,resources/**/*,templates/**/*
      data_bags_path:
      data_path:
      encrypted_data_bag_secret_key_path:
      environments_path:
      ftp_proxy:
      http_proxy:
      https_proxy:
      json_attributes: true
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      log_file:
      log_level: auto
      max_retries: 1
      name: chef_zero
      named_run_list: {}
      nodes_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration/nodes"
      policyfile:
      policyfile_path:
      profile_ruby: false
      require_chef_omnibus: false
      retry_on_exit_code: []
      roles_path:
      root_path: "$env:TEMP\\kitchen"
      ruby_bindir: "$env:systemdrive\\opscode\\chef\\embedded\\bin"    # <--- pathing fixed
      run_list:
      - recipe[wf_ohai]
      - recipe[export-node]
      sudo:
      sudo_command:
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      wait_for_retry: 30
    transport:
      connection_retries: 5
      connection_retry_sleep: 1
      elevated: false
      endpoint_template: http://%{hostname}:%{port}/wsman
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      log_level: :info
      max_wait_until_ready: 600
      name: winrm
      password:
      port: 5985
      rdp_port: 3389
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      username: administrator
      winrm_transport: :negotiate
    verifier:
      busser_bin: "$env:TEMP\\verifier\\bin\\busser.bat"    # <--- still correct
      chef_omnibus_root: "$env:systemdrive\\opscode\\chef"    # <--- set for the children deps to reference
      command_prefix:
      ftp_proxy:
      http_proxy:
      https_proxy:
      kitchen_root: "/Users/josh/src/wf/cookbooks/wf_ohai"
      log_level: :info
      name: busser
      root_path: "$env:TEMP\\verifier"
      ruby_bindir: "$env:systemdrive\\opscode\\chef\\embedded\\bin" # <--- still correct
      sudo:
      sudo_command:
      suite_name: default
      test_base_path: "/Users/josh/src/wf/cookbooks/wf_ohai/test/integration"
      version: busser

@seryl
Copy link
Author

seryl commented Sep 27, 2016

I removed the install_opts[:root] option as it was only used in a single test, and just duplicated the omnibus_install_root pathing.

Let me know if there's something else you'd prefer instead of this behavior.

@seryl seryl force-pushed the fix-pathing-for-windows-runs branch from d27d658 to 6fd8e8c Compare September 27, 2016 16:47
@seryl
Copy link
Author

seryl commented Sep 27, 2016

I rebased to fix an incorrect naming pattern in the verifier/base.rb to match verifier instead of provisioner.

@mwrock
Copy link
Member

mwrock commented Sep 28, 2016

👍

These defaults are "tucked away" in mixlib-default but its currently pretty hacky and unclear how the omnibus_root gets assembled. This makes than cleaner.

@cheeseplus
Copy link

If we could get this rebased I'd love to get this merged!

@cheeseplus cheeseplus added this to the Upcoming milestone Jan 4, 2017
@cheeseplus cheeseplus removed this from the Upcoming milestone Aug 16, 2017
@aribyfashion
Copy link

Good worke now

@lamont-granquist
Copy link
Contributor

looks fine but needs rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants