summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Williams <nath.e.will@gmail.com>2015-10-23 22:27:42 -0700
committerNathan Williams <nath.e.will@gmail.com>2015-10-23 22:27:42 -0700
commit12f7293dea16a566b52fbf15e50f56b4ef80a213 (patch)
tree901a63b26e4199dd166b38262375439c52776b3c
parenta58c59460aa6b9cfe0824dabaf6cac0c445d0288 (diff)
downloadchef-12f7293dea16a566b52fbf15e50f56b4ef80a213.tar.gz
move gross non-service "services" to separate detection method
-rw-r--r--lib/chef/platform/service_helpers.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/chef/platform/service_helpers.rb b/lib/chef/platform/service_helpers.rb
index f97eed2581..3ef6ee4ae3 100644
--- a/lib/chef/platform/service_helpers.rb
+++ b/lib/chef/platform/service_helpers.rb
@@ -88,7 +88,7 @@ class Chef
configs << :usr_local_etc_rcd
end
- if has_systemd_service_unit?(service_name)
+ if has_systemd_service_unit?(service_name) || has_systemd_unit?(service_name)
configs << :systemd
end
@@ -98,14 +98,22 @@ class Chef
private
def systemd_is_init?
- ::File.exist?("/proc/1/comm") &&
+ ::File.exist?(Chef.path_to("/proc/1/comm")) &&
IO.read("/proc/1/comm").chomp == "systemd"
end
def has_systemd_service_unit?(svc_name)
- %w( /etc /run /usr/lib ).any? do |cfg_base|
- ::File.exist?("#{cfg_base}/systemd/system/#{svc_name.gsub(/@.*$/, '@')}.service") ||
- ::File.exist?("#{cfg_base}/systemd/system/#{svc_name}") # TODO: Stop supporting non-service units
+ %w( /etc /run /usr/lib ).any? do |load_path|
+ ::File.exist?(
+ Chef.path_to("#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, '@')}.service")
+ )
+ end
+ end
+
+ def has_systemd_unit?(svc_name)
+ # TODO: stop supporting non-service units with service resource
+ %w( /etc /run /usr/lib ).any? do |load_path|
+ ::File.exist?(Chef.path_to("#{load_path}/systemd/system/#{svc_name}"))
end
end
end