- From: Brad Knowles <
>
- To: Brad Knowles <
>
- Cc:
- Subject: [chef] Re: Re: Re: New Community Cookbook: MongoDB
- Date: Fri, 16 Sep 2011 14:44:56 -0500
On Sep 16, 2011, at 9:30 AM, Brad Knowles wrote:
>
> I hope I could help you with my hints, please come back if you need
>
> some more help with the mongodb cookbook.
>
>
Indeed, this has been helpful. I will let you know what I find out.
>
Thanks again!
I'm not sure if I've gotten past the previous problem, or if I have somehow
regressed, but I ran into another problem that's got me puzzled. This time,
it's keeping the code from even compiling, so I can't be sure if the previous
problem is resolved or not.
I've added some debugging statements, so the line numbers have changed, but
this code block is largely still the same:
181 ruby_block "config_replicaset" do
182 block do
183 Chef::Log.info("mongodb:config_replicaset:#{replicaset}
#{replicaset_name} #{rs_nodes}")
184 if not replicaset.nil?
185 MongoDB.configure_replicaset(replicaset, replicaset_name,
rs_nodes)
186 else
187 Chef::Log.info("replicaset nil!")
188 end
189 end
190 action :nothing
191 end
Can you tell me under what circumstances that you might think that the entire
replicaset itself could be nil? By the time we've gotten down to this code
and extracted the replicaset name and the rs_nodes, it seems that the entire
replicaset itself couldn't possibly be nil. Because of this test against
nil, we are seeing the following problem trying to compile this ruby_block:
FATAL: NoMethodError: ruby_block[config_replicaset] (mongodb::shard line 181)
had an error: undefined method `length' for nil:NilClass
As you can see, line 181 is the very first line of this ruby_block. I added
lines 183, 186, and 187. But the test of "!replicaset.nil?" was already
there, and looking at your current code at
<
https://github.com/edelight/cookbooks/blob/master/mongodb/definitions/mongodb.rb>
I see the same test.
--
Brad Knowles
<
>
Junior Apprentice Prep Cook Trainee
Archive powered by MHonArc 2.6.16.