-
Notifications
You must be signed in to change notification settings - Fork 24
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
CLOUDDST-24254 : Merge index image failing with FBC operator present … #808
base: master
Are you sure you want to change the base?
CLOUDDST-24254 : Merge index image failing with FBC operator present … #808
Conversation
c0ee208
to
b803aa2
Compare
083f509
to
1b1b5de
Compare
iib/workers/tasks/utils.py
Outdated
@@ -1265,3 +1265,31 @@ def get_bundle_metadata( | |||
for pullspec in operator_csv.get_pullspecs(): | |||
bundle_metadata['found_pullspecs'].add(pullspec) | |||
return bundle_metadata | |||
|
|||
|
|||
def filter_deprecation_operator_from_db( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking about this name - if I did not know more I would think that the function will filter out the operators from DB (that it will remove them from DB) but we want to get only list of operators present in DB.
what about something like get_operators_present_in_db
or filter_operators_present_in_db
or just filter_operators
?
@chandwanitulsi is good with naming :) maybe she could suggest something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going with filter_operators_present_in_db
:param str temp_dir: temp directory where opm will be executed | ||
|
||
:return: A List of operator bundle to be deprecated | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing :rtype: list(str)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the catch.
iib/workers/tasks/utils.py
Outdated
filter(lambda bundlepath: bundlepath in available_bundlepaths, deprecation_bundles) | ||
) | ||
|
||
log.info(f"Deprecation bundle after filter is : {deprecation_bundles}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For logging we should not use f-string formatting but %s
notation because logging lib is optimized for it.
https://docs.python.org/3/howto/logging-cookbook.html#formatting-styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, will reflect in next push.
iib/workers/tasks/utils.py
Outdated
bundles_list = get_list_bundles(index_db_file, temp_dir) | ||
|
||
available_bundlepaths = [] | ||
for bundle in bundles_list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do the filtering in one cycle? Something like:
available_bundlepaths = [
bundle["bundlePath"] for bundle in bundles_list if bundle["bundlePath"] in deprecation_bundles
]
then just log and return available_bundlepaths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed, will reflect in next push.
|
||
|
||
@mock.patch('iib.workers.tasks.utils.get_list_bundles') | ||
def test_no_matching_filter_deprecation_operator_from_db_(mock_bundle_list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra _
at the end of name test_no_matching_filter_deprecation_operator_from_db_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed, will reflect in next push.
] | ||
|
||
deprecation_bundles = [ | ||
"op1@sha", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think you could add "op3@sha",
here as well?
The result should be the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes unittest more specific, so I thought of not testing both cases in single unitest.
] | ||
|
||
deprecation_bundles = [ | ||
"op3@sha", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this tests if we include this in the previous one?
…in source This commit fix this bug by ignoring deprecation operators which are not available in database.
1b1b5de
to
a2c2e17
Compare
This commit fix this bug by ignoring deprecation operators which are not available in database.
@release-engineering/exd-guild-hello-operator