Skip to content

Commit

Permalink
CRAYSAT-1947: fix sorting warnings in sat showrev
Browse files Browse the repository at this point in the history
(cherry picked from commit 179a57c)
  • Loading branch information
ethanholen-hpe committed Dec 11, 2024
1 parent 0fc63ca commit db9f707
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.33.5] - 2024-12-11

### Fixed
- Fixed sorting warnings in `sat showrev`

## [3.33.4] - 2024-12-11

### Added
Expand Down
18 changes: 12 additions & 6 deletions sat/cli/showrev/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ def do_showrev(args):
# The `showrev` command sets the default of `--sort-by` to None, so we can use that to
# determine if the user explicitly set the value, and use a special default if not.
if args.sort_by is None:
sort_by = ['product_name', 'product_version']
product_sort_by = ['product_name', 'product_version']
other_sort_by = 0
else:
sort_by = args.sort_by
product_sort_by = args.sort_by
other_sort_by = args.sort_by
# report formatting
reverse = args.reverse
no_headings = get_config_value('format.no_headings')
no_borders = get_config_value('format.no_borders')

def append_report(title, headings, data):
def append_report(title, headings, data, sort_by):
"""Create a new Report and add it to the list of reports.
Args:
Expand All @@ -84,6 +86,7 @@ def append_report(title, headings, data):
of the Report
data: A list of tuples where each element is a row to add to
the new Report
sort_by: an item or list of items to sort the report by
Returns:
None. Modifies reports in place.
Expand All @@ -103,7 +106,8 @@ def append_report(title, headings, data):
append_report(
'System Revision Information',
['component', 'data'],
system.get_system_version(args.sitefile)
system.get_system_version(args.sitefile),
other_sort_by
)

if args.release_files:
Expand All @@ -115,14 +119,16 @@ def append_report(title, headings, data):
append_report(
'Product Revision Information',
product_headings,
product_data
product_data,
product_sort_by
)

if args.local:
append_report(
'Local Host Operating System',
['component', 'version'],
local.get_local_os_information()
local.get_local_os_information(),
other_sort_by
)

if not reports:
Expand Down

0 comments on commit db9f707

Please sign in to comment.