Skip to content

Commit

Permalink
Fix issue with guard clause missing on check
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Schuhmann <jmschu02@gmail.com>
  • Loading branch information
EasyAsABC123 committed Jun 9, 2017
1 parent de6c2c1 commit 47c2b80
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion resources/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions resources/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
Expand Down
2 changes: 1 addition & 1 deletion resources/vdir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"")
Expand Down
12 changes: 12 additions & 0 deletions test/cookbooks/test/recipes/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -40,3 +48,7 @@
port 8080
action [:add, :start]
end

iis_site 'to_be_deleted' do
action [:stop, :delete]
end
5 changes: 5 additions & 0 deletions test/integration/site/site_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 47c2b80

Please sign in to comment.