[chef] Re: Re: Re: Re: Windows registry provider problems


Chronological Thread 
  • From: Bryan Stenson < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Windows registry provider problems
  • Date: Mon, 06 Feb 2012 12:53:57 -0800

that's it!  thank you SO much.  (my forehead can start healing now)

On 02/06/2012 12:46 PM, AJ Christensen wrote:
Try something like this:
https://gist.github.com/1754714

In a resource, the parameters are assigned using a method_missing on
the Resource class (or something similar), this means, among other
things, that you might not have access to manipulate a hash Parameter
with []=

Regards,

--AJ

On 7 February 2012 09:41, Bryan 
Stenson< >
  wrote:
Thanks AJ -

Source code is here: https://gist.github.com/1754671

DEBUG logs are here: https://gist.github.com/1754690

As you can see, I have a "windows-application-role" which has the snmpd and
windows default recipes applied....this role is applied to my server in
question.

Bryan



On 02/06/2012 11:59 AM, AJ Christensen wrote:
Show full stack trace and code on a gist, with DEBUG log level.

Regards,

--AJ

On 7 February 2012 06:16, Bryan 
Stenson< >
    wrote:
Hi all -

I'm using the github opscode Windows cookbook (1.2.9) to add registry
entries...when I use the example syntax, it works great (i've added the
logging):

windows_registry
'HKLM\SYSTEM\CurrentControlSet\services\SNMP\Parameters\RFC1156Agent' do
  values 'sysContact' =>    node[:snmpd][:sysContact], 'sysLocation' =>
node.chef_environment
  Chef::Log.info("** #{values}**")
end

I have a use case for adding a dynamic number of key/value pairs into the
hash...so I'm forced to use a different hash operator.  However, if I
switch
to the other hash syntax (shown below):

windows_registry
'HKLM\SYSTEM\CurrentControlSet\services\SNMP\Parameters\RFC1156Agent' do
  values['sysContact'] = node[:snmpd][:sysContact]
  values['sysLocation'] = node.chef_environment
  Chef::Log.info("** #{values}**")
end

the chef-client fails with the following error: "FATAL: NoMethodError:
undefined method '[]=' for nil:NilClass"...despite the "values" hash
being
printed to in the logs identically to the "good" hash syntax.

The error above can be traced back to the registry.rb provider, where the
values hash is apparently nil ({}).

I've tried everything I can think of (explicitly instantiating the
"values"
hash as new, declaring "values" as both instance and/or global scope),
and
I'm not getting anywhere.

Does anybody have any other suggestions?

Thanks for your time.
Bryan



Archive powered by MHonArc 2.6.16.

§