Skip to content

Commit caa892c

Browse files
authored
facts/yum+dnf+zypper: return repoid in repository facts
1 parent c557b99 commit caa892c

File tree

8 files changed

+25
-11
lines changed

8 files changed

+25
-11
lines changed

pyinfra/facts/dnf.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ class DnfRepositories(FactBase):
1616
1717
[
1818
{
19-
"name": "CentOS-$releasever - Apps",
20-
"baseurl": "http://mirror.centos.org/$contentdir/$releasever/Apps/$basearch/os/",
21-
"gpgcheck": "1",
19+
"repoid": "baseos",
20+
"name": "AlmaLinux $releasever - BaseOS",
21+
"mirrorlist": "https://mirrors.almalinux.org/mirrorlist/$releasever/baseos",
2222
"enabled": "1",
23-
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial",
23+
"gpgcheck": "1",
24+
"countme": "1",
25+
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9",
26+
"metadata_expire": "86400",
27+
"enabled_metadata": "1"
2428
},
2529
]
2630
"""

pyinfra/facts/util/packaging.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def _parse_yum_or_zypper_repositories(output):
3232
repos.append(current_repo)
3333
current_repo = {}
3434

35+
current_repo["repoid"] = line[1:-1]
3536
current_repo["name"] = line[1:-1]
3637

3738
if current_repo and "=" in line:

pyinfra/facts/yum.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ class YumRepositories(FactBase):
1616
1717
[
1818
{
19-
"name": "CentOS-$releasever - Apps",
20-
"baseurl": "http://mirror.centos.org/$contentdir/$releasever/Apps/$basearch/os/",
21-
"gpgcheck": "1",
19+
"repoid": "baseos",
20+
"name": "AlmaLinux $releasever - BaseOS",
21+
"mirrorlist": "https://mirrors.almalinux.org/mirrorlist/$releasever/baseos",
2222
"enabled": "1",
23-
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial",
23+
"gpgcheck": "1",
24+
"countme": "1",
25+
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9",
26+
"metadata_expire": "86400",
27+
"enabled_metadata": "1"
2428
},
2529
]
2630
"""

pyinfra/facts/zypper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class ZypperRepositories(FactBase):
1616
1717
[
1818
{
19+
"repoid": "repo-oss",
1920
"name": "Main Repository",
2021
"enabled": "1",
21-
"autorefresh": "0",
22-
"baseurl": "http://download.opensuse.org/distribution/leap/$releasever/repo/oss/",
23-
"type": "rpm-md",
22+
"autorefresh": "1",
23+
"baseurl": "http://download.opensuse.org/distribution/leap/$releasever/repo/oss/"
2424
},
2525
]
2626
"""

tests/facts/dnf.DnfRepositories/repos-with-spaces.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
],
88
"fact": [
99
{
10+
"repoid": "rhel-atomic-7-cdk-3.6-source-rpms",
1011
"name": "Red Hat Container Development Kit 3.6 /(Source RPMs)"
1112
}
1213
]

tests/facts/dnf.DnfRepositories/repos.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
],
1111
"fact": [
1212
{
13+
"repoid": "somerepo",
1314
"name": "somerepo",
1415
"baseurl": "abc"
1516
},
1617
{
18+
"repoid": "anotherrepo",
1719
"name": "anotherrepo"
1820
}
1921
]

tests/facts/yum.YumRepositories/repos.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
],
1111
"fact": [
1212
{
13+
"repoid": "somerepo",
1314
"name": "somerepo",
1415
"baseurl": "abc"
1516
}

tests/facts/zypper.ZypperRepositories/repos.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
],
1111
"fact": [
1212
{
13+
"repoid": "somerepo",
1314
"name": "somerepo",
1415
"baseurl": "abc"
1516
}

0 commit comments

Comments
 (0)