sous-chefs/iis

remove_default_site broken

taliesins opened this issue · 2 comments

Cookbook version

Release v6.7.0

Chef-client version

[Version of chef-client in your environment]

Platform Details

Running chefdk on windows

Scenario:

Remove default website.

Steps to Reproduce:

Add include_recipe 'iis::remove_default_site' to a cookbook and attempt to deploy it.

Expected Result:

Expecting it to remove the default site if it exists. This was working before. I think it is recent check-ins that have broken this functionality.

Actual Result:

iis_site[Default Web Site] action stop[2017-06-09T10:15:46+01:00] INFO: Processing iis_site[Default Web Site] action stop (iis::remove_default_site line 21)


    ================================================================================
    Error executing action `stop` on resource 'iis_site[Default Web Site]'
    ================================================================================

    TypeError
    ---------
    no implicit conversion of nil into String

    Cookbook Trace:
    ---------------
    C:/dev-env/provision/temp/cache/cookbooks/iis/libraries/helper.rb:70:in `windows_cleanpath'
    C:/dev-env/provision/temp/cache/cookbooks/iis/resources/site.rb:45:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In C:/dev-env/provision/temp/cache/cookbooks/iis/recipes/remove_default_site.rb

     21: iis_site 'Default Web Site' do
     22:   action [:stop, :delete]
     23: end
     24:

    Compiled Resource:
    ------------------
    # Declared in C:/dev-env/provision/temp/cache/cookbooks/iis/recipes/remove_default_site.rb:21:in `from_file'

    iis_site("Default Web Site") do
      action [:stop, :delete]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :iis_site
      cookbook_name "iis"
      recipe_name "remove_default_site"
      site_name "Default Web Site"
      options ""
      log_directory "C:\\inetpub\\logs\\LogFiles"
    end

    Platform:
    ---------
    i386-mingw32

This is a bug with how i did some idempotency fixes in 6.7.0 basically any line like the below
desired.physical_path = windows_cleanpath(desired.physical_path)

needs a guard clause on it
desired.physical_path = windows_cleanpath(desired.physical_path) if desired.physical_path

i have a change for this and am adding tests now

Resolved by #378