summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorJulian C. Dunn <jdunn@chef.io>2015-05-05 09:50:52 -0700
committerJulian C. Dunn <jdunn@chef.io>2015-05-05 09:50:52 -0700
commitf74c9a16ed3a9d14bc1dfb6e9d34601c6afbd6a9 (patch)
treee6bc0c38959c10b7d363d35a301cbd8dfe17a8fd /lib/chef
parent8c92948746bc418fac09218814a9cfb9e4894b5d (diff)
downloadchef-f74c9a16ed3a9d14bc1dfb6e9d34601c6afbd6a9.tar.gz
Replace AIX unreliable service group parsing mechanism.
Closes #3327 Closes #3248
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/provider/service/aix.rb25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/chef/provider/service/aix.rb b/lib/chef/provider/service/aix.rb
index 0aef62c62e..09ed4bbf01 100644
--- a/lib/chef/provider/service/aix.rb
+++ b/lib/chef/provider/service/aix.rb
@@ -91,15 +91,18 @@ class Chef
protected
def determine_current_status!
- Chef::Log.debug "#{@new_resource} using lssrc to check the status "
+ Chef::Log.debug "#{@new_resource} using lssrc to check the status"
begin
- services = shell_out!("lssrc -a | grep -w #{@new_resource.service_name}").stdout.split("\n")
- is_resource_group?(services)
-
- if services.length == 1 && services[0].split(' ').last == "active"
- @current_resource.running true
- else
+ if is_resource_group?
+ # Groups as a whole have no notion of whether they're running
@current_resource.running false
+ else
+ service = shell_out!("lssrc -s #{@new_resource.service_name}").stdout
+ if service.split(' ').last == 'active'
+ @current_resource.running true
+ else
+ @current_resource.running false
+ end
end
Chef::Log.debug "#{@new_resource} running: #{@current_resource.running}"
# ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
@@ -112,11 +115,9 @@ class Chef
end
end
- def is_resource_group? (services)
- if services.length > 1
- Chef::Log.debug("#{@new_resource.service_name} is a group")
- @is_resource_group = true
- elsif services[0].split(' ')[1] == @new_resource.service_name
+ def is_resource_group?
+ so = shell_out!("lssrc -g #{@new_resource.service_name}")
+ if so.exitstatus == 0
Chef::Log.debug("#{@new_resource.service_name} is a group")
@is_resource_group = true
end