diff --git a/resources/app.rb b/resources/app.rb index 7ef7bacf..59f9201d 100644 --- a/resources/app.rb +++ b/resources/app.rb @@ -33,7 +33,7 @@ load_current_value do |desired| site_name desired.site_name # Sanitize physical path - desired.physical_path = windows_cleanpath(desired.physical_path) + desired.physical_path = windows_cleanpath(desired.physical_path) if desired.physical_path cmd = shell_out("#{appcmd(node)} list app \"#{desired.site_name}#{desired.path}\"") Chef::Log.debug("#{appcmd(node)} list app command output: #{cmd.stdout}") if cmd.stderr.empty? diff --git a/resources/site.rb b/resources/site.rb index a0dd7e6e..2a0a6549 100644 --- a/resources/site.rb +++ b/resources/site.rb @@ -42,8 +42,8 @@ load_current_value do |desired| site_name desired.site_name # Sanitize windows file system path - desired.path = windows_cleanpath(desired.path) - desired.log_directory = windows_cleanpath(desired.log_directory) + desired.path = windows_cleanpath(desired.path) if desired.path + desired.log_directory = windows_cleanpath(desired.log_directory) if desired.log_directory cmd = shell_out "#{appcmd(node)} list site \"#{site_name}\"" Chef::Log.debug(appcmd(node)) # 'SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)' diff --git a/resources/vdir.rb b/resources/vdir.rb index c08ca21a..594d71cd 100644 --- a/resources/vdir.rb +++ b/resources/vdir.rb @@ -37,7 +37,7 @@ # Sanitize Application Name desired.application_name = application_cleanname(desired.application_name) # Sanitize Physical Path - desired.physical_path = windows_cleanpath(desired.physical_path) + desired.physical_path = windows_cleanpath(desired.physical_path) if desired.physical_path application_name desired.application_name path desired.path cmd = shell_out("#{appcmd(node)} list vdir \"#{application_name.chomp('/') + path}\"") diff --git a/test/cookbooks/test/recipes/site.rb b/test/cookbooks/test/recipes/site.rb index 23077b4a..0dedc0a9 100644 --- a/test/cookbooks/test/recipes/site.rb +++ b/test/cookbooks/test/recipes/site.rb @@ -26,6 +26,14 @@ recursive true end +iis_site 'to_be_deleted' do + application_pool 'DefaultAppPool' + path "#{node['iis']['docroot']}/site_test" + host_header 'localhost' + port 8081 + action [:add, :start] +end + iis_site 'test' do application_pool 'DefaultAppPool' path "#{node['iis']['docroot']}/site_test" @@ -40,3 +48,7 @@ port 8080 action [:add, :start] end + +iis_site 'to_be_deleted' do + action [:stop, :delete] +end diff --git a/test/integration/site/site_spec.rb b/test/integration/site/site_spec.rb index 5a70a742..58a4b5bc 100644 --- a/test/integration/site/site_spec.rb +++ b/test/integration/site/site_spec.rb @@ -35,3 +35,8 @@ it { should have_app_pool('DefaultAppPool') } its('bindings') { should eq ['http *:8080:localhost'] } end + +describe iis_site('to_be_deleted') do + it { should_not exist } + it { should_not be_running } +end