[chef] iis_config loop and variables


Chronological Thread 
  • From: Philip Smith < >
  • To:
  • Subject: [chef] iis_config loop and variables
  • Date: Wed, 5 Aug 2015 09:50:29 +0100

Hi all,

Please let me know if I'm directing my questions in the wrong way...

I have some data in a variable, I know it's working as I'm using it elsewhere and I've been able to get to it, however I'm thinking it might not work due to the order of process, please can you let me know if this should work:

Sites = %w{
  site1
  site2
}

sitecmds =%w{
  -section:system.applicationHost/sites\ /[name='#{sitename}'].virtualDirectoryDefaults.userName:#{node['mount_credentials']['username']}\ /commit:apphost
  -section:system.applicationHost/sites\ /[name='#{sitename}'].virtualDirectoryDefaults.password:#{node['mount_credentials']['password']}\ /commit:apphost
}

Sites.each do |sitename|
  sitecmds.each do |sitecmd|
    iis_config "#{sitecmd}" do
      action :config
    end
  end
end


Things to note:
I'm getting this value from the json attributes file that I run with chef-client, I am running in local mode.
#{node['mount_credentials']['username']}


Neither of the variables/data are inserted into the resulting command:
---- Begin output of C:\Windows\System32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites /[name='#{bwkzsite}'].virtualDirectoryDefaults.userName:#{node['mount_credentials']['username']} /commit:apphost ----
    STDOUT: ERROR ( message:Cannot find requested collection element. )

I have tried using all combinations of escapes and quotes and can't see to get it working, does anyone know how this might work?

Thanks
Phil

--
search<(haystack(needle))


  • [chef] iis_config loop and variables, Philip Smith, 08/05/2015

Archive powered by MHonArc 2.6.16.

§