diff options
author | Seth Vargo <sethvargo@gmail.com> | 2013-09-24 17:38:44 -0400 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-09-26 11:13:59 -0700 |
commit | 6315871ae7deeead95d84d2487c54a03c47e318f (patch) | |
tree | a2bf980c434c657aa350c0d3fc4073652cdf43cf /lib/chef/provider/service | |
parent | 61e98b94fb387353841d5b4575816a1d716cfbc9 (diff) | |
download | chef-6315871ae7deeead95d84d2487c54a03c47e318f.tar.gz |
Normalize whitespace on all files
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r-- | lib/chef/provider/service/debian.rb | 20 | ||||
-rw-r--r-- | lib/chef/provider/service/freebsd.rb | 18 | ||||
-rw-r--r-- | lib/chef/provider/service/gentoo.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/service/init.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/insserv.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/invokercd.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/redhat.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/simple.rb | 12 | ||||
-rw-r--r-- | lib/chef/provider/service/solaris.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/systemd.rb | 6 | ||||
-rw-r--r-- | lib/chef/provider/service/upstart.rb | 28 |
11 files changed, 53 insertions, 53 deletions
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb index e2a0f60d91..f52099921f 100644 --- a/lib/chef/provider/service/debian.rb +++ b/lib/chef/provider/service/debian.rb @@ -41,17 +41,17 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| update_rcd = "/usr/sbin/update-rc.d" - a.assertion { ::File.exists? update_rcd } + a.assertion { ::File.exists? update_rcd } a.failure_message Chef::Exceptions::Service, "#{update_rcd} does not exist!" # no whyrun recovery - this is a base system component of debian - # distros and must be present - end + # distros and must be present + end requirements.assert(:all_actions) do |a| - a.assertion { @priority_success } + a.assertion { @priority_success } a.failure_message Chef::Exceptions::Service, "/usr/sbin/update-rc.d -n -f #{@current_resource.service_name} failed - #{@rcd_status.inspect}" - # This can happen if the service is not yet installed,so we'll fake it. - a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.", + # This can happen if the service is not yet installed,so we'll fake it. + a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.", "Assigning temporary priorities to continue.", "If this service is not properly installed prior to this point, this will fail."] do temp_priorities = {"6"=>[:stop, "20"], @@ -74,7 +74,7 @@ class Chef [stdout, stderr].each do |iop| iop.each_line do |line| if UPDATE_RC_D_PRIORITIES =~ line - # priority[runlevel] = [ S|K, priority ] + # priority[runlevel] = [ S|K, priority ] # S = Start, K = Kill # debian runlevels: 0 Halt, 1 Singleuser, 2 Multiuser, 3-5 == 2, 6 Reboot priority[$1] = [($2 == "S" ? :start : :stop), $3] @@ -110,7 +110,7 @@ class Chef run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d #{@new_resource.service_name} defaults #{@new_resource.priority} #{100 - @new_resource.priority}") elsif @new_resource.priority.is_a? Hash - # we call the same command regardless of we're enabling or disabling + # we call the same command regardless of we're enabling or disabling # users passing a Hash are responsible for setting their own start priorities set_priority() else # No priority, go with update-rc.d defaults @@ -126,10 +126,10 @@ class Chef run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} stop #{100 - @new_resource.priority} 2 3 4 5 .") elsif @new_resource.priority.is_a? Hash - # we call the same command regardless of we're enabling or disabling + # we call the same command regardless of we're enabling or disabling # users passing a Hash are responsible for setting their own stop priorities set_priority() - else + else # no priority, using '100 - 20 (update-rc.d default)' to stop in reverse order of start run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} stop 80 2 3 4 5 .") diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb index b875838ec2..cb0f6b0fc4 100644 --- a/lib/chef/provider/service/freebsd.rb +++ b/lib/chef/provider/service/freebsd.rb @@ -38,13 +38,13 @@ class Chef elsif ::File.exists?("/usr/local/etc/rc.d/#{current_resource.service_name}") @init_command = "/usr/local/etc/rc.d/#{current_resource.service_name}" else - @rcd_script_found = false + @rcd_script_found = false return end Chef::Log.debug("#{@current_resource} found at #{@init_command}") determine_current_status! # Default to disabled if the service doesn't currently exist - # at all + # at all var_name = service_enable_variable_name if ::File.exists?("/etc/rc.conf") && var_name read_rc_conf.each do |line| @@ -70,19 +70,19 @@ class Chef def define_resource_requirements shared_resource_requirements requirements.assert(:start, :enable, :reload, :restart) do |a| - a.assertion { @rcd_script_found } + a.assertion { @rcd_script_found } a.failure_message Chef::Exceptions::Service, "#{@new_resource}: unable to locate the rc.d script" end - requirements.assert(:all_actions) do |a| - a.assertion { @enabled_state_found } - # for consistentcy with original behavior, this will not fail in non-whyrun mode; + requirements.assert(:all_actions) do |a| + a.assertion { @enabled_state_found } + # for consistentcy with original behavior, this will not fail in non-whyrun mode; # rather it will silently set enabled state=>false - a.whyrun "Unable to determine enabled/disabled state, assuming this will be correct for an actual run. Assuming disabled." + a.whyrun "Unable to determine enabled/disabled state, assuming this will be correct for an actual run. Assuming disabled." end requirements.assert(:start, :enable, :reload, :restart) do |a| - a.assertion { @rcd_script_found && service_enable_variable_name != nil } + a.assertion { @rcd_script_found && service_enable_variable_name != nil } a.failure_message Chef::Exceptions::Service, "Could not find the service name in #{@init_command} and rcvar" # No recovery in whyrun mode - the init file is present but not correct. end @@ -133,7 +133,7 @@ class Chef # corresponding to this service # For example: to enable the service mysql-server with the init command /usr/local/etc/rc.d/mysql-server, you need # to set mysql_enable="YES" in /etc/rc.conf$ - if @rcd_script_found + if @rcd_script_found ::File.open(@init_command) do |rcscript| rcscript.each_line do |line| if line =~ /^name="?(\w+)"?/ diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb index 45b5a21f9b..ba4edc5807 100644 --- a/lib/chef/provider/service/gentoo.rb +++ b/lib/chef/provider/service/gentoo.rb @@ -44,7 +44,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init def define_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/sbin/rc-update") } + a.assertion { ::File.exists?("/sbin/rc-update") } a.failure_message Chef::Exceptions::Service, "/sbin/rc-update does not exist" # no whyrun recovery -t his is a core component whose presence is # unlikely to be affected by what we do in the course of a chef run @@ -52,15 +52,15 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init requirements.assert(:all_actions) do |a| a.assertion { @found_script } - # No failure, just informational output from whyrun + # No failure, just informational output from whyrun a.whyrun "Could not find service #{@new_resource.service_name} under any runlevel" end end - + def enable_service() run_command(:command => "/sbin/rc-update add #{@new_resource.service_name} default") end - + def disable_service() run_command(:command => "/sbin/rc-update del #{@new_resource.service_name} default") end diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb index 09f47e866f..63ba8fa6ab 100644 --- a/lib/chef/provider/service/init.rb +++ b/lib/chef/provider/service/init.rb @@ -47,7 +47,7 @@ class Chef end end end - + def start_service if @new_resource.start_command super diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb index 32152376ee..cb9c28e17e 100644 --- a/lib/chef/provider/service/insserv.rb +++ b/lib/chef/provider/service/insserv.rb @@ -32,9 +32,9 @@ class Chef if Dir.glob("/etc/rc**/S*#{@current_resource.service_name}").empty? @current_resource.enabled false else - @current_resource.enabled true + @current_resource.enabled true end - + @current_resource end diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb index 69a17bb4fb..ee2719d75a 100644 --- a/lib/chef/provider/service/invokercd.rb +++ b/lib/chef/provider/service/invokercd.rb @@ -24,7 +24,7 @@ class Chef class Provider class Service class Invokercd < Chef::Provider::Service::Init - + def initialize(new_resource, run_context) super @init_command = "/usr/sbin/invoke-rc.d #{@new_resource.service_name}" diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb index 629e4ee0c3..06be9f3207 100644 --- a/lib/chef/provider/service/redhat.rb +++ b/lib/chef/provider/service/redhat.rb @@ -48,7 +48,7 @@ class Chef requirements.assert(:start, :enable, :reload, :restart) do |a| a.assertion { !@service_missing } a.failure_message Chef::Exceptions::Service, "#{@new_resource}: unable to locate the init.d script!" - a.whyrun "Assuming service would be disabled. The init script is not presently installed." + a.whyrun "Assuming service would be disabled. The init script is not presently installed." end end @@ -59,7 +59,7 @@ class Chef chkconfig = shell_out!("/sbin/chkconfig --list #{@current_resource.service_name}", :returns => [0,1]) @current_resource.enabled(!!(chkconfig.stdout =~ CHKCONFIG_ON)) @service_missing = !!(chkconfig.stderr =~ CHKCONFIG_MISSING) - end + end @current_resource end diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb index bcb85230d0..288b5f5456 100644 --- a/lib/chef/provider/service/simple.rb +++ b/lib/chef/provider/service/simple.rb @@ -45,8 +45,8 @@ class Chef def shared_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { @status_load_success } + requirements.assert(:all_actions) do |a| + a.assertion { @status_load_success } a.whyrun ["Service status not available. Assuming a prior action would have installed the service.", "Assuming status of not running."] end end @@ -74,12 +74,12 @@ class Chef end requirements.assert(:all_actions) do |a| - a.assertion { @new_resource.status_command or @new_resource.supports[:status] or - (!ps_cmd.nil? and !ps_cmd.empty?) } + a.assertion { @new_resource.status_command or @new_resource.supports[:status] or + (!ps_cmd.nil? and !ps_cmd.empty?) } a.failure_message Chef::Exceptions::Service, "#{@new_resource} could not determine how to inspect the process table, please set this node's 'command.ps' attribute" end - requirements.assert(:all_actions) do |a| - a.assertion { !@ps_command_failed } + requirements.assert(:all_actions) do |a| + a.assertion { !@ps_command_failed } a.failure_message Chef::Exceptions::Service, "Command #{ps_cmd} failed to execute, cannot determine service current status" end end diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb index 33a29da109..4bdb6fbfd1 100644 --- a/lib/chef/provider/service/solaris.rb +++ b/lib/chef/provider/service/solaris.rb @@ -31,7 +31,7 @@ class Chef @init_command = "/usr/sbin/svcadm" @status_command = "/bin/svcs -l" end - + def load_current_resource @current_resource = Chef::Resource::Service.new(@new_resource.name) diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index 59b4fe1564..89077c5feb 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -50,7 +50,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple def define_resource_requirements shared_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { @status_check_success } + a.assertion { @status_check_success } # We won't stop in any case, but in whyrun warn and tell what we're doing. a.whyrun ["Failed to determine status of #{@new_resource}, using command #{@new_resource.status_command}.", "Assuming service would have been installed and is disabled"] @@ -99,11 +99,11 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple def enable_service run_command_with_systems_locale(:command => "/bin/systemctl enable #{@new_resource.service_name}") - end + end def disable_service run_command_with_systems_locale(:command => "/bin/systemctl disable #{@new_resource.service_name}") - end + end def is_active? run_command_with_systems_locale({:command => "/bin/systemctl is-active #{@new_resource.service_name}", :ignore_failure => true}) == 0 diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 763a2aa92b..9ec0f54b43 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -26,7 +26,7 @@ class Chef class Service class Upstart < Chef::Provider::Service::Simple UPSTART_STATE_FORMAT = /\w+ \(?(\w+)\)?[\/ ](\w+)/ - + # Upstart does more than start or stop a service, creating multiple 'states' [1] that a service can be in. # In chef, when we ask a service to start, we expect it to have started before performing the next step # since we have top down dependencies. Which is to say we may follow witha resource next that requires @@ -40,17 +40,17 @@ class Chef # TODO: re-evaluate if this is needed after integrating cookbook fix raise ArgumentError, "run_context cannot be nil" unless run_context super - + run_context.node - + @job = @new_resource.service_name - + if @new_resource.parameters @new_resource.parameters.each do |key, value| @job << " #{key}=#{value}" end end - + platform, version = Chef::Platform.find_platform_and_version(run_context.node) if platform == "ubuntu" && (8.04..9.04).include?(version.to_f) @upstart_job_dir = "/etc/event.d" @@ -60,8 +60,8 @@ class Chef @upstart_conf_suffix = ".conf" end - @command_success = true # new_resource.status_command= false, means upstart used - @config_file_found = true + @command_success = true # new_resource.status_command= false, means upstart used + @config_file_found = true @upstart_command_success = true end @@ -70,18 +70,18 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| if !@command_success - whyrun_msg = @new_resource.status_command ? "Provided status command #{@new_resource.status_command} failed." : + whyrun_msg = @new_resource.status_command ? "Provided status command #{@new_resource.status_command} failed." : "Could not determine upstart state for service" end a.assertion { @command_success } - # no failure here, just document the assumptions made. - a.whyrun "#{whyrun_msg} Assuming service installed and not running." + # no failure here, just document the assumptions made. + a.whyrun "#{whyrun_msg} Assuming service installed and not running." end - requirements.assert(:all_actions) do |a| - a.assertion { @config_file_found } - # no failure here, just document the assumptions made. - a.whyrun "Could not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}. Assuming service is disabled." + requirements.assert(:all_actions) do |a| + a.assertion { @config_file_found } + # no failure here, just document the assumptions made. + a.whyrun "Could not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}. Assuming service is disabled." end end |