mgr-inter-sync command fix config clear cache #7588
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR change?
In
mgr-inter-sync
if we use--iss-parent
or if we missing to addiss_parent
onrhn.conf
, configuration passed or retrived from DB will be used only for some functions, not for whole run of the script.A issue that highlight this is this one:
#7565
This PR will fix this behavior, that is generated by calculation of initialized component and
timeDiff
in same line.Actually,
self.__config
will be cleared everytimeself.__component
isNone
andtimeDiff
is not0
, so everytime we have new component, we simply delete all config already loaded.This probably was introduced with the new method
with cfg_component(component=None)
that for example is used internally. Calling this we simply define new component=None andparse
function clear everything in theself.__config
creating a "sort of loop", because net time that arrive with new component, this will clear everything.This explain why we have this error on linked issue, because in that case we simply reload the
rhn.conf
for componentserver.satellite
, defined bymgr-inter-sync
command, instead use what was extracted from DB or passed by command line.This PR simply move out the
self.is_initialized()
in a dedicatedif
, that wrap the check oftimeDiff
.So:
a. if not, we
return
b. if yes, we clear
self.__config
I have some doubpts related clear everything, becase this can broke something that is setted by OPTIONS or command line, but I don't know the logic behind this code, so I leave it as is (I have in mind some method to "merge" what is cached with what is changed in a file, but I prefer for now maintain as is)
I also evaluated some differents approach but this is the simplest with less code changed
GUI diff
No difference.
Documentation
No documentation needed: add explanation. This can't be used if there is a GUI diff
No documentation needed: only internal and user invisible changes
Documentation issue was created: Link for SUSE Manager contributors, Link for community contributors.
API documentation added: please review the Wiki page Writing Documentation for the API if you have any changes to API documentation.
(OPTIONAL) Documentation PR
DONE
Test coverage
No tests: add explanation
No tests: already covered
Unit tests were added
Cucumber tests were added
DONE
Links
Fixes #
Tracks # add downstream PR, if any
Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
If you uncheck the checkbox after the PR is created, you will need to re-run
changelog_test
(see below)Re-run a test
If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run: