Skip to content

Commit

Permalink
Fixes #37721 - Hammer erratum list output is wrong when using content…
Browse files Browse the repository at this point in the history
…-view filter
  • Loading branch information
sjha4 committed Aug 9, 2024
1 parent f65f4b2 commit e7f8c5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/hammer_cli_katello/erratum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ class ListCommand < HammerCLIKatello::ListCommand
validate_options :before, 'IdResolution' do
organization_options = [:option_organization_id, :option_organization_name, \
:option_organization_label]
environment_options = [:option_environment_name, :option_environment_id]

if option(:option_product_name).exist?
any(*organization_options).required
end

if option(:option_content_view_name).exist?
any(*organization_options).required
end

if option(:option_content_view_id).exist? || option(:option_content_view_name).exist?
any(*environment_options).required
end

Check failure on line 38 in lib/hammer_cli_katello/erratum.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end.
end

build_options do |o|
Expand Down
3 changes: 3 additions & 0 deletions lib/hammer_cli_katello/id_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,14 @@ def repository_ids(options)
def content_view_version_id(options)

Check failure on line 122 in lib/hammer_cli_katello/id_resolver.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Metrics/AbcSize: Assignment Branch Condition size for content_view_version_id is too high. [<17, 35, 13> 41.02/37]

Check failure on line 122 in lib/hammer_cli_katello/id_resolver.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Metrics/CyclomaticComplexity: Cyclomatic complexity for content_view_version_id is too high. [11/10]

Check failure on line 122 in lib/hammer_cli_katello/id_resolver.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Metrics/PerceivedComplexity: Perceived complexity for content_view_version_id is too high. [12/11]
key_id = HammerCLI.option_accessor_name("id")
key_content_view_id = HammerCLI.option_accessor_name("content_view_id")
key_environment_id = HammerCLI.option_accessor_name("environment_id")

from_environment_id = HammerCLI.option_accessor_name("from_environment_id")

return options[key_id] if options[key_id]

options[key_content_view_id] ||= search_and_rescue(:content_view_id, "content_view", options)
options[key_environment_id] ||= search_and_rescue(:environment_id, "environment", options)

results = find_resources(:content_view_versions, options)
options[from_environment_id] ||= from_lifecycle_environment_id(options)
Expand Down

0 comments on commit e7f8c5c

Please sign in to comment.