Skip to content

Commit 4d412ec

Browse files
authored
Merge pull request #765 from stackhpc/dnf-repos-sjpb
remove extra level of key indentation
2 parents 8ad6869 + 4580c2e commit 4d412ec

File tree

9 files changed

+141
-165
lines changed

9 files changed

+141
-165
lines changed

ansible/adhoc/sync-pulp.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
vars:
77
pulp_site_target_arch: "x86_64"
88
pulp_site_target_distribution: "rocky"
9-
pulp_site_target_distribution_version: "{{ dnf_repos_all['baseos'].keys() | map('float') | sort | last }}"
9+
# default distribution to *latest* specified for baseos repo:
10+
pulp_site_target_distribution_version: "{{ dnf_repos_repos['baseos'].keys() | map('float') | sort | last }}"

ansible/library/latest_timestamps.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,17 @@ def run_module():
5252
)
5353

5454
timestamps = dict(module.params['repos_dict'])
55-
for index in timestamps:
56-
for repo in timestamps[index]:
57-
for version in timestamps[index][repo]:
55+
for repo in timestamps:
56+
for version in timestamps[repo]:
5857

59-
html_txt = requests.get(
60-
url= module.params['content_url'] + '/' + timestamps[index][repo][version]['pulp_path']
61-
).text
62-
timestamp_link_list = BeautifulSoup(html_txt,features="html.parser").body.find('pre').find_all() # getting raw list of timestamps from html
63-
timestamp_link_list = map(lambda x: x.string,timestamp_link_list) # stripping xml tags
64-
latest_timestamp = list(timestamp_link_list)[-1][:-1] # last timestamp in list with trailing / removed
65-
timestamps[index][repo][version]['pulp_timestamp'] = latest_timestamp
66-
# timestamps[index] = dict(sorted(timestamps[index]))
67-
68-
69-
result['timestamps'] = timestamps
58+
html_txt = requests.get(
59+
url= module.params['content_url'] + '/' + timestamps[repo][version]['pulp_path']
60+
).text
61+
timestamp_link_list = BeautifulSoup(html_txt,features="html.parser").body.find('pre').find_all() # getting raw list of timestamps from html
62+
timestamp_link_list = map(lambda x: x.string,timestamp_link_list) # stripping xml tags
63+
latest_timestamp = list(timestamp_link_list)[-1][:-1] # last timestamp in list with trailing / removed
64+
timestamps[repo][version]['pulp_timestamp'] = latest_timestamp
65+
result['timestamps'] = dict(sorted(timestamps.items()))
7066

7167
module.exit_json(**result)
7268

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
dnf_repos_default: {} # see environments/common/inventory/group_vars/all/timestamps.yml
2-
dnf_repos_extra: {}
3-
dnf_repos_no_epel: {}
4-
dnf_repos_all: {}
5-
dnf_repos_default_epel: {}
1+
dnf_repos_repos: {} # see environments/common/inventory/group_vars/all/{dnf_repos,timestamps}.yml
62
dnf_repos_pulp_content_url: "{{ appliances_pulp_url }}/pulp/content"
73
dnf_repos_username: "{{ omit }}"
84
dnf_repos_password: "{{ omit }}"

ansible/roles/dnf_repos/tasks/disable_repos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
description: "{{ repo_name }}"
88
enabled: false
99
gpgcheck: false
10-
loop: "{{ dnf_repos_all | dict2items }}"
10+
loop: "{{ dnf_repos_repos | dict2items }}"
1111
loop_control:
1212
label: "{{ repo_name }}[{{ repo_os }}]: {{ repo_values }}"
1313
vars:

ansible/roles/dnf_repos/tasks/set_repos.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
- name: Replace system repos with Pulp repos
3+
- name: Replace non-epel repos with Pulp repos
44
ansible.builtin.yum_repository:
55
file: "{{ repo_values.repo_file }}"
66
name: "{{ repo_name }}"
@@ -9,9 +9,10 @@
99
username: "{{ dnf_repos_username }}"
1010
password: "{{ dnf_repos_password }}"
1111
gpgcheck: false
12-
loop: "{{ dnf_repos_no_epel | dict2items }}"
12+
loop: "{{ dnf_repos_repos | dict2items }}"
1313
loop_control:
1414
label: "{{ repo_name }}[{{ repo_os }}]: {{ repo_values }}"
15+
when: repo_name != 'epel'
1516
vars:
1617
repo_os: "{{ ansible_distribution_version if ansible_distribution_version in item.value else ansible_distribution_major_version }}"
1718
repo_values: "{{ item.value[repo_os] }}"
@@ -32,9 +33,10 @@
3233
username: "{{ dnf_repos_username }}"
3334
password: "{{ dnf_repos_password }}"
3435
gpgcheck: false
35-
loop: "{{ dnf_repos_default_epel | dict2items }}"
36+
loop: "{{ dnf_repos_repos | dict2items }}"
3637
loop_control:
3738
label: "{{ repo_name }}[{{ repo_os }}]: {{ repo_values }}"
39+
when: repo_name == 'epel'
3840
vars:
3941
repo_os: "{{ ansible_distribution_version if ansible_distribution_version in item.value else ansible_distribution_major_version }}"
4042
repo_values: "{{ item.value[repo_os] }}"

ansible/roles/pulp_site/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pulp_site_rpm_repo_defaults:
1818

1919
_pulp_site_rpm_info: |
2020
{{
21-
dnf_repos_all |
21+
dnf_repos_repos |
2222
select_repos(pulp_site_target_distribution_version)
2323
}}
2424
pulp_site_rpm_repos: |

environments/common/files/grafana/grafana.repo.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ ansible_managed | comment }}
22
[grafana]
3-
baseurl = {{ appliances_pulp_url }}/pulp/content/{{ dnf_repos_all['grafana'][ansible_distribution_major_version]['pulp_path'] }}/{{ dnf_repos_all['grafana'][ansible_distribution_major_version]['pulp_timestamp'] }}
3+
baseurl = {{ appliances_pulp_url }}/pulp/content/{{ dnf_repos_repos['grafana'][ansible_distribution_major_version]['pulp_path'] }}/{{ dnf_repos_repos['grafana'][ansible_distribution_major_version]['pulp_timestamp'] }}
44
enabled = 0
55
name = grafana
66
async = 1
Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
dnf_repos_all: "{{ dnf_repos_no_epel | combine(dnf_repos_default_epel) }}"
2-
dnf_repos_no_epel: |
3-
{{ dnf_repos_default['base']
4-
| combine(dnf_repos_default['ohpc'] if (openhpc_install_type | default('ohpc')) == 'ohpc' else {})
5-
| combine(dnf_repos_extra) }}
6-
dnf_repos_default_epel: "{{ dnf_repos_default['epel'] }}"
1+
# dnf_repos_default: see timestamps.yml
72

8-
# see timestamps.yml for dnf_repos_default definition, default repos should be in format
9-
# dnf_repos_default:
10-
# base: # top level keys for internal indexing only, see `dnf_repos_all` and `dnf_repos_no_epel`
11-
# appstream: # yum_repository:name
12-
# '8.10': # ansible_distribution_version or ansible_distribution_major_version
13-
# repo_file: Rocky-AppStream # yum_repository: file
14-
# # repo_name: # optional, override yum_repository:name
15-
# pulp_path: rocky/8.10/AppStream/x86_64/os
16-
# pulp_timestamp: 20250614T013846
17-
# # pulp_content_url: # optional, dnf_repos_pulp_content_url
3+
# override this in environments/site/inventory/group_vars/dnf_repos.yml to add repos:
4+
dnf_repos_extra: {}
185

19-
# Should be in same format as dnf_repos_default, except without the top level indexing keys e.g
20-
# dnf_repos_extra:
21-
# appstream:
22-
# 8.10:
23-
# ...
24-
dnf_repos_extra: {}
6+
# indirection to skip openhpc repos if using alternative slurm:
7+
dnf_repos_skip: "{{ [] if ((openhpc_install_type | default('ohpc') == 'ohpc')) else ['OpenHPC', 'OpenHPC-updates'] }}"
8+
dnf_repos_repos: "{{ dnf_repos_default | combine(dnf_repos_extra) | dict2items | rejectattr('key', 'in', dnf_repos_skip) | items2dict }}"
Lines changed: 114 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,116 @@
11
dnf_repos_default:
2-
base:
3-
Ceph:
4-
'8':
5-
pulp_path: centos/8-stream/storage/x86_64/ceph-quincy
6-
pulp_timestamp: 20231104T015751
7-
repo_file: ceph
8-
'9':
9-
pulp_path: centos/9-stream/storage/x86_64/ceph-reef
10-
pulp_timestamp: 20250617T023108
11-
repo_file: ceph
12-
appstream:
13-
'8.10':
14-
pulp_path: rocky/8.10/AppStream/x86_64/os
15-
pulp_timestamp: 20250614T013846
16-
repo_file: Rocky-AppStream
17-
'9.4':
18-
pulp_path: rocky/9.4/AppStream/x86_64/os
19-
pulp_timestamp: 20241112T003151
20-
repo_file: rocky
21-
'9.5':
22-
pulp_path: rocky/9.5/AppStream/x86_64/os
23-
pulp_timestamp: 20250514T014704
24-
repo_file: rocky
25-
'9.6':
26-
pulp_path: rocky/9.6/AppStream/x86_64/os
27-
pulp_timestamp: 20250816T020215
28-
repo_file: rocky
29-
baseos:
30-
'8.10':
31-
pulp_path: rocky/8.10/BaseOS/x86_64/os
32-
pulp_timestamp: 20250614T013846
33-
repo_file: Rocky-BaseOS
34-
'9.4':
35-
pulp_path: rocky/9.4/BaseOS/x86_64/os
36-
pulp_timestamp: 20241115T011711
37-
repo_file: rocky
38-
'9.5':
39-
pulp_path: rocky/9.5/BaseOS/x86_64/os
40-
pulp_timestamp: 20250513T031844
41-
repo_file: rocky
42-
'9.6':
43-
pulp_path: rocky/9.6/BaseOS/x86_64/os
44-
pulp_timestamp: 20250815T050653
45-
repo_file: rocky
46-
crb:
47-
'8.10':
48-
pulp_path: rocky/8.10/PowerTools/x86_64/os
49-
pulp_timestamp: 20250614T013846
50-
repo_file: Rocky-PowerTools
51-
repo_name: powertools
52-
'9.4':
53-
pulp_path: rocky/9.4/CRB/x86_64/os
54-
pulp_timestamp: 20241115T003133
55-
repo_file: rocky
56-
'9.5':
57-
pulp_path: rocky/9.5/CRB/x86_64/os
58-
pulp_timestamp: 20250514T014704
59-
repo_file: rocky
60-
'9.6':
61-
pulp_path: rocky/9.6/CRB/x86_64/os
62-
pulp_timestamp: 20250815T034418
63-
repo_file: rocky
64-
extras:
65-
'8.10':
66-
pulp_path: rocky/8.10/extras/x86_64/os
67-
pulp_timestamp: 20250510T032327
68-
repo_file: Rocky-Extras
69-
'9.4':
70-
pulp_path: rocky/9.4/extras/x86_64/os
71-
pulp_timestamp: 20241118T002802
72-
repo_file: rocky-extras
73-
'9.5':
74-
pulp_path: rocky/9.5/extras/x86_64/os
75-
pulp_timestamp: 20250506T032818
76-
repo_file: rocky-extras
77-
'9.6':
78-
pulp_path: rocky/9.6/extras/x86_64/os
79-
pulp_timestamp: 20250726T040613
80-
repo_file: rocky-extras
81-
grafana:
82-
'8':
83-
pulp_path: grafana/oss/rpm
84-
pulp_timestamp: 20250730T011314
85-
repo_file: grafana
86-
timestamp: 20250615T005738
87-
'9':
88-
pulp_path: grafana/oss/rpm
89-
pulp_timestamp: 20250730T011314
90-
repo_file: grafana
2+
Ceph:
3+
'8':
4+
pulp_path: centos/8-stream/storage/x86_64/ceph-quincy
5+
pulp_timestamp: 20231104T015751
6+
repo_file: ceph
7+
'9':
8+
pulp_path: centos/9-stream/storage/x86_64/ceph-reef
9+
pulp_timestamp: 20250617T023108
10+
repo_file: ceph
11+
appstream:
12+
'8.10':
13+
pulp_path: rocky/8.10/AppStream/x86_64/os
14+
pulp_timestamp: 20250614T013846
15+
repo_file: Rocky-AppStream
16+
'9.4':
17+
pulp_path: rocky/9.4/AppStream/x86_64/os
18+
pulp_timestamp: 20241112T003151
19+
repo_file: rocky
20+
'9.5':
21+
pulp_path: rocky/9.5/AppStream/x86_64/os
22+
pulp_timestamp: 20250514T014704
23+
repo_file: rocky
24+
'9.6':
25+
pulp_path: rocky/9.6/AppStream/x86_64/os
26+
pulp_timestamp: 20250816T020215
27+
repo_file: rocky
28+
baseos:
29+
'8.10':
30+
pulp_path: rocky/8.10/BaseOS/x86_64/os
31+
pulp_timestamp: 20250614T013846
32+
repo_file: Rocky-BaseOS
33+
'9.4':
34+
pulp_path: rocky/9.4/BaseOS/x86_64/os
35+
pulp_timestamp: 20241115T011711
36+
repo_file: rocky
37+
'9.5':
38+
pulp_path: rocky/9.5/BaseOS/x86_64/os
39+
pulp_timestamp: 20250513T031844
40+
repo_file: rocky
41+
'9.6':
42+
pulp_path: rocky/9.6/BaseOS/x86_64/os
43+
pulp_timestamp: 20250815T050653
44+
repo_file: rocky
45+
crb:
46+
'8.10':
47+
pulp_path: rocky/8.10/PowerTools/x86_64/os
48+
pulp_timestamp: 20250614T013846
49+
repo_file: Rocky-PowerTools
50+
repo_name: powertools
51+
'9.4':
52+
pulp_path: rocky/9.4/CRB/x86_64/os
53+
pulp_timestamp: 20241115T003133
54+
repo_file: rocky
55+
'9.5':
56+
pulp_path: rocky/9.5/CRB/x86_64/os
57+
pulp_timestamp: 20250514T014704
58+
repo_file: rocky
59+
'9.6':
60+
pulp_path: rocky/9.6/CRB/x86_64/os
61+
pulp_timestamp: 20250815T034418
62+
repo_file: rocky
63+
extras:
64+
'8.10':
65+
pulp_path: rocky/8.10/extras/x86_64/os
66+
pulp_timestamp: 20250510T032327
67+
repo_file: Rocky-Extras
68+
'9.4':
69+
pulp_path: rocky/9.4/extras/x86_64/os
70+
pulp_timestamp: 20241118T002802
71+
repo_file: rocky-extras
72+
'9.5':
73+
pulp_path: rocky/9.5/extras/x86_64/os
74+
pulp_timestamp: 20250506T032818
75+
repo_file: rocky-extras
76+
'9.6':
77+
pulp_path: rocky/9.6/extras/x86_64/os
78+
pulp_timestamp: 20250726T040613
79+
repo_file: rocky-extras
80+
grafana:
81+
'8':
82+
pulp_path: grafana/oss/rpm
83+
pulp_timestamp: 20250730T011314
84+
repo_file: grafana
85+
timestamp: 20250615T005738
86+
'9':
87+
pulp_path: grafana/oss/rpm
88+
pulp_timestamp: 20250730T011314
89+
repo_file: grafana
9190
epel:
92-
epel:
93-
'8':
94-
pulp_path: epel/8/Everything/x86_64
95-
pulp_timestamp: 20250615T234151
96-
repo_file: epel
97-
'9':
98-
pulp_path: epel/9/Everything/x86_64
99-
pulp_timestamp: 20250817T000753
100-
repo_file: epel
101-
ohpc:
102-
OpenHPC:
103-
'8':
104-
pulp_path: OpenHPC/2/EL_8
105-
pulp_timestamp: 20241218T154614
106-
repo_file: OpenHPC
107-
'9':
108-
pulp_path: OpenHPC/3/EL_9
109-
pulp_timestamp: 20241218T154614
110-
repo_file: OpenHPC
111-
OpenHPC-updates:
112-
'8':
113-
pulp_path: OpenHPC/2/updates/EL_8
114-
pulp_timestamp: 20250512T003315
115-
repo_file: OpenHPC
116-
'9':
117-
pulp_path: OpenHPC/3/updates/EL_9
118-
pulp_timestamp: 20250510T003301
119-
repo_file: OpenHPC
91+
'8':
92+
pulp_path: epel/8/Everything/x86_64
93+
pulp_timestamp: 20250615T234151
94+
repo_file: epel
95+
'9':
96+
pulp_path: epel/9/Everything/x86_64
97+
pulp_timestamp: 20250817T000753
98+
repo_file: epel
99+
OpenHPC:
100+
'8':
101+
pulp_path: OpenHPC/2/EL_8
102+
pulp_timestamp: 20241218T154614
103+
repo_file: OpenHPC
104+
'9':
105+
pulp_path: OpenHPC/3/EL_9
106+
pulp_timestamp: 20241218T154614
107+
repo_file: OpenHPC
108+
OpenHPC-updates:
109+
'8':
110+
pulp_path: OpenHPC/2/updates/EL_8
111+
pulp_timestamp: 20250512T003315
112+
repo_file: OpenHPC
113+
'9':
114+
pulp_path: OpenHPC/3/updates/EL_9
115+
pulp_timestamp: 20250510T003301
116+
repo_file: OpenHPC

0 commit comments

Comments
 (0)