Using $releasever in yum.conf files with dnf

,

I’m having trouble with “releasever” in a yum/dnf config file in:
/etc/yum.repos.d/
I want to append characters to the path created from the substitution of “releasever” as in:

[my-test]
name=My Test $releasever - $basearch
baseurl=https://my.test.com/test/$releasever_Beta/$basearch/os/

When used by dnf, dnf bombs out with a Not Found message indicating the path:

https://my.test.com/test/$releasever_Beta/x86_64/os/

, so it appears the variable is not being substituted. I tried adding single or double quotes around just the $releasever, that part of the path, and the whole path. None of those solved it. Any ideas ?

1 Like

What is the actual url that you are trying to access?

https://my.test.com/test/37_Beta/x86_64/os/

, so releasever=37. This works in other parts of the yum.conf.d/ file, or if it’s the only thing in a /directory/ of the path.

From my end I’d say that the url doesn’t exist. That’s what I seem to get.

https://my.test.com works, but I get no further so I would think that a repo will not work either.

Is Guage providing access to a dnf repo?

Thanks for reading, but to be clear: that URL does not exist, and this is not a question about whether a specific url exists (as I’ve modified it for this post) :wink:

The point is the config file says to use:
/$releasever_Beta/ as part of the path, where $releasever should have the substituted value from dnf (either via the normal method it uses or over-ridden via the dnf command line including --releasever=37)
Instead, dnf is copying that part of the url string without substituting, and hence is creating an incorrect path which is not found on my server.

Note:

  1. repo name in the second line is properly substituted, as printed during the dnf run.
  2. removing “_Beta” from the path, also means dnf properly substitutes “37” in (but isn’t the path I require).

Is there some quoting etc that needs to happen to make dnf happy, so that it does do the substitution ?

The problem is not that releasever is not being substituted, it is that releasever_Beta is not an existing variable. It’s not really documented, but looking at the code, it looks like you can enclose variable names in braces: ${releasever}_Beta

2 Likes

Ah, thanks, that’s sort of like python or rpm -qa --queryformat=“%{name}” variables - makes sense.

We succeeded with the substitution, and the braces are gone, so the dnf actually finds the repo properly :slight_smile:

Thanks for all who read and offered suggestions, and for Elliot for diving into the source code.