Skip to content

Load global config if the local one does not exist #3664

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

happz
Copy link
Collaborator

@happz happz commented Apr 14, 2025

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • update the specification
  • adjust plugin docstring
  • modify the json schema
  • mention the version
  • include a release note

@happz happz added area | config User configuration status | blocked The merging of PR is blocked on some other issue status | discuss Needs more discussion before closing status | blocking other work An important pull request, blocking other pull requests or issues labels Apr 14, 2025
@happz happz force-pushed the config-global-path branch from d6b2463 to 2f41080 Compare April 14, 2025 07:54
Comment on lines +98 to +102
except (fmf.utils.FileError, fmf.utils.RootError):
self.logger.debug(f"Config tree not found in user path '{self.user_path}'.")

try:
return (self.global_path, fmf.Tree(self.global_path))
Copy link
Collaborator

Choose a reason for hiding this comment

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

With this, IIUC,global config will only be fetched if self.user_path is Not existed, right?
Think about one scenario:
user do have some setting in user path, but not containing the implementation for boot.method,
with boot.method mr landed, we will broadcast we support boot.method for mrack, but if users put something to users path, they will find boot.method or virtualization.is_support, or anything we are gonna to support would Not work.
Did I miss something? 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, if a user lacks translation for boot.method, but global configuration does have one, it would not be used. But that's on purpose: the user provided their own configuration, and we should use it. Even if we think we have something better in the default one, it's not our decision.

If the user has a HW config in ~/.config/tmt/hardware.fmf, and they lackbeaker.translations key, our MrackHardware.translations should step in become an empty list, and I think there's the missing piece: MrackHardware.translations does not have default factory set, so it needs to be provided by configuration, which is not necessarily happening. I think we should add default factory to HardwareConfig and MrackHardware classes to provide sane but empty defaults if a key is not set.

we will broadcast we support boot.method for mrack, but if users put something to users path, they will find boot.method or virtualization.is_support, or anything we are gonna to support would Not work.

IIUIC, you are worried that we add some new HW transition to our global configuration, but users will miss it because they already have some custom content in their local configuration. That is a valid concern, I do not have the solution yet, but I'd argue it's a different problem for another day - related, but not to be solved by leaking the "local vs default" logic into plugins. Because we will also need some kind of "repository" config, e.g. to disable some lint checks for a given repo, so we are looking at some kind of composition of global aka default, local and in-repo configuration, so that stresses out the effort of not leaking the logic into code that is using Config - must be solved there.

I added the topic to tomorrow's meeting, let's discuss there, but I'm pretty sure I for one do not want "default config" to start appearing in plugins :)

@happz happz removed the status | discuss Needs more discussion before closing label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area | config User configuration status | blocked The merging of PR is blocked on some other issue status | blocking other work An important pull request, blocking other pull requests or issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants