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

IIB uses opm render #784

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

lipoja
Copy link
Contributor

@lipoja lipoja commented Jan 23, 2025

We agreed to drop opm serve command and move to opm render instead.
This PR adds opm render and removes unused parts of code with opm serve.

[CLOUDDST-25207]

Comment on lines +401 to +410
opm_render_output = run_cmd(
cmd, {'cwd': base_dir}, exc_msg=f'Failed to list bundles on {input_data}'
)

if not opm_render_output:
log.info("There are no bundles in %s", input_data)
return []

log.debug("Parsing data from opm render")
opm_data = [json.loads(package) for package in re.split(r'(?<=})\n(?={)', opm_render_output)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this piece of code is duplicated from get_list_packages. Wouldn't make sense to have a private or lower level function just to do this and share the code between get_list_packages and get_list_bundles?

"""
log.info('Serving data from file-based catalog %s', catalog_dir)
olm_packages = [
json.loads(package) for package in re.split(r'(?<=})\n(?={)', opm_render_output)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity: Any specific reason we're splitting the content between brackets and then loading into json? Couldn't we simply load the JSON list and parse its dictionaries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants