Module: ILO_SDK::LogEntryHelper
- Included in:
- Client
- Defined in:
- lib/ilo-sdk/helpers/log_entry_helper.rb
Overview
Contains helper methods for Log Entry actions
Instance Method Summary collapse
-
#clear_logs(log_type) ⇒ Object
Clear the specified logs.
-
#get_logs(severity_level, duration, log_type) ⇒ Object
Get the specified logs.
-
#logs_empty?(log_type) ⇒ TrueClass, FalseClass
Check to see if the specified logs are empty.
Instance Method Details
#clear_logs(log_type) ⇒ Object
Clear the specified logs
19 20 21 22 23 24 |
# File 'lib/ilo-sdk/helpers/log_entry_helper.rb', line 19 def clear_logs(log_type) new_action = { 'Action' => 'ClearLog' } response = rest_post("/redfish/v1/Managers/1/LogServices/#{log_type}/", body: new_action) response_handler(response) true end |
#get_logs(severity_level, duration, log_type) ⇒ Object
Get the specified logs
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ilo-sdk/helpers/log_entry_helper.rb', line 41 def get_logs(severity_level, duration, log_type) response = rest_get("/redfish/v1/Managers/1/LogServices/#{log_type}/Entries/") entries = response_handler(response)['Items'] logs = [] entries.each do |e| if severity_level.nil? logs.push("#{e['Severity']} | #{e['Message']} | #{e['Created']}") if Time.parse(e['Created']) > (Time.now.utc - (duration * 3600)) elsif e['Severity'] == severity_level && Time.parse(e['Created']) > (Time.now.utc - (duration * 3600)) logs.push("#{e['Severity']} | #{e['Message']} | #{e['Created']}") end end logs end |
#logs_empty?(log_type) ⇒ TrueClass, FalseClass
Check to see if the specified logs are empty
30 31 32 33 |
# File 'lib/ilo-sdk/helpers/log_entry_helper.rb', line 30 def logs_empty?(log_type) response = rest_get("/redfish/v1/Managers/1/LogServices/#{log_type}/Entries/") response_handler(response)['Items'].empty? end |