Skip to content

Commit b374bd6

Browse files
committed
Allow promoting a distribution to the publication used by another
1 parent c6b3583 commit b374bd6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

roles/pulp_distribution/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,20 @@ Example playbook
3131
pulp_username: admin
3232
pulp_password: "{{ secrets_pulp_admin_password }}"
3333
pulp_distribution_rpm:
34+
# Distribute the latest version of the centos-baseos repository.
3435
- name: centos-baseos
3536
base_path: centos-baseos
3637
repository: centos-baseos
3738
state: present
39+
# Distribute version 2 of the centos-appstream repository.
3840
- name: centos-appstream
3941
base_path: centos-appstream
4042
repository: centos-appstream
4143
version: 2
4244
state: present
45+
# Distribute the same publication as the centos-baseos distribution.
46+
- name: centos-baseos-production
47+
base_path: centos-baseos-production
48+
distribution: centos-baseos
49+
state: present
4350
```

roles/pulp_distribution/tasks/rpm.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
specific_pub: "{{ pulp_pubs_list.publications | selectattr('repository_version', 'equalto', repo.pulp_href ~ 'versions/' ~ item.version | default ~ '/') }}"
3131
# If the distribution uses the latest version:
3232
latest_pub: "{{ pulp_pubs_list.publications | selectattr('repository', 'equalto', repo.pulp_href) | sort(attribute='repository_version', reverse=True) }}"
33-
pub: "{{ latest_pub | first if item.version is not defined else specific_pub | first }}"
33+
# If another distribution is being promoted to this one:
34+
promoted_dist: "{{ pulp_dists_list.distributions | selectattr('name', 'equalto', item.distribution | default) }}"
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 }}"
3438
# Whether any distributions exist for this publication.
3539
pub_has_dists: "{{ pulp_dists_list.distributions | selectattr('publication', 'equalto', pub.pulp_href) | list | length > 0 }}"
3640
pulp.squeezer.rpm_distribution:

0 commit comments

Comments
 (0)