Skip to content

Commit

Permalink
Converts clear to function
Browse files Browse the repository at this point in the history
  • Loading branch information
spuder committed Sep 2, 2015
1 parent dbf4552 commit 83956c4
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,23 @@
include Opscode::IIS::Helper

action :config do
cmd = "#{appcmd(node)} set config #{new_resource.cfg_cmd}"
Chef::Log.debug(cmd)
shell_out!(cmd, :returns => new_resource.returns)
Chef::Log.info('IIS Config command run')
new_resource.updated_by_last_action(true)
config(:config, "set")
end

action :set do
config(:config, "set")
end

action :clear do
cmd = "#{appcmd(node)} clear config #{new_resource.cfg_cmd}"
Chef::Log.debug(cmd)
shell_out!(cmd, :returns => new_resource.returns)
Chef::Log.info('IIS Config command run')
new_resource.updated_by_last_action(true)
config(:clear, "clear")
end

def config(action, appcmd_argument)
action "#{action}" do
cmd = "#{appcmd(node)} #{appcmd_argument} config #{new_resource.cfg_cmd}"
Chef::Log.debug(cmd)
shell_out!(cmd, :returns => new_resource.returns)
Chef::Log.info('IIS Config command run')
new_resource.updated_by_last_action(true)
end
end

0 comments on commit 83956c4

Please sign in to comment.