Skip to content

Commit dab0464

Browse files
authored
Fix issue with iis_pool stop (#346)
Signed-off-by: Justin Schuhmann <jmschu02@gmail.com>
1 parent 10d4234 commit dab0464

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

resources/pool.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,17 @@
206206
end
207207

208208
action :start do
209-
if !current_resource.runtime_version
209+
if !current_resource.runtime_version && !running
210210
converge_by "Started Application Pool \"#{new_resource}\"" do
211-
shell_out!("#{appcmd(node)} start apppool \"#{new_resource.name}\"") unless new_resource.running
211+
shell_out!("#{appcmd(node)} start apppool \"#{new_resource.name}\"")
212212
end
213213
else
214214
Chef::Log.debug("#{new_resource} already running - nothing to do")
215215
end
216216
end
217217

218218
action :stop do
219-
if current_resource.runtime_version
219+
if current_resource.runtime_version && running
220220
converge_by "Stopped Application Pool \"#{new_resource}\"" do
221221
shell_out!("#{appcmd(node)} stop apppool \"#{new_resource.name}\"")
222222
end
@@ -238,7 +238,7 @@
238238
action :recycle do
239239
if current_resource.runtime_version
240240
converge_by "Recycled Application Pool \"#{new_resource}\"" do
241-
shell_out!("#{appcmd(node)} recycle APPPOOL \"#{new_resource.name}\"")
241+
shell_out!("#{appcmd(node)} recycle APPPOOL \"#{new_resource.name}\"") if running
242242
end
243243
end
244244
end

test/cookbooks/test/recipes/pool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
iis_pool 'myAppPool_v1_1' do
2727
runtime_version '2.0'
2828
pipeline_mode :Classic
29-
action [:add, :config]
29+
action [:add, :config, :stop]
3030
end
3131

3232
iis_pool 'testapppool' do

test/integration/pool/controls/pool_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
describe iis_pool('myAppPool_v1_1') do
1414
it { should exist }
15-
it { should be_running }
15+
its('state') { should eq 'Stopped' }
1616
its('managed_runtime_version') { should eq 'v2.0' }
1717
it { should have_name('myAppPool_v1_1') }
1818
it { should have_queue_length(1000) }

test/integration/pool/libraries/iis_pool.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def has_name?(pool_name)
110110
end
111111

112112
def has_queue_length?(queue_length)
113-
Log.info(iis_pool)
114113
iis_pool.nil? ? false : iis_pool[:queue_length] == queue_length
115114
end
116115

@@ -160,7 +159,6 @@ def iis_pool(pool_name)
160159
pool_cpu = JSON.parse(cmd_cpu.stdout)
161160
pool_worker_processes = JSON.parse(cmd_worker_processes.stdout)
162161
rescue JSON::ParserError => _e
163-
Log.info(cmd.stderr)
164162
return {}
165163
end
166164

0 commit comments

Comments
 (0)