-
Notifications
You must be signed in to change notification settings - Fork 87
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
Clear yum cache before any yum call #398
Clear yum cache before any yum call #398
Conversation
Looking through the code we don't seem to mess with anything related to repos or pkg manager before the checks start to take place. I think that just moving the function at the top of the checks should do the trick. @SpyTec, do you think we should rewrite this function to not be a check, but rather, do this as a special operation of cleaning/making cache? Then this Something like this (this is just an example): https://gist.github.com/r0x0d/f645a1f7b005ee96e9421954e27528db |
@r0x0d That would be out of scope for the issue and can instead be tackled in OAMG-5570. For this PR we should just move it to be in the beginning. We also need to do more verification to make sure using repolist will work for us and be faster |
Gotcha! I will upload this gist to OAMG-5570 in case anyone in the future wants to work on that and they can take a look at this prototype of implementation. |
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.
The main goal of this change should be making sure that the yum cache is up-to-date before we start doing some checks - especially the check whether the installed packages including kernel are up-to-date (handled bycheck_package_updates()
). We can do that by clearing the yum cache. That's what we do already in the function for checking whether custom repos used by the customer are accessible: https://github.com/oamg/convert2rhel/blob/v0.25/convert2rhel/checks.py#L165.
However this cache cleaning happens only when custom repos are used (--no-rhsm option is used). Yet we need to clean the cache every time - because the check_package_updates()
is called every time.
There's a disadvantage of performing the cache cleaning every time though - rebuilding the cache takes long (minutes). But we don't currently have a better/faster way of making sure the yum cash is up-to-date. We can try speeding it up in a subsequent PR.
@bocekm you think that this draft I made for the PR could solve the issue? https://gist.github.com/r0x0d/f645a1f7b005ee96e9421954e27528db We could also include a command (or environment var) like What do you guys think? |
Feel free to introduce the change from the gist to this PR, so that we can do the review using the github tools like code line comments and suggestions.
Yeah, it'd be useful to have for development purposes. But only for that. We can't get any guarantee on that from the user. For that reason I'd introduce env var like Ccing @abadger. |
877cb22
to
8d67280
Compare
d30ffab
to
eee495a
Compare
eee495a
to
0760283
Compare
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.
Approved. Waiting on an integration test.
/packit test |
1 similar comment
/packit test |
Fixing the conflicts |
0760283
to
52141e1
Compare
Codecov Report
@@ Coverage Diff @@
## main #398 +/- ##
==========================================
+ Coverage 87.67% 89.25% +1.58%
==========================================
Files 17 17
Lines 2458 2466 +8
Branches 425 426 +1
==========================================
+ Hits 2155 2201 +46
+ Misses 241 203 -38
Partials 62 62
Continue to review full report at Codecov.
|
730eaab
to
6ea9ff0
Compare
Hi @r0x0d !
Could you please look into it? |
9a9b860
to
d299bc9
Compare
Rebased. |
check_custom_repos_are_valid
before any other checks
Fixed the unit_test for centos7 |
The failing integration tests are caused by incorrect cleanup in one of our tests. The fix for that is introduced here: 41fbb29 |
This change intends to call the `check_custom_repos_are_valid` function as the first thing before any other checks. The reason for that is we can guarantee that we will work with the most recent cache for `yum`/`dnf`. Jira reference (If any): https://issues.redhat.com/browse/OAMG-6294 Bugzilla reference (If any):
Signed-off-by: Rodolfo Olivieri <[email protected]>
Signed-off-by: Rodolfo Olivieri <[email protected]>
Signed-off-by: Rodolfo Olivieri <[email protected]>
Signed-off-by: Rodolfo Olivieri <[email protected]>
Signed-off-by: Rodolfo Olivieri <[email protected]>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Signed-off-by: Rodolfo Olivieri <[email protected]>
b57a65d
to
421b930
Compare
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.
One little nitpick otherwise it works and looks good.
Co-authored-by: Michal Bocek <[email protected]>
/packit retest-failed |
tests/integration/tier0/basic-sanity-checks/test_basic_sanity_checks.py
Outdated
Show resolved
Hide resolved
tests/integration/tier0/basic-sanity-checks/test_basic_sanity_checks.py
Outdated
Show resolved
Hide resolved
I have run basic_sanity_checks with fixes from 41fbb29 and #398 (comment) |
…checks.py Co-authored-by: Daniel Diblik <[email protected]>
…checks.py Co-authored-by: Daniel Diblik <[email protected]>
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.
LGTM! Thank you @kokesak
This change intends to call the
check_custom_repos_are_valid
functionas the first thing before any other checks. The reason for that is we
can guarantee that we will work with the most recent cache for
yum
/dnf
.Jira reference (If any): RHELC-251
Bugzilla reference (If any):