Search code examples
iischef-infrachef-recipecookbook

chef iis cookbook does change site settings


I can do this to create a new site that didn't exist before:

iis_site MySite do
  site_name MySite
  application_pool MySite
  protocol :https
  port 443
  path "C:/inetpub/MySite"
  log_directory "C:/inetpub/mylogfolder"
  log_truncsize 52428800
  action [:add,:start]
end

That will create a new site with those settings BUT if the site already exists it will not change any of those settings.

So lets say I ran it once and it created a site with the above settings. If I edit the recipe to do this:

iis_site MySite do
  site_name MySite
  application_pool MySite
  protocol :http
  port 80
  path "C:/inetpub/MySite"
  log_directory "C:/inetpub/MySite/different/folder/path"
  log_truncsize 52428800
  action [:add,:start]
end

It makes no changes to the current site. Is this by design for this cookbook? Seems like its only useful for deploying new sites and little else.


Solution

  • I know little of IIS but you can find the relevant code here https://github.com/chef-cookbooks/iis/blob/master/providers/site.rb#L131-L226

    It definitely seems like it is trying to idempotently apply changes to log_directory but it is possible there is a flaw in the logic or in the commands it uses to get/set site data.