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
17 18 19 20 21 22 |
# File 'lib/ilo-sdk/helpers/log_entry_helper.rb', line 17 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
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ilo-sdk/helpers/log_entry_helper.rb', line 39 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
28 29 30 31 |
# File 'lib/ilo-sdk/helpers/log_entry_helper.rb', line 28 def logs_empty?(log_type) response = rest_get("/redfish/v1/Managers/1/LogServices/#{log_type}/Entries/") response_handler(response)['Items'].empty? end |