Class: Chef::Provider::Service::Insserv

Inherits:
Init show all
Defined in:
lib/chef/provider/service/insserv.rb

Instance Attribute Summary

Attributes inherited from Chef::Provider

#current_resource, #new_resource, #run_context

Instance Method Summary collapse

Methods inherited from Init

#initialize, #reload_service, #restart_service, #start_service, #stop_service

Methods inherited from Simple

#ps_cmd, #reload_service, #restart_service, #start_service, #stop_service

Methods inherited from Chef::Provider::Service

#action_disable, #action_enable, #action_reload, #action_restart, #action_start, #action_stop, #initialize, #reload_service, #restart_service, #start_service, #stop_service

Methods included from Mixin::Command

#chdir_or_tmpdir, #handle_command_failures, #not_if, #only_if, #output_of_command, #run_command, #run_command_with_systems_locale

Methods included from Mixin::Command::Windows

#popen4

Methods included from Mixin::Command::Unix

#popen4

Methods inherited from Chef::Provider

#action_nothing, build_from_file, #cookbook_name, #initialize, #node, #resource_collection

Methods included from Mixin::ConvertToClassName

#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string, #snake_case_basename

Methods included from Mixin::RecipeDefinitionDSLCore

#method_missing

Methods included from Mixin::Language

#data_bag, #data_bag_item, #platform?, #search, #value_for_platform

Constructor Details

This class inherits a constructor from Chef::Provider::Service::Init

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chef::Mixin::RecipeDefinitionDSLCore

Instance Method Details

#disable_serviceObject



46
47
48
# File 'lib/chef/provider/service/insserv.rb', line 46

def disable_service()
  run_command(:command => "/sbin/insserv -r -f #{@new_resource.service_name}")
end

#enable_serviceObject



41
42
43
44
# File 'lib/chef/provider/service/insserv.rb', line 41

def enable_service()
  run_command(:command => "/sbin/insserv -r -f #{@new_resource.service_name}")
  run_command(:command => "/sbin/insserv -d -f #{@new_resource.service_name}")
end

#load_current_resourceObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/chef/provider/service/insserv.rb', line 28

def load_current_resource
  super

  # Look for a /etc/rc.*/SnnSERVICE link to signifiy that the service would be started in a runlevel
  if Dir.glob("/etc/rc**/S*#{@current_resource.service_name}").empty?
    @current_resource.enabled false
  else
    @current_resource.enabled true 
  end
  
  @current_resource
end