rpm-software-management / dnf

Package manager based on libdnf and libsolv. Replaces YUM.
GNU General Public License v2.0
1.21k stars 404 forks source link

Dnf doesn't pick up credentials stored in dnf.conf #2036

Open ashuk2000 opened 6 months ago

ashuk2000 commented 6 months ago

So I have a yml file where repo info is configured.

` version: '2' mpp-vars: distro_name: rhivos distro_copr_tree: epel distro_version: 9 distro_baseurl: https://qartifactory.com/ER4 distro_baseurl_repo: $distro_baseurl/RHIVOS/$arch/os/ distro_repos:

This repo needs a username and password to be accessed which I have provided in /etc/dnf/dnf.conf

[qartifactory] baseurl=https://qartifactory.com/ER4/RHIVOS/aarch64/os name=rhivos username=dummy-username password=dummy-password

but when I build the image dnf gives error saying can't download the metadata,

if I embed the credentials in the url itself and put that in the yaml file it works fine. But I don't want to hardcode credentials in the yml

What am I doing wrong

jrohel commented 2 weeks ago

yml file? Is this for another application that generates the configuration for DNF?

DNF configuration - the /etc/dnf/dnf.conf file looks fine at first glance. I don't see the enabled option there, so it uses the value from the global configuration and it is true (unless overridden for example in the main section). A repository with the id qartifactory should use the specified username and password.

I am wondering if there is a problem with some character in the name or password. I don't know what characters were used. At the very least, the ':' character cannot be used in the username option.

jrohel commented 2 weeks ago

I can't preproduce the problem. Username and password are used from "dnf.conf". However, I created an issue for a problem with : in username https://github.com/rpm-software-management/libdnf/issues/1669 .

ashuk2000 commented 2 weeks ago

Hi, the Yml file is part of automotive sample images https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/blob/main/distro/autosd.ipp.yml?ref_type=heads

Anyways the issue is seen giving username and password both in yml file and /etc/dnf/dnf.conf. As the sample images too somehow uses dnf internally

And yes the username does contain a : I guess thats the issue

jrohel commented 2 weeks ago

@ashuk2000 Hello. Is it possible to change the username to not contain a colon? At least to test if it's the only problem.