Parent

Included Modules

Class/Module Index [+]

Quicksearch

Chef::Application::WindowsService

Public Instance Methods

service_init() click to toggle source
# File lib/chef/application/windows_service.rb, line 70
def service_init
  reconfigure
  Chef::Log.info("Chef Client Service initialized")
end
service_main(*startup_parameters) click to toggle source
# File lib/chef/application/windows_service.rb, line 75
def service_main(*startup_parameters)

  while running?
    if state == RUNNING
      begin
        # Reconfigure each time through to pick up any changes in the client file
        Chef::Log.info("Reconfiguring with startup parameters")
        reconfigure(startup_parameters)

        splay = rand Chef::Config[:splay]
        Chef::Log.debug("Splay sleep #{splay} seconds")
        sleep splay

        # If we've stopped, then bail out now, instead of going on to run Chef
        next if state != RUNNING

        run_chef_client

        Chef::Log.debug("Sleeping for #{Chef::Config[:interval]} seconds")
        client_sleep Chef::Config[:interval]
      rescue Chef::Application::Wakeup => e
        Chef::Log.debug("Received Wakeup signal.  Starting run.")
        next
      rescue SystemExit => e
        raise
      rescue Exception => e
        Chef::Log.error("#{e.class}: #{e}")
        Chef::Application.debug_stacktrace(e)
        Chef::Log.error("Sleeping for #{Chef::Config[:interval]} seconds before trying again")
        client_sleep Chef::Config[:interval]
        retry
      end
    else # PAUSED or IDLE
      sleep 5
    end
  end
end
service_pause() click to toggle source
# File lib/chef/application/windows_service.rb, line 121
def service_pause
  Chef::Log.info("SERVICE_CONTROL_PAUSE received, pausing")
end
service_resume() click to toggle source
# File lib/chef/application/windows_service.rb, line 125
def service_resume
  Chef::Log.info("SERVICE_CONTROL_CONTINUE received, resuming")
end
service_shutdown() click to toggle source
# File lib/chef/application/windows_service.rb, line 129
def service_shutdown
  Chef::Log.info("SERVICE_CONTROL_SHUTDOWN received, shutting down")
end
service_stop() click to toggle source

Control Signal Callback Methods

# File lib/chef/application/windows_service.rb, line 117
def service_stop
  Chef::Log.info("SERVICE_CONTROL_STOP received, stopping")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.