def load_current_resource
@current_resource = Chef::Resource::Service.new(@new_resource.name)
@current_resource.service_name(@new_resource.service_name)
status = IO.popen("#{@init_command} query #{@new_resource.service_name}").entries
raise Chef::Exceptions::Exec, "Service #{@new_resource.service_name} does not exist.\n#{status.join}\n" if status[0].include?("FAILED 1060")
begin
started = status[3].include?("4")
@current_resource.running started
start_type = IO.popen("#{@init_command} qc #{@new_resource.service_name}").entries[4]
@current_resource.enabled(start_type.include?('2') || start_type.include?('3') ? true : false)
Chef::Log.debug "#{@new_resource}: running: #{@current_resource.running}"
rescue StandardError
raise Chef::Exceptions::Exec
rescue Chef::Exceptions::Exec
Chef::Log.debug "Failed to determine the current status of the service, assuming it is not running"
@current_resource.running false
nil
end
@current_resource
end