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

mgr-inter-sync command fix config clear cache #7588

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

tanganellilore
Copy link
Contributor

What does this PR change?

In mgr-inter-sync if we use --iss-parent or if we missing to add iss_parent on rhn.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 everytime self.__component is None and timeDiff is not 0, 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 and parse function clear everything in the self.__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 component server.satellite, defined by mgr-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 dedicated if, that wrap the check of timeDiff.
So:

  1. in case of component not initialized (like component=None or any other component), we simply to load the config from disk
  2. in case of component already initialized, we check if file was changed
    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

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

  • DONE

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:

  • No changelog needed

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:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

@tanganellilore tanganellilore requested a review from a team as a code owner September 26, 2023 16:17
@tanganellilore tanganellilore requested review from ycedres and removed request for a team September 26, 2023 16:17
@tanganellilore
Copy link
Contributor Author

probably also resolve this issue
#5522

@mbussolotto
Copy link
Member

according to #7565 , the PR is fine and fix the issue (not sure about #5522 )

Copy link
Contributor

@cbosdo cbosdo left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks a lot for fixing this issue.

@cbosdo cbosdo merged commit 1ba094f into uyuni-project:master Oct 2, 2023
7 checks passed
@tanganellilore tanganellilore deleted the fix_clear_cache_config branch February 23, 2024 13:12
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.

3 participants