Chef windows installer with windows cookbook


#1

Hi,
First time install Chef Windows ( with the installer - http://www.opscode.com/chef/install.msi ). I created a recipes with " Chef::Log.info(“Hello World”) " and the windows node display this fine. Then I download the windows cookbook ( http://github.com/opscode-cookbooks/windows ) and test this

windows_batch “echo some env vars” do
code <<-EOH
echo %TEMP%
echo %SYSTEMDRIVE%
echo %PATH%
echo %WINDIR%
EOH
end

The windows node failed to run with this error:

[2012-08-20T11:26:28-07:00] INFO: Processing windows_batch[echo some env vars] action run (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb)
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) has had an error
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (c:/chef/cache/cookbooks/windows_base/recipes/default.rb:27:in from_file') had an error: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::Package::Macports C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:45:inplatforms’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:301:in find' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:431:infind_provider’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:364:in find_provider_for_node' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:354:inprovider_for_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource.rb:451:in run_action' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:49:inrun_action’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block (2 levels) in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:ineach’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:94:inblock in execute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:in call' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:85:in step' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:104:initerate’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:92:inexecute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:80:in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:330:inconverge’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:163:in run' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:96:inservice_main’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in mainloop' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:inmainloop’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in `’
[2012-08-20T11:26:28-07:00] ERROR: Running exception handlers
[2012-08-20T11:26:28-07:00] FATAL: Saving node information to c:/chef/cache/failed-run-data.json
[2012-08-20T11:26:28-07:00] ERROR: Exception handlers complete
[2012-08-20T11:26:28-07:00] ERROR: NameError: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::package::Macports

why does it use MacPorts on Windows? or did the Chef windows installer missing something?

thanks


#2

Is the windows_batch resource you’ve showed to us the full contents of the
default.rb file inside of the windows_base cookbook? If it isn’t, please
paste the full recipe.

Secondly, can you re-run the chef client with more verbose logging? The
following will help: ‘chef-client -ldebug’

One other thing. Did you install the chef-client as a windows service?

Thanks,

-Tim

On Mon, Aug 20, 2012 at 2:30 PM, Barrow Kwan bhkwan@thoughtworks.comwrote:

Hi,
First time install Chef Windows ( with the installer -
http://www.opscode.com/chef/install.msi ). I created a recipes with "
Chef::Log.info(“Hello World”) " and the windows node display this fine.
Then I download the windows cookbook (
http://github.com/opscode-cookbooks/windows ) and test this

windows_batch “echo some env vars” do
code <<-EOH
echo %TEMP%
echo %SYSTEMDRIVE%
echo %PATH%
echo %WINDIR%
EOH
end

The windows node failed to run with this error:

[2012-08-20T11:26:28-07:00] INFO: Processing windows_batch[echo some env
vars] action run (windows_base::default line
/chef/cache/cookbooks/windows_base/recipes/default.rb)
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars]
(windows_base::default line
/chef/cache/cookbooks/windows_base/recipes/default.rb) has had an error
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars]
(c:/chef/cache/cookbooks/windows_base/recipes/default.rb:27:in from_file') had an error: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::Package::Macports C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:45:inplatforms’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:301:in
find' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:431:infind_provider’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:364:in
find_provider_for_node' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:354:inprovider_for_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource.rb:451:in
run_action' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:49:inrun_action’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in
block (2 levels) in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:ineach’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in
block in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:94:inblock in execute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:in
call' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:85:in
step' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:104:initerate’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:55:in
each_with_index' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:92:inexecute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:80:in
converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:330:inconverge’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:163:in
run' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:96:inservice_main’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in
mainloop' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:inmainloop’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in
`’
[2012-08-20T11:26:28-07:00] ERROR: Running exception handlers
[2012-08-20T11:26:28-07:00] FATAL: Saving node information to
c:/chef/cache/failed-run-data.json
[2012-08-20T11:26:28-07:00] ERROR: Exception handlers complete
[2012-08-20T11:26:28-07:00] ERROR: NameError: windows_batch[echo some env
vars] (windows_base::default line
/chef/cache/cookbooks/windows_base/recipes/default.rb) had an error:
NameError: uninitialized constant Chef::Provider::package::Macports

why does it use MacPorts on Windows? or did the Chef windows installer
missing something?

thanks


#3

Hi Tim,
Thanks for the quick respond.

  1. it is the full content of default.rb
  2. I am running chef-client as windows service.
  3. I didn’t add “-ldebug” but just run chef-client from command line and it is working fine.

looks like the problem with chef-client running as windows services…

Here is what the windows services command like
"C:\Tools\opscode\chef\embedded\bin\ruby" “C:\Tools\opscode\chef\embedded\lib\ruby\gems\1.9.1\gems\chef-10.12.0\lib\chef\application\windows_service.rb” -c C:\chef\client.rb -L -C:\chef\client.log

I guess something is missing from PATH when run it as windows_service

thanks

Barrow

On Aug 20, 2012, at 11:36 AM, Tim Green wrote:

Is the windows_batch resource you’ve showed to us the full contents of the default.rb file inside of the windows_base cookbook? If it isn’t, please paste the full recipe.

Secondly, can you re-run the chef client with more verbose logging? The following will help: ‘chef-client -ldebug’

One other thing. Did you install the chef-client as a windows service?

Thanks,

-Tim

On Mon, Aug 20, 2012 at 2:30 PM, Barrow Kwan bhkwan@thoughtworks.com wrote:
Hi,
First time install Chef Windows ( with the installer - http://www.opscode.com/chef/install.msi ). I created a recipes with " Chef::Log.info(“Hello World”) " and the windows node display this fine. Then I download the windows cookbook ( http://github.com/opscode-cookbooks/windows ) and test this

windows_batch “echo some env vars” do
code <<-EOH
echo %TEMP%
echo %SYSTEMDRIVE%
echo %PATH%
echo %WINDIR%
EOH
end

The windows node failed to run with this error:

[2012-08-20T11:26:28-07:00] INFO: Processing windows_batch[echo some env vars] action run (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb)
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) has had an error
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (c:/chef/cache/cookbooks/windows_base/recipes/default.rb:27:in from_file') had an error: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::Package::Macports C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:45:inplatforms’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:301:in find' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:431:infind_provider’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:364:in find_provider_for_node' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:354:inprovider_for_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource.rb:451:in run_action' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:49:inrun_action’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block (2 levels) in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:ineach’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:94:inblock in execute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:in call' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:85:in step' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:104:initerate’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:92:inexecute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:80:in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:330:inconverge’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:163:in run' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:96:inservice_main’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in mainloop' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:inmainloop’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in `’
[2012-08-20T11:26:28-07:00] ERROR: Running exception handlers
[2012-08-20T11:26:28-07:00] FATAL: Saving node information to c:/chef/cache/failed-run-data.json
[2012-08-20T11:26:28-07:00] ERROR: Exception handlers complete
[2012-08-20T11:26:28-07:00] ERROR: NameError: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::package::Macports

why does it use MacPorts on Windows? or did the Chef windows installer missing something?

thanks


#4

I believe the issue you’re running into is this:

http://tickets.opscode.com/browse/CHEF-3301

Could you run the chef-client manually and see if you run into the same
problem?

-Tim

On Mon, Aug 20, 2012 at 2:47 PM, Barrow Kwan bhkwan@thoughtworks.comwrote:

Hi Tim,
Thanks for the quick respond.

  1. it is the full content of default.rb
  2. I am running chef-client as windows service.
  3. I didn’t add “-ldebug” but just run chef-client from command line and
    it is working fine.

looks like the problem with chef-client running as windows services…

Here is what the windows services command like
"C:\Tools\opscode\chef\embedded\bin\ruby"
“C:\Tools\opscode\chef\embedded\lib\ruby\gems\1.9.1\gems\chef-10.12.0\lib\chef\application\windows_service.rb”
-c C:\chef\client.rb -L -C:\chef\client.log

I guess something is missing from PATH when run it as windows_service

thanks

Barrow

On Aug 20, 2012, at 11:36 AM, Tim Green wrote:

Is the windows_batch resource you’ve showed to us the full contents of the
default.rb file inside of the windows_base cookbook? If it isn’t, please
paste the full recipe.

Secondly, can you re-run the chef client with more verbose logging? The
following will help: ‘chef-client -ldebug’

One other thing. Did you install the chef-client as a windows service?

Thanks,

-Tim

On Mon, Aug 20, 2012 at 2:30 PM, Barrow Kwan bhkwan@thoughtworks.comwrote:

Hi,
First time install Chef Windows ( with the installer -
http://www.opscode.com/chef/install.msi ). I created a recipes with "
Chef::Log.info(“Hello World”) " and the windows node display this fine.
Then I download the windows cookbook (
http://github.com/opscode-cookbooks/windows ) and test this

windows_batch “echo some env vars” do
code <<-EOH
echo %TEMP%
echo %SYSTEMDRIVE%
echo %PATH%
echo %WINDIR%
EOH
end

The windows node failed to run with this error:

[2012-08-20T11:26:28-07:00] INFO: Processing windows_batch[echo some env
vars] action run (windows_base::default line
/chef/cache/cookbooks/windows_base/recipes/default.rb)
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars]
(windows_base::default line
/chef/cache/cookbooks/windows_base/recipes/default.rb) has had an error
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars]
(c:/chef/cache/cookbooks/windows_base/recipes/default.rb:27:in from_file') had an error: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::Package::Macports C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:45:inplatforms’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:301:in
find' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:431:infind_provider’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:364:in
find_provider_for_node' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:354:inprovider_for_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource.rb:451:in
run_action' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:49:inrun_action’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in
block (2 levels) in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:ineach’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in
block in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:94:inblock in execute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:in
call' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:85:in
step' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:104:initerate’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:55:in
each_with_index' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:92:inexecute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:80:in
converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:330:inconverge’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:163:in
run' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:96:inservice_main’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in
mainloop' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:inmainloop’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in
`’
[2012-08-20T11:26:28-07:00] ERROR: Running exception handlers
[2012-08-20T11:26:28-07:00] FATAL: Saving node information to
c:/chef/cache/failed-run-data.json
[2012-08-20T11:26:28-07:00] ERROR: Exception handlers complete
[2012-08-20T11:26:28-07:00] ERROR: NameError: windows_batch[echo some env
vars] (windows_base::default line
/chef/cache/cookbooks/windows_base/recipes/default.rb) had an error:
NameError: uninitialized constant Chef::Provider::package::Macports

why does it use MacPorts on Windows? or did the Chef windows installer
missing something?

thanks


#5

I run that from the command line ( ie manually ), and didn’t have problem.

how do I merge this particular fix to my chef client? or we will need an new windows installer.

thanks

On Aug 20, 2012, at 11:53 AM, Tim Green wrote:

I believe the issue you’re running into is this:

http://tickets.opscode.com/browse/CHEF-3301

Could you run the chef-client manually and see if you run into the same problem?

-Tim

On Mon, Aug 20, 2012 at 2:47 PM, Barrow Kwan bhkwan@thoughtworks.com wrote:
Hi Tim,
Thanks for the quick respond.

  1. it is the full content of default.rb
  2. I am running chef-client as windows service.
  3. I didn’t add “-ldebug” but just run chef-client from command line and it is working fine.

looks like the problem with chef-client running as windows services…

Here is what the windows services command like
"C:\Tools\opscode\chef\embedded\bin\ruby" “C:\Tools\opscode\chef\embedded\lib\ruby\gems\1.9.1\gems\chef-10.12.0\lib\chef\application\windows_service.rb” -c C:\chef\client.rb -L -C:\chef\client.log

I guess something is missing from PATH when run it as windows_service

thanks

Barrow

On Aug 20, 2012, at 11:36 AM, Tim Green wrote:

Is the windows_batch resource you’ve showed to us the full contents of the default.rb file inside of the windows_base cookbook? If it isn’t, please paste the full recipe.

Secondly, can you re-run the chef client with more verbose logging? The following will help: ‘chef-client -ldebug’

One other thing. Did you install the chef-client as a windows service?

Thanks,

-Tim

On Mon, Aug 20, 2012 at 2:30 PM, Barrow Kwan bhkwan@thoughtworks.com wrote:
Hi,
First time install Chef Windows ( with the installer - http://www.opscode.com/chef/install.msi ). I created a recipes with " Chef::Log.info(“Hello World”) " and the windows node display this fine. Then I download the windows cookbook ( http://github.com/opscode-cookbooks/windows ) and test this

windows_batch “echo some env vars” do
code <<-EOH
echo %TEMP%
echo %SYSTEMDRIVE%
echo %PATH%
echo %WINDIR%
EOH
end

The windows node failed to run with this error:

[2012-08-20T11:26:28-07:00] INFO: Processing windows_batch[echo some env vars] action run (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb)
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) has had an error
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (c:/chef/cache/cookbooks/windows_base/recipes/default.rb:27:in from_file') had an error: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::Package::Macports C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:45:inplatforms’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:301:in find' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:431:infind_provider’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:364:in find_provider_for_node' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:354:inprovider_for_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource.rb:451:in run_action' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:49:inrun_action’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block (2 levels) in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:ineach’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:94:inblock in execute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:in call' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:85:in step' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:104:initerate’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:92:inexecute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:80:in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:330:inconverge’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:163:in run' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:96:inservice_main’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in mainloop' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:inmainloop’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in `’
[2012-08-20T11:26:28-07:00] ERROR: Running exception handlers
[2012-08-20T11:26:28-07:00] FATAL: Saving node information to c:/chef/cache/failed-run-data.json
[2012-08-20T11:26:28-07:00] ERROR: Exception handlers complete
[2012-08-20T11:26:28-07:00] ERROR: NameError: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::package::Macports

why does it use MacPorts on Windows? or did the Chef windows installer missing something?

thanks


#6

nevermind. I found where the fix is…

it is still a pain to manually fix this one line of code for every chef client install. it will be nice if we have a new installer … :slight_smile:

On Aug 20, 2012, at 12:14 PM, Barrow Kwan wrote:

I run that from the command line ( ie manually ), and didn’t have problem.

how do I merge this particular fix to my chef client? or we will need an new windows installer.

thanks

On Aug 20, 2012, at 11:53 AM, Tim Green wrote:

I believe the issue you’re running into is this:

http://tickets.opscode.com/browse/CHEF-3301

Could you run the chef-client manually and see if you run into the same problem?

-Tim

On Mon, Aug 20, 2012 at 2:47 PM, Barrow Kwan bhkwan@thoughtworks.com wrote:
Hi Tim,
Thanks for the quick respond.

  1. it is the full content of default.rb
  2. I am running chef-client as windows service.
  3. I didn’t add “-ldebug” but just run chef-client from command line and it is working fine.

looks like the problem with chef-client running as windows services…

Here is what the windows services command like
"C:\Tools\opscode\chef\embedded\bin\ruby" “C:\Tools\opscode\chef\embedded\lib\ruby\gems\1.9.1\gems\chef-10.12.0\lib\chef\application\windows_service.rb” -c C:\chef\client.rb -L -C:\chef\client.log

I guess something is missing from PATH when run it as windows_service

thanks

Barrow

On Aug 20, 2012, at 11:36 AM, Tim Green wrote:

Is the windows_batch resource you’ve showed to us the full contents of the default.rb file inside of the windows_base cookbook? If it isn’t, please paste the full recipe.

Secondly, can you re-run the chef client with more verbose logging? The following will help: ‘chef-client -ldebug’

One other thing. Did you install the chef-client as a windows service?

Thanks,

-Tim

On Mon, Aug 20, 2012 at 2:30 PM, Barrow Kwan bhkwan@thoughtworks.com wrote:
Hi,
First time install Chef Windows ( with the installer - http://www.opscode.com/chef/install.msi ). I created a recipes with " Chef::Log.info(“Hello World”) " and the windows node display this fine. Then I download the windows cookbook ( http://github.com/opscode-cookbooks/windows ) and test this

windows_batch “echo some env vars” do
code <<-EOH
echo %TEMP%
echo %SYSTEMDRIVE%
echo %PATH%
echo %WINDIR%
EOH
end

The windows node failed to run with this error:

[2012-08-20T11:26:28-07:00] INFO: Processing windows_batch[echo some env vars] action run (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb)
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) has had an error
[2012-08-20T11:26:28-07:00] ERROR: windows_batch[echo some env vars] (c:/chef/cache/cookbooks/windows_base/recipes/default.rb:27:in from_file') had an error: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::Package::Macports C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:45:inplatforms’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:301:in find' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:431:infind_provider’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:364:in find_provider_for_node' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/platform.rb:354:inprovider_for_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource.rb:451:in run_action' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:49:inrun_action’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block (2 levels) in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:ineach’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:85:in block in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:94:inblock in execute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:in call' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:85:in step' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:104:initerate’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/resource_collection.rb:92:inexecute_each_resource’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/runner.rb:80:in converge' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:330:inconverge’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/client.rb:163:in run' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:96:inservice_main’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in mainloop' C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:inmainloop’
C:/Tools/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/windows_service.rb:237:in `’
[2012-08-20T11:26:28-07:00] ERROR: Running exception handlers
[2012-08-20T11:26:28-07:00] FATAL: Saving node information to c:/chef/cache/failed-run-data.json
[2012-08-20T11:26:28-07:00] ERROR: Exception handlers complete
[2012-08-20T11:26:28-07:00] ERROR: NameError: windows_batch[echo some env vars] (windows_base::default line /chef/cache/cookbooks/windows_base/recipes/default.rb) had an error: NameError: uninitialized constant Chef::Provider::package::Macports

why does it use MacPorts on Windows? or did the Chef windows installer missing something?

thanks