Skip to content

Commit

Permalink
ensure carriage returns are removed before applying regex
Browse files Browse the repository at this point in the history
  • Loading branch information
schisamo committed Oct 24, 2011
1 parent 31c86ac commit 6567871
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion iis/providers/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def load_current_resource
cmd = shell_out("#{appcmd} list site")
# 'SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)'
Chef::Log.debug("#{@new_resource} list site command output: #{cmd.stdout}")
result = cmd.stdout.match(/^SITE\s\"(#{@new_resource.site_name})\"\s\(id:(.*),bindings:(.*),state:(.*)\)$/) if cmd.stderr.empty?
if cmd.stderr.empty?
result = cmd.stdout.gsub(/\r\n?/, "\n") # ensure we have no carriage returns
result = result.match(/^SITE\s\"(#{new_resource.site_name})\"\s\(id:(.*),bindings:(.*),state:(.*)\)$/)
end
Chef::Log.debug("#{@new_resource} current_resource match output: #{result}")
if result
@current_resource.site_id(result[2].to_i)
Expand Down

0 comments on commit 6567871

Please sign in to comment.