Class: PoiseService::ServiceProviders::Upstart
- Includes:
- Chef::Mixin::ShellOut
- Defined in:
- lib/poise_service/service_providers/upstart.rb
Overview
Class Method Summary collapse
Instance Method Summary collapse
-
#action_reload ⇒ Object
Shim out reload if we have a version that predates reload support.
-
#action_restart ⇒ Object
True restart in Upstart preserves the original config data, we want the more obvious behavior like everything else in the world that restart would re-read the updated config file.
- #pid ⇒ Object
Methods inherited from Base
#action_disable, #action_enable, #action_start, #action_stop, service_resource_hints
Class Method Details
.provides_auto?(node, resource) ⇒ Boolean
32 33 34 35 36 |
# File 'lib/poise_service/service_providers/upstart.rb', line 32 def self.provides_auto?(node, resource) # Don't allow upstart under docker, it won't work. return false if node['virtualization'] && %w{docker lxc}.include?(node['virtualization']['system']) service_resource_hints.include?(:upstart) end |
Instance Method Details
#action_reload ⇒ Object
Shim out reload if we have a version that predates reload support.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/poise_service/service_providers/upstart.rb', line 49 def action_reload return if ['never_reload'] if !upstart_features[:reload_signal] && new_resource.reload_signal != 'HUP' if [:reload_shim] Process.kill(new_resource.reload_signal, pid) else check_reload_signal! end else super end end |
#action_restart ⇒ Object
True restart in Upstart preserves the original config data, we want the more obvious behavior like everything else in the world that restart would re-read the updated config file. Use stop+start to get this behavior. http://manpages.ubuntu.com/manpages/raring/man8/initctl.8.html
42 43 44 45 46 |
# File 'lib/poise_service/service_providers/upstart.rb', line 42 def action_restart return if ['never_restart'] action_stop action_start end |
#pid ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/poise_service/service_providers/upstart.rb', line 62 def pid cmd = shell_out(%w{initctl status} + [new_resource.service_name]) if !cmd.error? && md = cmd.stdout.match(/process (\d+)/) md[1].to_i else nil end end |