jeudi 9 février 2017

Calling an array within an array for Chef Attributes

Vote count: 0

I'm trying to get a Chef recipe built for a series of Registry_keys. They are all being hosted within the chef attributes default.rb. I'm trying to call the defined attribute and create_if_missing each key.

Examples of the code are as follows.

Chef attribute\default.rb

default['randomhost']['registry']['entries'] = [{ 'Key' => 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\RandomApplication', 'Values' => [{ name: 'RandomValueName', type: :qword, data: 1 }, { name: 'RandomValueName2', type: :qword, data: 2}] }]

Chef Recipe\registryKey.rb

 node['randomhost']['registry']['entries'].each do |item|
  registry_key item['Key'] do
    values item['Values']
    recursive true
    action :create_if_missing # Default
  end
end

When I go to build this out, calling the item['Values'] claims that 'Bad key name in RegistryKey values hash'. I'm not entirely sure why this is as name:, type:, and data: are all symbols in the attributes array.

Any help would be appreciated. Thank you,

asked 25 secs ago

Let's block ads! (Why?)



Calling an array within an array for Chef Attributes

Aucun commentaire:

Enregistrer un commentaire