- From:
- To: chef <
>
- Subject: [chef] node attribute is there, but getting NoMethodError
- Date: Wed, 4 Apr 2012 11:01:52 -0700
hi. i can't figure out what's going wrong here. i'm hoping it's
something silly that i'm overlooking. my yumrepo recipe to distribute
a repo file errors out with NoMethodError. within the yum_repository
block, it tries to act on an attribute that should be there, but it's
failing.
can anyone help me figure out what's going wrong? details below.
thanks!
kallen
chef-server: ubuntu, 0.10.8-1
chef-client: centos, 0.10.8-3 (full stack)
the relevant block in the recipe:
16 yum_repository "moog_os_baseline" do
17 description "CentOS updates controlled by Moog, baseline"
18 url node['repo']['moog_os_baseline']['url']
19 action :add
20 if not node['repo']['moog_os_baseline']
21 #if node['repo']['moog_os_baseline'] == "false"
22 Chef::Log.debug("HIGGS-BOSON: disabling repo moog_os_baseline")
23 enabled 0
24 else
25 Chef::Log.debug("HIGGS-BOSON: enabling repo moog_os_baseline")
26 end
27 end
the line in yumrepo/attributes/moog-os-updates-centos.rb that sets the attr:
default['repo']['moog_os_baseline']['url'] =
"
http://mrepo.dev.moog.com/mrepo/#{node['platform']}#{node['platform_version'].split('.')[0]}-$basearch/RPMS.updates_baseline/"
the error during chef-client run:
[Wed, 04 Apr 2012 17:46:43 +0000] DEBUG: Found recipe moog-os-updates-centos
in cookbook yumrepo
[Wed, 04 Apr 2012 17:46:43 +0000] ERROR: Running exception handlers
[Wed, 04 Apr 2012 17:46:43 +0000] FATAL: Saving node information to
/var/cache/chef/failed-run-data.json
[Wed, 04 Apr 2012 17:46:43 +0000] ERROR: Exception handlers complete
[Wed, 04 Apr 2012 17:46:43 +0000] DEBUG: Re-raising exception: NoMethodError
- undefined method `[]' for false:FalseClass
/var/cache/chef/cookbooks/yumrepo/recipes/moog-os-updates-centos.rb:18:in
`block in from_file'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/recipe_definition_dsl_core.rb:69:in
`instance_eval'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/recipe_definition_dsl_core.rb:69:in
`method_missing'
/var/cache/chef/cookbooks/yumrepo/recipes/moog-os-updates-centos.rb:16:in
`from_file'
a view of the node attribute ... it's there, right? it's set as a default
attr.
[chef-repo]$ knife node show test-kallen.dev.moog.com -Fj -l | grep -A 1
moog_os_baseline
"moog_os_baseline": {
"url":
"
http://mrepo.dev.moog.com/mrepo/centos5-$basearch/RPMS.updates_baseline/"
--
"moog_os_baseline": false,
"moog_os_test": true,
- [chef] node attribute is there, but getting NoMethodError, kallen, 04/04/2012
Archive powered by MHonArc 2.6.16.