Class: PoiseService::ServiceProviders::Base

Inherits:
Chef::Provider
  • Object
show all
Defined in:
lib/poise_service/service_providers/base.rb

Overview

Since:

  • 1.0.0

Direct Known Subclasses

Dummy, Inittab, Systemd, Sysvinit, Upstart

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.service_resource_hints ⇒ Array<Symbol>

Cache the service hints to improve performance. This is called from the provides_auto? on most service providers and hits the filesystem a lot.

Returns:

  • (Array<Symbol>)

Since:

  • 1.0.0



51
52
53
# File 'lib/poise_service/service_providers/base.rb', line 51

def self.service_resource_hints
  @@service_resource_hints ||= Chef::Platform::ServiceHelpers.service_resource_providers
end

Instance Method Details

#action_disable ⇒ Object

Since:

  • 1.0.0



64
65
66
67
68
69
70
# File 'lib/poise_service/service_providers/base.rb', line 64

def action_disable
  action_stop
  disable_service
  notifying_block do
    destroy_service
  end
end

#action_enable ⇒ Object

Since:

  • 1.0.0



55
56
57
58
59
60
61
62
# File 'lib/poise_service/service_providers/base.rb', line 55

def action_enable
  include_recipe(*Array(recipes)) if recipes
  notifying_block do
    create_service
  end
  enable_service
  action_start
end

#action_reload ⇒ Object

Since:

  • 1.0.0



93
94
95
96
97
98
# File 'lib/poise_service/service_providers/base.rb', line 93

def action_reload
  return if options['never_reload']
  notify_if_service do
    service_resource.run_action(:reload)
  end
end

#action_restart ⇒ Object

Since:

  • 1.0.0



86
87
88
89
90
91
# File 'lib/poise_service/service_providers/base.rb', line 86

def action_restart
  return if options['never_restart']
  notify_if_service do
    service_resource.run_action(:restart)
  end
end

#action_start ⇒ Object

Since:

  • 1.0.0



72
73
74
75
76
77
# File 'lib/poise_service/service_providers/base.rb', line 72

def action_start
  return if options['never_start']
  notify_if_service do
    service_resource.run_action(:start)
  end
end

#action_stop ⇒ Object

Since:

  • 1.0.0



79
80
81
82
83
84
# File 'lib/poise_service/service_providers/base.rb', line 79

def action_stop
  return if options['never_stop']
  notify_if_service do
    service_resource.run_action(:stop)
  end
end

#pid ⇒ Object

Raises:

  • (NotImplementedError)

Since:

  • 1.0.0



100
101
102
# File 'lib/poise_service/service_providers/base.rb', line 100

def pid
  raise NotImplementedError
end