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

Commit

Permalink
Fix filtering middleware data
Browse files Browse the repository at this point in the history
* consider all middleware data retrieved by middleware CLI active
* delegate maven build type filter to middleware CLI
  • Loading branch information
JakubFrejlach committed Dec 8, 2023
1 parent 50794d3 commit fa14c84
Showing 1 changed file with 42 additions and 34 deletions.
76 changes: 42 additions & 34 deletions griffon/commands/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,15 @@ def get_product_contain_component(
operation_status.update("searching deptopia middleware.")

# Use split for users who runs middleware via python
mw_command = [*MIDDLEWARE_CLI.split(), component_name, "-e", "maven", "--json"]
mw_command = [
*MIDDLEWARE_CLI.split(),
component_name,
"-e",
"maven",
"-b",
"maven",
"--json",
]
if strict_name_search:
mw_command.append("-s")
proc = subprocess.run(
Expand All @@ -421,39 +429,39 @@ def get_product_contain_component(
# if search_all:
# mw_components.extend(mw_json["deps"])
for build in mw_components:
if build["build_type"] == "maven":
component = {
"product_versions": [{"name": build["ps_module"]}],
"product_streams": [
{
"name": build["ps_update_stream"],
"product_versions": [{"name": build["ps_module"]}],
}
],
"product_active": True,
"type": build["build_type"],
"name": build["build_name"],
"nvr": build["build_nvr"],
"upstreams": [],
"sources": [],
"software_build": {
"build_id": build["build_id"],
"source": build["build_repo"],
},
}
if "sources" in build:
for deps in build["sources"]:
for dep in deps["dependencies"]:
components = []
components.append(
{
"name": dep.get("name"),
"nvr": dep.get("nvr"),
"type": dep.get("type"),
}
)
component["sources"] = components
q.append(component)
component = {
"product_versions": [{"name": build["ps_module"]}],
"product_streams": [
{
"name": build["ps_update_stream"],
"product_versions": [{"name": build["ps_module"]}],
"active": True, # assume all product streams as active
}
],
"product_active": True,
"type": build["build_type"],
"name": build["build_name"],
"nvr": build["build_nvr"],
"upstreams": [],
"sources": [],
"software_build": {
"build_id": build["build_id"],
"source": build["build_repo"],
},
}
if "sources" in build:
for deps in build["sources"]:
for dep in deps["dependencies"]:
components = []
components.append(
{
"name": dep.get("name"),
"nvr": dep.get("nvr"),
"type": dep.get("type"),
}
)
component["sources"] = components
q.append(component)
except Exception:
logger.warning("problem accessing deptopia.")

Expand Down

0 comments on commit fa14c84

Please sign in to comment.