[chef] Windows registry provider problems


Chronological Thread 
  • From: Bryan Stenson < >
  • To:
  • Subject: [chef] Windows registry provider problems
  • Date: Mon, 06 Feb 2012 09:16:23 -0800

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.

§