NetDocuments-Archive / ad-join-cookbook

Chef cookbook to join windows computer to AD
Apache License 2.0
14 stars 12 forks source link

Scheduled Task fails because C:\chef\bin does not exist #3

Closed cpressland closed 8 years ago

cpressland commented 8 years ago

When testing with Chef 12.6.0 the scheduled task fails to run because it's set to run in C:\chef\bin, when removing the "Start in (optional)" parameter from the scheduled task and rebooting the server everything runs as expected.

If I look in domain_join.rb I can see this after line 36:

  case node['platform']
  when 'windows'
    # Installs task for chef-client run after reboot, needed for ohai reload
    windows_task 'chef ad-join' do
      user 'SYSTEM'
      cwd 'C:\chef\bin'
      command 'chef-client -L C:\chef\chef-ad-join.log'
      run_level :highest
      frequency :onstart
      only_if { node['kernel']['cs_info']['domain_role'].to_i == 0 || node['kernel']['cs_info']['domain_role'].to_i == 2 }
    end

Removing line 41 (cwd 'C:\chef\bin') should solve this, no? On my system the bin folder seems to be in "C:\opscode\chef\bin\"

spuder commented 8 years ago

Thanks for reporting this.

In older versions of the windows cookbook, the cwd was broken

https://github.com/chef-cookbooks/windows/pull/311

Because they fixed that bug, and chef 12.6 moved to c:\opscode it looks like this is causing a problem. Strange that I haven't seen it on my systems.

spuder commented 8 years ago

Fixed in v4.2.0