Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRAYSAT-1947: fix sorting warnings in sat showrev #300

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading