Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Workaround missing middleware CLI data
Browse files Browse the repository at this point in the history
for some verbosity levels, middleware CLI doesn't have enough data
compared to the Component Registry, we simply ommit what we don't have
  • Loading branch information
JakubFrejlach committed Jan 23, 2024
1 parent 1ce0916 commit 2b95feb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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).

## Unreleased
### Fixed
* fixed searches with middleware CLI enabled (GRIF-221)


## [0.5.3] - 2024-01-22
### Fixed
Expand All @@ -21,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* --include-root-containers filters on the query (not the output)

### Added
* --filter-rh-naming default value can be set via .griffonrc
* --filter-rh-naming default value can be set via .griffonrc
in default section(GRIG-121)


Expand Down
5 changes: 4 additions & 1 deletion griffon/commands/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ def get_product_contain_component(
# TODO: interim hack for middleware
if component_name and MIDDLEWARE_CLI and not no_middleware:
operation_status.update("searching deptopia middleware.")
ctx.obj["MIDDLEWARE_CLI"] = MIDDLEWARE_CLI

# Use split for users who runs middleware via python
mw_command = [
Expand Down Expand Up @@ -489,7 +490,9 @@ def get_product_contain_component(
{
"name": dep.get("name"),
"nvr": dep.get("nvr"),
"type": dep.get("type"),
"type": dep.get("ecosystem"),
"version": dep.get("version"),
"arch": dep.get("arch"),
}
)
component["sources"] = components
Expand Down
14 changes: 12 additions & 2 deletions griffon/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,18 @@ def text_output_products_contain_component(
width=10000,
no_wrap=no_wrap,
)

# TODO: this is a hack how to fallback to level 3 verbosity
# when using middleware CLI which does not have PURL stuff,
# delete once we stop using middleware CLI completely
middleware_cli_purl_verbose_level = (
ctx.obj["VERBOSE"] > 3
and ctx.obj["MIDDLEWARE_CLI"]
and not ctx.params["no_middleware"]
)

if (
ctx.obj["VERBOSE"] == 3
ctx.obj["VERBOSE"] == 3 or middleware_cli_purl_verbose_level
): # product_stream X root component nvr (type:arch) x child components [ nvr (type:arch)] x related_url x build_source_url # noqa
for pv in result_tree.keys():
for ps in result_tree[pv].keys():
Expand Down Expand Up @@ -926,7 +936,7 @@ def text_output_products_contain_component(
no_wrap=no_wrap,
)
if (
ctx.obj["VERBOSE"] > 3
ctx.obj["VERBOSE"] > 3 and not middleware_cli_purl_verbose_level
): # product_stream X root component purl x child components [ purl ] x related_url x build_source_url # noqa
for pv in result_tree.keys():
for ps in result_tree[pv].keys():
Expand Down

0 comments on commit 2b95feb

Please sign in to comment.