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

Override/Merge Repository Configurations Instead of Throwing Error: "Repository is listed more than once in the configuration" #2162

Open
RomanSoloweow opened this issue Nov 21, 2024 · 1 comment
Labels

Comments

@RomanSoloweow
Copy link

Hi,

We are using the latest version of DNF v4.

I have a scenario where myConfig.repo contains a repository configuration, and I want to override some parameters using a separate file, myConfig-override.repo, which has the same repository ID but includes modified parameters. However, when I try this, I encounter the error: "Repository is listed more than once in the configuration".
Is there an option or plugin available in DNF v4 that allows for overriding or merging repository configurations as described?

I noticed that this feature is available in DNF v5, but I cannot use it since not all operating systems I work with support DNF v5 yet.

Thank you for your help!

@evan-goode
Copy link
Member

Hi, I don't think DNF 4 has or will implement something like DNF 5's drop-in repo directories, sorry. From quickly looking around, I don't see a plugin that implements this either, although it may be possible.

However, if you are in a position where you are able to make changes to myConfig.repo, you could allow users to override settings using DNF 4's relatively new variable expansion feature. See https://dnf.readthedocs.io/en/latest/conf_ref.html#repo-variables. For example, you could have:

# /etc/yum.repos.d/myConfig.repo
[myConfig]
name=Example myConfig repo
metalink=https://example.com
enabled=${ENABLE_MY_CONFIG:-1}

enabled will be 1 by default unless ENABLE_MY_CONFIG is set. So if a user wanted to override the default, they could echo 0 > /etc/dnf/vars/ENABLE_MY_CONFIG. Could that help your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants