Dhcp cookbook error: FATAL: NameError: uninitialized constant Chef::DSL

I installed depends for this cookbook
http://community.opscode.com/cookbooks/dhcp

And succefully upload it to the server

When I run chef-client on client. I got an error:

Recipe Compile Error in /var/chef/cache/cookbooks/dhcp/libraries/failover.rb

NameError

uninitialized constant Chef::DSL

Cookbook Trace:

/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:8:in
singletonclass' /var/chef/cache/cookbooks/dhcp/libraries/failover.rb:4:inmodule:Failover
/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:3:in <module:DHCP>' /var/chef/cache/cookbooks/dhcp/libraries/failover.rb:2:in<top
(required)>’

Relevant File Content:

/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:

1:
2: module DHCP
3: module Failover
4: class << self
5: if Chef::Version.new(Chef::VERSION) <= Chef::Version.new(
“10.16.2” )
6: include Chef::Mixin::Language
7: else
8>> include Chef::DSL::DataQuery
9: end
10:
11: attr :node
12: def load(node)
13: @node = node
14: end
15:
16: def enabled?
17: if role == “primary”

[2013-06-06T17:34:03+04:00] ERROR: Running exception handlers
[2013-06-06T17:34:03+04:00] FATAL: Saving node information to
/var/chef/cache/failed-run-data.json
[2013-06-06T17:34:03+04:00] ERROR: Exception handlers complete
[2013-06-06T17:34:03+04:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-06-06T17:34:03+04:00] FATAL: NameError: uninitialized constant
Chef::DSL

What I must install for normal work ?

Thak you very much!


Best regards,

CVision Lab System Administrator
Vladmir Skubriev

On Thursday, June 6, 2013 at 6:48 AM, Vladimir Skubriev wrote:

I installed depends for this cookbook http://community.opscode.com/cookbooks/dhcp

And succefully upload it to the server

When I run chef-client on client. I got an error:

Recipe Compile Error in /var/chef/cache/cookbooks/dhcp/libraries/failover.rb

NameError

uninitialized constant Chef::DSL

Cookbook Trace:

/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:8:in singletonclass' /var/chef/cache/cookbooks/dhcp/libraries/failover.rb:4:in module:Failover'
/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:3:in <module:DHCP>' /var/chef/cache/cookbooks/dhcp/libraries/failover.rb:2:in <top (required)>'

Relevant File Content:

/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:

1:
2: module DHCP
3: module Failover
4: class << self
5: if Chef::Version.new(Chef::VERSION) <= Chef::Version.new( "10.16.2" )
6: include Chef::Mixin::Language
7: else
8>> include Chef::DSL::DataQuery
9: end

Looks like a cookbook bug. The author is trying to guard for some changes we made in Chef 11, so the version check should be:

Chef::Version.new(Chef::VERSION) <= Chef::Version.new( "11.0.0" )

You can get in touch with the author here: GitHub - sous-chefs/dhcp: Development repository for the dhcp cookbook to file a bug report or submit a patch.

--
Daniel DeLeo

Yep missed the version there.. I've already fixed in develop branch on
github, but I think I am going to make the cook chef11 only as I want to
move to use_inline_resources. Anyhow I'll be trying to get specs and some
kitchen on this cook up to speed with whats modern and cut another
community release.

  • Jesse

On Thu, Jun 6, 2013 at 8:20 AM, Daniel DeLeo dan@kallistec.com wrote:

On Thursday, June 6, 2013 at 6:48 AM, Vladimir Skubriev wrote:

I installed depends for this cookbook
http://community.opscode.com/cookbooks/dhcp

And succefully upload it to the server

When I run chef-client on client. I got an error:

Recipe Compile Error in
/var/chef/cache/cookbooks/dhcp/libraries/failover.rb

================================================================================

NameError

uninitialized constant Chef::DSL

Cookbook Trace:

/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:8:in
singletonclass' /var/chef/cache/cookbooks/dhcp/libraries/failover.rb:4:in module:Failover'
/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:3:in <module:DHCP>' /var/chef/cache/cookbooks/dhcp/libraries/failover.rb:2:in <top
(required)>'

Relevant File Content:

/var/chef/cache/cookbooks/dhcp/libraries/failover.rb:

1:
2: module DHCP
3: module Failover
4: class << self
5: if Chef::Version.new(Chef::VERSION) <= Chef::Version.new(
"10.16.2" )
6: include Chef::Mixin::Language
7: else
8>> include Chef::DSL::DataQuery
9: end

Looks like a cookbook bug. The author is trying to guard for some changes
we made in Chef 11, so the version check should be:

Chef::Version.new(Chef::VERSION) <= Chef::Version.new( "11.0.0" )

You can get in touch with the author here:
GitHub - sous-chefs/dhcp: Development repository for the dhcp cookbook to file a bug report or submit a
patch.

--
Daniel DeLeo