|
64 | 64 | register: pulp_rpm_dists_list |
65 | 65 |
|
66 | 66 | - vars: |
67 | | - repo: "{{ pulp_deb_repos_list.repositories | selectattr('name', 'equalto', item.repository) | first }}" |
68 | | - pub: "{{ (pulp_deb_pubs_list.publications + pulp_deb_verbatim_pubs_list.publications) | selectattr('repository', 'equalto', repo.pulp_href) | stackhpc.pulp.sort_publications |
69 | | - | first }}" |
70 | | - dist: "{{ pulp_deb_dists_list.distributions | selectattr('publication', 'equalto', pub.pulp_href) | first }}" |
| 67 | + repo_list: >- |
| 68 | + {{ pulp_deb_repos_list.repositories |
| 69 | + | selectattr('name', 'equalto', item.repository) |
| 70 | + | list }} |
| 71 | + repo: "{{ repo_list[0] if (repo_list | length > 0) else {} }}" |
| 72 | + pubs: >- |
| 73 | + {{ (pulp_deb_pubs_list.publications + pulp_deb_verbatim_pubs_list.publications) |
| 74 | + | selectattr('repository', 'equalto', repo.get('pulp_href', '')) |
| 75 | + | stackhpc.pulp.sort_publications | list }} |
| 76 | + pub: "{{ pubs[0] if (pubs | length > 0) else {} }}" |
| 77 | + base_name: "{{ item.name | regex_replace('-[0-9]{8}T[0-9]{6}$', '') }}" |
| 78 | + safe_pattern: "^{{ base_name | regex_escape }}(-[0-9]{8}T[0-9]{6})?$" |
| 79 | + existing_dists: >- |
| 80 | + {{ pulp_deb_dists_list.distributions |
| 81 | + | selectattr('publication', 'equalto', pub.get('pulp_href', '')) |
| 82 | + | selectattr('name', 'match', safe_pattern) |
| 83 | + | list }} |
| 84 | + dist: "{{ existing_dists[0] if (existing_dists | length > 0) else {} }}" |
71 | 85 |
|
72 | 86 | block: |
| 87 | + - name: Ensure Deb distributions exist for latest publication |
| 88 | + pulp.squeezer.deb_distribution: |
| 89 | + pulp_url: "{{ pulp_url }}" |
| 90 | + username: "{{ pulp_username }}" |
| 91 | + password: "{{ pulp_password }}" |
| 92 | + name: "{{ item.name }}" |
| 93 | + base_path: "{{ item.base_path }}" |
| 94 | + publication: "{{ pub.get('pulp_href') }}" |
| 95 | + content_guard: "{{ item.content_guard | default(omit) }}" |
| 96 | + state: present |
| 97 | + loop: "{{ dev_pulp_distribution_deb }}" |
| 98 | + loop_control: |
| 99 | + label: "{{ item.repository }}" |
| 100 | + when: (pub | length > 0) and (existing_dists | length == 0) |
| 101 | + |
| 102 | + - name: Re-query Deb distributions (to capture newly created ones) |
| 103 | + pulp.squeezer.deb_distribution: |
| 104 | + pulp_url: "{{ pulp_url }}" |
| 105 | + username: "{{ pulp_username }}" |
| 106 | + password: "{{ pulp_password }}" |
| 107 | + register: pulp_deb_dists_list |
| 108 | + |
73 | 109 | - name: Display latest Deb distributions |
74 | 110 | vars: |
75 | 111 | info: |
|
81 | 117 | loop: "{{ dev_pulp_distribution_deb }}" |
82 | 118 | loop_control: |
83 | 119 | label: "{{ item.repository }}" |
| 120 | + when: pub | length > 0 |
84 | 121 |
|
85 | 122 | - name: Set a fact about latest Deb versions |
86 | 123 | ansible.builtin.set_fact: |
87 | | - test_pulp_repository_deb_repo_versions: "{{ test_pulp_repository_deb_repo_versions | default({}) | combine({item.short_name: dist.base_path | basename}) |
88 | | - }}" |
| 124 | + test_pulp_repository_deb_repo_versions: >- |
| 125 | + {{ test_pulp_repository_deb_repo_versions |
| 126 | + | default({}) |
| 127 | + | combine({item.short_name: dist.base_path | basename}) }} |
89 | 128 | loop: "{{ dev_pulp_distribution_deb }}" |
90 | 129 | loop_control: |
91 | 130 | label: "{{ item.repository }}" |
| 131 | + when: dist | length > 0 |
92 | 132 |
|
93 | 133 | - name: Display latest versions fact |
94 | 134 | ansible.builtin.debug: |
95 | 135 | var: test_pulp_repository_deb_repo_versions |
| 136 | + |
96 | 137 | - vars: |
97 | | - repo: "{{ pulp_rpm_repos_list.repositories | selectattr('name', 'equalto', item.repository) | first }}" |
98 | | - pub: "{{ pulp_rpm_pubs_list.publications | selectattr('repository', 'equalto', repo.pulp_href) | stackhpc.pulp.sort_publications | first }}" |
99 | | - dist: "{{ pulp_rpm_dists_list.distributions | selectattr('publication', 'equalto', pub.pulp_href) | first }}" |
| 138 | + repo_list: >- |
| 139 | + {{ pulp_rpm_repos_list.repositories |
| 140 | + | selectattr('name', 'equalto', item.repository) |
| 141 | + | list }} |
| 142 | + repo: "{{ repo_list[0] if (repo_list | length > 0) else {} }}" |
| 143 | + pubs: >- |
| 144 | + {{ pulp_rpm_pubs_list.publications |
| 145 | + | selectattr('repository', 'equalto', repo.get('pulp_href', '')) |
| 146 | + | stackhpc.pulp.sort_publications | list }} |
| 147 | + pub: "{{ pubs[0] if (pubs | length > 0) else {} }}" |
| 148 | + base_name: "{{ item.name | regex_replace('-[0-9]{8}T[0-9]{6}$', '') }}" |
| 149 | + safe_pattern: "^{{ base_name | regex_escape }}(-[0-9]{8}T[0-9]{6})?$" |
| 150 | + existing_dists: >- |
| 151 | + {{ pulp_rpm_dists_list.distributions |
| 152 | + | selectattr('publication', 'equalto', pub.get('pulp_href', '')) |
| 153 | + | selectattr('name', 'match', safe_pattern) |
| 154 | + | list }} |
| 155 | + dist: "{{ existing_dists[0] if (existing_dists | length > 0) else {} }}" |
| 156 | + |
100 | 157 | block: |
| 158 | + - name: Ensure RPM distributions exist for latest publication |
| 159 | + pulp.squeezer.rpm_distribution: |
| 160 | + pulp_url: "{{ pulp_url }}" |
| 161 | + username: "{{ pulp_username }}" |
| 162 | + password: "{{ pulp_password }}" |
| 163 | + name: "{{ item.name }}" |
| 164 | + base_path: "{{ item.base_path }}" |
| 165 | + publication: "{{ pub.get('pulp_href') }}" |
| 166 | + content_guard: "{{ item.content_guard | default(omit) }}" |
| 167 | + state: present |
| 168 | + loop: "{{ dev_pulp_distribution_rpm }}" |
| 169 | + loop_control: |
| 170 | + label: "{{ item.repository }}" |
| 171 | + when: (pub | length > 0) and (existing_dists | length == 0) |
| 172 | + |
| 173 | + - name: Re-query RPM distributions (to capture newly created ones) |
| 174 | + pulp.squeezer.rpm_distribution: |
| 175 | + pulp_url: "{{ pulp_url }}" |
| 176 | + username: "{{ pulp_username }}" |
| 177 | + password: "{{ pulp_password }}" |
| 178 | + register: pulp_rpm_dists_list |
| 179 | + |
101 | 180 | - name: Display latest RPM distributions |
102 | 181 | vars: |
103 | 182 | info: |
|
109 | 188 | loop: "{{ dev_pulp_distribution_rpm }}" |
110 | 189 | loop_control: |
111 | 190 | label: "{{ item.repository }}" |
| 191 | + when: pub | length > 0 |
112 | 192 |
|
113 | 193 | - name: Set a fact about latest RPM versions |
114 | 194 | ansible.builtin.set_fact: |
115 | | - test_pulp_repository_rpm_repo_versions: "{{ test_pulp_repository_rpm_repo_versions | default({}) | combine({item.short_name: dist.base_path | basename}) |
116 | | - }}" |
| 195 | + test_pulp_repository_rpm_repo_versions: >- |
| 196 | + {{ test_pulp_repository_rpm_repo_versions |
| 197 | + | default({}) |
| 198 | + | combine({item.short_name: dist.base_path | basename}) }} |
117 | 199 | loop: "{{ dev_pulp_distribution_rpm }}" |
118 | 200 | loop_control: |
119 | 201 | label: "{{ item.repository }}" |
| 202 | + when: dist | length > 0 |
120 | 203 |
|
121 | 204 | - name: Display latest versions fact |
122 | 205 | ansible.builtin.debug: |
|
0 commit comments