-
Notifications
You must be signed in to change notification settings - Fork 75
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
Prefer the 'apt_pkg' module over 'apt' (SC-1516) #2744
Conversation
Jira: SC-1516 GitHub Issues: No GitHub issues are fixed by this PR. (No commits have Fixes: #### references) Launchpad Bugs: No Launchpad bugs are fixed by this PR. (No commits have LP: #### references) Documentation: The changes in this PR do not require documentation changes. 👍 this comment to confirm that this is correct. |
c77b2b7
to
a6448c9
Compare
a95a39d
to
594cfe4
Compare
|
25ab041
to
e538dc7
Compare
CI Failures unrelated - a cloud timeout and #2756 |
e538dc7
to
2b255ed
Compare
I'll try to have a look tomorrow |
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.
Great refactor +1
Just one small nit
8147015
to
7274b6d
Compare
Signed-off-by: Renan Rodrigo <[email protected]>
Signed-off-by: Renan Rodrigo <[email protected]>
Remove the global mock and install python-apt from source. This way we can have access to the 'apt' and 'apt_pkg' modules during test execution. This revealed a fixture we missed on the apt update functionality and some mypy complains we could have addressed, and simplified a couple tests. Signed-off-by: Renan Rodrigo <[email protected]>
Signed-off-by: Renan Rodrigo <[email protected]>
Signed-off-by: Renan Rodrigo <[email protected]>
As we are not creating the cache using the apt module anymore, a new helper function is needed to ensure the structure is there before we set up the sources.list files Signed-off-by: Renan Rodrigo <[email protected]>
Signed-off-by: Renan Rodrigo <[email protected]>
Signed-off-by: Renan Rodrigo <[email protected]>
Also fix a unit test that was passing based on luck Signed-off-by: Renan Rodrigo <[email protected]>
It is more resilient now, but we can log success and failure using the AcquireProgress object Signed-off-by: Renan Rodrigo <[email protected]>
Instead of performing the check at the module level, we decorate the functions that use the module without instantiating a Cache object (in the Cache case, we initialize apt_pkg separately) Signed-off-by: Renan Rodrigo <[email protected]>
7274b6d
to
2498ff2
Compare
@julian-klode we need to merge for the release, but any further review or comment is welcome - we can address those in next iteration |
Why is this needed?
This PR solves all of our problems because we are trying to standardize the use of
python3-apt
through the codebase. After some discussions with @julian-klode in the past, we have decided to stick toapt_pkg
instead ofapt
when possible, so we would:apt
is breaking our isolation of configuration, given that we are responsible for the esm-apt instanceapt_pkg
capabilities.Test Steps
This is just a medium-size refactor; no new features introduced, so CI should pass without major changes (although adjustments in unit tests were of course needed because we still test some implementation details and isolation is not 100%)
It is possible to verify performance gains, maybe where it is more impactful: run
pro security-status
on an updated unattached bionic (any release, really) machine both with and without this patch and compare the differences.Checklist
Does this PR require extra reviews?