chef-boneyard / windows

Development repository for Chef Cookbook windows
https://supermarket.chef.io/cookbooks/windows
Apache License 2.0
252 stars 270 forks source link

why not to bump version on any commit into master? #237

Closed vvchik closed 9 years ago

vvchik commented 9 years ago

we have a error with chef 11.18.12 on windows 2012r2 This is a problem with berkshelf using the latest git commit of the windows cookbook, instead of the metadata. This commit broke windows. opscode-cookbooks/windows@a8e8d3d

metadata

depends          'windows', '~> 1.37.0'
depends          'iis', '~> 4.1.1'
depends          'chef_handler'

berksfile

source "https://supermarket.chef.io"

metadata

cookbook 'windows', git: 'https://github.com/opscode-cookbooks/windows.git'
cookbook 'iis', git: 'https://github.com/opscode-cookbooks/iis.git'

powershell output

================================================================================
Recipe Compile Error in c:/chef/cache/cookbooks/windows/libraries/powershell_out.rb
================================================================================

NameError
---------
uninitialized constant Chef::Mixin::PowershellOut

Cookbook Trace:
---------------
  c:/chef/cache/cookbooks/windows/libraries/powershell_out.rb:9:in `<top (required)>'

Relevant File Content:
----------------------
c:/chef/cache/cookbooks/windows/libraries/powershell_out.rb:

  2:  #
  3:  # WARNING
  4:  #
  5:  # THIS CODE HAS BEEN MOVED TO CORE CHEF.  DO NOT SUMBIT PULL REQUESTS AGAINST THIS
  6:  # CODE.  IT WILL BE REMOVED IN THE FUTURE.
  7:  #
  8:
  9>> unless defined Chef::Mixin::PowershellOut
 10:    class Chef
 11:      module Mixin
 12:        module PowershellOut
 13:          include Chef::Mixin::ShellOut
 14:
 15:          begin
 16:            include Chef::Mixin::WindowsArchitectureHelper
 17:          rescue
 18:            # nothing to do, as the include will happen when windows_architecture_helper.rb

Running handlers:
[2015-06-25T16:30:42-04:00] ERROR: Running exception handlers
Running handlers complete
[2015-06-25T16:30:42-04:00] ERROR: Exception handlers complete
[2015-06-25T16:30:42-04:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 48.140716 seconds
[2015-06-25T16:30:42-04:00] FATAL: NameError: uninitialized constant Chef::Mixin::PowershellOut
PS C:\Users\sowen> chef --verison

stack trace

Generated at 2015-06-25 16:30:42 -0400
NameError: uninitialized constant Chef::Mixin::PowershellOut
C:/opscode/chef/embedded/apps/chef/lib/chef/mixin/deprecation.rb:51:in `const_missing'
c:/chef/cache/cookbooks/windows/libraries/powershell_out.rb:9:in `<top (required)>'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:191:in `load'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:191:in `block in load_libraries_from_cookbook'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:188:in `each'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:188:in `load_libraries_from_cookbook'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:99:in `block in compile_libraries'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:98:in `each'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:98:in `compile_libraries'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:71:in `compile'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context.rb:89:in `load'
C:/opscode/chef/embedded/apps/chef/lib/chef/policy_builder/expand_node_object.rb:73:in `setup_run_context'
C:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:265:in `setup_run_context'
C:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:429:in `do_run'
C:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:227:in `run'
C:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:236:in `run_chef_client'
C:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:338:in `block in run_application'
C:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:327:in `loop'
C:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:327:in `run_application'
C:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:55:in `run'
C:/opscode/chef/embedded/apps/chef/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:49:in `load'
C:/opscode/chef/bin/chef-client:49:in `<main>'
spuder commented 9 years ago

+1

My cookbooks that use the windows cookbook broke with this ^ same error. Berkshelf for some reason is using HEAD instead of the version 1.37.0

....
depends          'windows', '~> 1.37.0'

To work around it, I had to pin my cookbook to a specific commit.

before

source "https://supermarket.chef.io"

metadata

cookbook 'windows', git: 'https://github.com/opscode-cookbooks/windows.git'
cookbook 'iis', git: 'https://github.com/opscode-cookbooks/iis.git'

after

source "https://supermarket.chef.io"

metadata

cookbook 'windows', git: 'https://github.com/opscode-cookbooks/windows.git', ref: 'c4fe4db505c0f184ee34fb0165f451f4c545634a'
cookbook 'iis', git: 'https://github.com/opscode-cookbooks/iis.git'

Update

According to the berkshelf documentation, if you have a git url, then it will always pull from HEAD.

Instead, I'm now pulling 1.37.0 from the supermarket.

ksubrama commented 9 years ago

I would think removing the git link would also do the trick. It would then fetch the release from supermarket instead of from git. When fetching from git, it picks master by default. If you don't want to pin to a ref, but insist on fetching from git, you can also use branch: name or tag: name to increase readability.

spuder commented 9 years ago

Thanks, though it looks like the cookbook still is broken when using chef 11. Do you need a separate issue for that?

ksubrama commented 9 years ago

Sorry about that - itchy trigger fingers. Fixed in 198d97e7feef038dff7cdb3b0c067052123e60d5

vvchik commented 9 years ago

Super, thank you for info, and for fix.