Forgive my ignorance: I'm a long time Debian/Ubuntu user and admin, so I'm not up
on all the things everyone might take to be normal.
My goal is to use a python script to get all a systems repositories in a data structure
(list,dict,whatever). I've gotten most of the way there with the below which is able
to get all repositories in /etc/yum.repos.d/*.repo. However, I can't find any
reference to how to also make python3-dnf get the RHEL repositories as well... even though
it is clearly capable of doing so (see below).
Any pointers would be greatly appreciated.
<code>
#!/usr/bin/env python3
import dnf
base = dnf.Base()
base.read_all_repos()
base.fill_sack()
base.fill_sack_from_repos_in_cache()
# This prints all non RHEL repositories ONLY
for repo in base.repos.all():
#print(repo.dump())
print(repo.id)
# This returns an empty list
print(base.repos.get_matching('rhel'))
</code>
Yet... when I use the CLI I do get the rhel repos.
# dnf repolist rhel* | awk '{print $1}'|grep rhel
rhel-x86_64-appstream-8
rhel-x86_64-baseos-8
rhel-x86_64-codeready-builder-8
rhel-x86_64-supplementary-8
Here is what happens when you run the script above.
No rhel repos are returned.
# ~/t.py
elrepo
epel
[] # empty list when using get_matching("rhel")
Cheers,
Phil