|
33 | 33 | # If another distribution is being promoted to this one: |
34 | 34 | promoted_dist: "{{ pulp_dists_list.distributions | selectattr('name', 'equalto', item.distribution | default) }}" |
35 | 35 | promoted_pub: "{{ pulp_pubs_list.publications | selectattr('pulp_href', 'equalto', (promoted_dist | first).publication | default) }}" |
36 | | - # Pick the right pubication based on the type of distribution. |
37 | | - pub: "{{ specific_pub | first if item.version is defined else promoted_pub | first if item.distribution is defined else latest_pub | first }}" |
| 36 | + # Pick the right publication based on the type of distribution. |
| 37 | + pubs: "{{ specific_pub if item.version is defined else promoted_pub if item.distribution is defined else latest_pub }}" |
38 | 38 | # Whether any distributions exist for this publication. |
39 | | - pub_has_dists: "{{ pulp_dists_list.distributions | selectattr('publication', 'equalto', pub.pulp_href) | list | length > 0 }}" |
| 39 | + pub_has_dists: >- |
| 40 | + {{ pulp_dists_list.distributions | selectattr('publication', 'equalto', pubs[0].pulp_href if item.state == 'present' else None) | list | length > 0 }} |
40 | 41 | pulp.squeezer.rpm_distribution: |
41 | 42 | pulp_url: "{{ pulp_url }}" |
42 | 43 | username: "{{ pulp_username }}" |
43 | 44 | password: "{{ pulp_password }}" |
44 | 45 | validate_certs: "{{ pulp_validate_certs | bool }}" |
45 | 46 | name: "{{ item.name }}" |
46 | 47 | base_path: "{{ item.base_path }}" |
47 | | - publication: "{{ pub.pulp_href if item.state == 'present' else omit }}" |
| 48 | + publication: "{{ pubs[0].pulp_href if item.state == 'present' else omit }}" |
48 | 49 | state: "{{ item.state }}" |
49 | 50 | with_items: "{{ pulp_distribution_rpm }}" |
50 | 51 | when: >- |
|
0 commit comments