Skip to content

Commit

Permalink
Lint fix; ran black
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Raineri <[email protected]>
  • Loading branch information
mraineri committed Jan 23, 2025
1 parent dc11fb0 commit 43b2f90
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions redfish_utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@
"delete_license",
"log_container",
"diagnostic_data_types",
"get_log_service_ids",
"get_log_service",
"get_log_entries",
"print_log_entries",
"clear_log_entries",
Expand Down
5 changes: 4 additions & 1 deletion redfish_utilities/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,14 @@ def get_log_service_ids(context, container_type=log_container.MANAGER, container
# Get the container and check that it has log services
container = context.get(service_root.dict[container_type.value]["@odata.id"] + "/" + container_id)
if "LogServices" not in container.dict:
raise RedfishLogServiceNotFoundError("Container {} does not contain a log services collection".format(container_id))
raise RedfishLogServiceNotFoundError(
"Container {} does not contain a log services collection".format(container_id)
)

# Get the log service collection and iterate through its collection
return container_id, get_collection_ids(context, container.dict["LogServices"]["@odata.id"])


def get_log_service(context, container_type=log_container.MANAGER, container_id=None, log_service_id=None):
"""
Finds a log service matching the given ID and returns its resource
Expand Down
12 changes: 9 additions & 3 deletions scripts/rf_sel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
for manager in manager_ids:
manager, log_service_ids = redfish_utilities.get_log_service_ids(redfish_obj, container_id=manager)
for log_service in log_service_ids:
log_service_resp = redfish_utilities.get_log_service(redfish_obj, container_id=manager, log_service_id=log_service)
log_service_resp = redfish_utilities.get_log_service(
redfish_obj, container_id=manager, log_service_id=log_service
)
if log_service_resp.dict.get("LogEntryType") == "SEL":
match = True
break
Expand All @@ -68,12 +70,16 @@
if args.clear:
# Clear log was requested
print("Clearing the log...")
response = redfish_utilities.clear_log_entries(redfish_obj, container_id=manager, log_service_id=log_service)
response = redfish_utilities.clear_log_entries(
redfish_obj, container_id=manager, log_service_id=log_service
)
response = redfish_utilities.poll_task_monitor(redfish_obj, response)
redfish_utilities.verify_response(response)
else:
# Print log was requested
log_entries = redfish_utilities.get_log_entries(redfish_obj, container_id=manager, log_service_id=log_service)
log_entries = redfish_utilities.get_log_entries(
redfish_obj, container_id=manager, log_service_id=log_service
)
try:
from signal import signal, SIGPIPE, SIG_DFL

Expand Down

0 comments on commit 43b2f90

Please sign in to comment.