Module: ChefUtils::DSL::Service
- Extended by:
- Service
- Includes:
- Introspection, TrainHelpers, Internal
- Included in:
- Service
- Defined in:
- lib/chef-utils/dsl/service.rb
Overview
NOTE: these are mixed into the service resource+providers specifically and deliberately not injected into the global namespace
Instance Method Summary collapse
-
#debianrcd? ⇒ Boolean
Returns if debian’s old rc.d manager is installed (not necessarily the primary init system).
-
#insserv? ⇒ Boolean
Returns if insserv is installed (not necessarily the primary init system).
-
#invokercd? ⇒ Boolean
Returns if debian’s old invoke rc.d manager is installed (not necessarily the primary init system).
-
#redhatrcd? ⇒ Boolean
Returns if redhat’s init system is installed (not necessarily the primary init system).
-
#service_script_exist?(type, script) ⇒ Boolean
Returns if a particular service exists for a particular service init system.
-
#upstart? ⇒ Boolean
Returns if upstart is installed (not necessarily the primary init system).
Methods included from Introspection
#ci?, #docker?, #effortless?, #has_systemd_service_unit?, #has_systemd_unit?, #includes_recipe?, #kitchen?, #systemd?
Methods included from TrainHelpers
#dir_exist?, #file_directory?, #file_exist?, #file_open, #file_read
Instance Method Details
#debianrcd? ⇒ Boolean
Returns if debian’s old rc.d manager is installed (not necessarily the primary init system).
37 38 39 |
# File 'lib/chef-utils/dsl/service.rb', line 37 def debianrcd? file_exist?("/usr/sbin/update-rc.d") end |
#insserv? ⇒ Boolean
Returns if insserv is installed (not necessarily the primary init system).
67 68 69 |
# File 'lib/chef-utils/dsl/service.rb', line 67 def insserv? file_exist?("/sbin/insserv") end |
#invokercd? ⇒ Boolean
Returns if debian’s old invoke rc.d manager is installed (not necessarily the primary init system).
47 48 49 |
# File 'lib/chef-utils/dsl/service.rb', line 47 def invokercd? file_exist?("/usr/sbin/invoke-rc.d") end |
#redhatrcd? ⇒ Boolean
Returns if redhat’s init system is installed (not necessarily the primary init system).
77 78 79 |
# File 'lib/chef-utils/dsl/service.rb', line 77 def redhatrcd? file_exist?("/sbin/chkconfig") end |
#service_script_exist?(type, script) ⇒ Boolean
Returns if a particular service exists for a particular service init system. Init systems may be :initd, :upstart, :etc_rcd, :xinetd, and :systemd. Example: service_script_exist?(:systemd, ‘ntpd’)
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/chef-utils/dsl/service.rb', line 90 def service_script_exist?(type, script) case type when :initd file_exist?("/etc/init.d/#{script}") when :upstart file_exist?("/etc/init/#{script}.conf") when :xinetd file_exist?("/etc/xinetd.d/#{script}") when :etc_rcd file_exist?("/etc/rc.d/#{script}") when :systemd file_exist?("/etc/init.d/#{script}") || has_systemd_service_unit?(script) || has_systemd_unit?(script) else raise ArgumentError, "type of service must be one of :initd, :upstart, :xinetd, :etc_rcd, or :systemd" end end |
#upstart? ⇒ Boolean
Returns if upstart is installed (not necessarily the primary init system).
57 58 59 |
# File 'lib/chef-utils/dsl/service.rb', line 57 def upstart? file_exist?("/sbin/initctl") end |