Skip to content

Commit

Permalink
Merge pull request #73 from RedHatSatellite/rel315
Browse files Browse the repository at this point in the history
Release 3.15
  • Loading branch information
evgeni authored Dec 15, 2023
2 parents 17dc64a + c421da5 commit 6a3c748
Show file tree
Hide file tree
Showing 47 changed files with 2,522 additions and 4,873 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- stable-2.13
- stable-2.14
- stable-2.15
- stable-2.16
- devel
include:
- python: "3.8"
Expand All @@ -44,6 +45,8 @@ jobs:
ansible: "stable-2.11"
- python: "3.11"
ansible: "devel"
- python: "3.12"
ansible: "devel"
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -57,8 +60,14 @@ jobs:
run: apt-get update && apt-get install -y sudo
if: matrix.container != null
- name: Install system dependencies
# libyaml-dev for PyYAML, rpm for py-rpm-installer
run: sudo apt-get install -y libyaml-dev rpm
# libyaml-dev for PyYAML, rpm for rpm-py-installer, python3-rpm for rpm-shim
run: sudo apt-get install -y libyaml-dev rpm python3-rpm
- name: Fix up Python RPM binding filenames so that other Pythons find it
run: |
for file in /usr/lib/python3/dist-packages/rpm/_rpm*.cpython-*.so; do
sudo ln -s ${file} $(echo ${file} | sed 's/\.cpython[^.]*//');
done
if: matrix.container == null
- name: Install Ansible
run: pip install --upgrade https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz
- name: Ensure Jinja version is old enough for Ansible 2.9
Expand All @@ -79,7 +88,7 @@ jobs:
run: make dist-test
- name: Run sanity tests
run: make SANITY_OPTS="--docker" sanity
if: matrix.ansible != 'v2.9.17' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11'
if: matrix.ansible != 'v2.9.17' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11' && matrix.ansible != 'stable-2.12' && matrix.ansible != 'stable-2.13'

checkmode:
runs-on: ubuntu-latest
Expand All @@ -91,6 +100,14 @@ jobs:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install system dependencies
# libyaml-dev for PyYAML, rpm for rpm-py-installer, python3-rpm for rpm-shim
run: sudo apt-get install -y libyaml-dev rpm python3-rpm
- name: Fix up Python RPM binding filenames so that other Pythons find it
run: |
for file in /usr/lib/python3/dist-packages/rpm/_rpm*.cpython-*.so; do
sudo ln -s ${file} $(echo ${file} | sed 's/\.cpython[^.]*//');
done
- name: Install Ansible
run: pip install --upgrade ansible-core
- name: Install dependencies
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ jobs:
with:
python-version: "3.11"
- name: Install Ansible
run: pip install --upgrade ansible py
run: pip install --upgrade ansible py antsibull-changelog
- name: Build Ansible Collection
run: make dist
- name: Build Changelog
run: antsibull-changelog generate --output release-changelog.txt --only-latest
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: redhat-satellite-*.tar.gz
body_path: release-changelog.txt
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ redhat.satellite Release Notes

This changelog describes changes after version 0.8.1.

v3.15.0
=======

Minor Changes
-------------

- content_view_publish role - allow passing ``async`` and ``poll`` to the module (https://github.com/theforeman/foreman-ansible-modules/pull/1676)
- convert2rhel role - install ``convert2rhel`` from ``cdn-public.redhat.com``, dropping the requirement of a custom CA cert

Bugfixes
--------

- content_view_filter_rule - handle multiple rules for the same package but different architectures and versions correctly (https://bugzilla.redhat.com/show_bug.cgi?id=2189687)

v3.14.0
=======

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ clean_%: FORCE $(MANIFEST)
setup: test-setup

test-setup: | tests/test_playbooks/vars/server.yml
pip install --upgrade --force-reinstall 'pip<23.1'
pip install --upgrade pip
pip install --upgrade -r requirements-dev.txt

tests/test_playbooks/vars/server.yml:
Expand Down
15 changes: 15 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,21 @@ releases:
name: smart_class_parameter_override_value
namespace: ''
release_date: '2023-09-08'
3.15.0:
changes:
bugfixes:
- content_view_filter_rule - handle multiple rules for the same package but
different architectures and versions correctly (https://bugzilla.redhat.com/show_bug.cgi?id=2189687)
minor_changes:
- content_view_publish role - allow passing ``async`` and ``poll`` to the module
(https://github.com/theforeman/foreman-ansible-modules/pull/1676)
- convert2rhel role - install ``convert2rhel`` from ``cdn-public.redhat.com``,
dropping the requirement of a custom CA cert
fragments:
- 1672-convert2rhel-cdn-public.yml
- 1676-content_view_version-async-poll.yml
- bz2189687-content_view_filter_rule-handle-arch-version.yml
release_date: '2023-11-15'
3.2.0:
changes:
bugfixes:
Expand Down
3 changes: 2 additions & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ authors:
- "gardar <[email protected]>"
- "igramic <[email protected]>"
- "jerrejkw <[email protected]>"
- "linuxonfire <[email protected]>"
- "marco <[email protected]>"
- "metalcated <[email protected]>"
- "russianguppie <[email protected]>"
- "willtome <[email protected]>"
- "yuqo2450 <[email protected]>"
version: "3.14.0"
version: "3.15.0"
license:
- "GPL-3.0-or-later"
tags:
Expand Down
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@ plugin_routing:
redirect: redhat.satellite.sync_plan
katello_upload:
redirect: redhat.satellite.content_upload
requires_ansible: '>=2.9.17'
requires_ansible: '>=2.14'
6 changes: 4 additions & 2 deletions plugins/modules/content_view_filter_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,10 @@ def main():
elif filter_type in ('rpm', 'docker', 'package_group', 'deb'):
# these filter types support many rules
# the name is the key to finding the proper one and is required for these types
content_view_filter_rule = module.find_resource_by_name('content_view_filter_rules', module.foreman_params['name'],
params=search_scope, failsafe=True)
search = [(key, module.foreman_params.get(key)) for key in ('name', 'architecture', 'version') if module.foreman_params.get(key)]
search_string = ','.join('{0}="{1}"'.format(key, val) for (key, val) in search)
content_view_filter_rule = module.find_resource('content_view_filter_rules', search_string,
params=search_scope, failsafe=True)

if filter_type == 'package_group':
# uuid is also a required value creating, but is implementation specific and not easily knowable to the end user - we find it for them
Expand Down
6 changes: 4 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ pytest-xdist
pytest-forked
pytest-clarity; python_version >= '3.6'
urllib3<2
vcrpy
vcrpy; python_version < '3.12'
git+https://github.com/kevin1024/vcrpy@69621c67fb29dedd9ece4a7bdbf50380fbe4c5ee; python_version >= '3.12'
ansible_runner<2.0; python_version < '3.8'
ansible_runner; python_version >= '3.8'
python-debian<0.1.40; python_version < '3.7'
python-debian; python_version >= '3.7'
rpm-py-installer
rpm; python_version >= '3.6'
rpm-py-installer; python_version < '3.6'
rstcheck==3.5.0 # from https://github.com/ansible/ansible/raw/devel/test/sanity/code-smell/rstcheck.requirements.txt
docker
ruamel.yaml.clib<0.2.3; python_version < '3.6'
Expand Down
5 changes: 5 additions & 0 deletions roles/content_view_publish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ This role supports the [Common Role Variables](https://github.com/theforeman/for

- `satellite_content_views`: List of Content Views to publish. It can be either a list of Content View names or a list of dictionaries with the parameters as accepted by the `content_view_version` module or the `content_views` role.

### Optional

- `satellite_content_view_publish_async`: Asynchronous mode lets you control how long-running tasks execute. See the [Ansible documentation](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_async.html#asynchronous-playbook-tasks) for details.
- `satellite_content_view_publish_poll`: For asynchronous tasks, this is how often to check back on the status of those tasks.

Example Playbook
----------------

Expand Down
2 changes: 2 additions & 0 deletions roles/content_view_publish/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
force_promote: "{{ content_view.force_promote | default(omit) }}"
force_yum_metadata_regeneration: "{{ content_view.force_yum_metadata_regeneration | default(omit) }}"
current_lifecycle_environment: "{{ content_view.current_lifecycle_environment | default(omit) }}"
async: "{{ satellite_content_view_publish_async | default(omit) }}"
poll: "{{ satellite_content_view_publish_poll | default(omit) }}"
loop: "{{ satellite_content_views }}"
loop_control:
loop_var: "content_view"
24 changes: 2 additions & 22 deletions roles/convert2rhel/tasks/products_and_repos.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
---
- name: Check /etc/rhsm/ca/redhat-uep.pem
ansible.builtin.stat:
path: "/etc/rhsm/ca/redhat-uep.pem"
register: __satellite_ct

- name: "Create 'Convert2RHEL' credentials"
redhat.satellite.content_credential:
username: "{{ satellite_username }}"
password: "{{ satellite_password }}"
server_url: "{{ satellite_server_url }}"
validate_certs: "{{ satellite_validate_certs | default(omit) }}"
organization: "{{ satellite_organization }}"
name: "Convert2RHEL CA"
content_type: cert
content: "{{ __satellite_ct.stat.exists | ternary(lookup('file', '/etc/rhsm/ca/redhat-uep.pem', errors='ignore', rstrip=False),
lookup('url', 'https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem', split_lines=False)) }}"
state: present

- name: "Create product and repositories '{{ satellite_convert2rhel_rhel7_product }}'"
ansible.builtin.include_role:
name: redhat.satellite.repositories
Expand All @@ -27,10 +9,9 @@
- name: "{{ satellite_convert2rhel_rhel7_repo }}"
content_type: "yum"
product: "{{ satellite_convert2rhel_rhel7_product }}"
url: "https://cdn.redhat.com/content/public/convert2rhel/7/x86_64/os/"
url: "https://cdn-public.redhat.com/content/public/addon/dist/convert2rhel/server/7/7Server/x86_64/os/"
verify_ssl_on_sync: true
download_policy: immediate
ssl_ca_cert: "Convert2RHEL CA"
state: present
when: satellite_content_rhel_enable_rhel7

Expand All @@ -44,10 +25,9 @@
- name: "{{ satellite_convert2rhel_rhel8_repo }}"
content_type: "yum"
product: "{{ satellite_convert2rhel_rhel8_product }}"
url: "https://cdn.redhat.com/content/public/convert2rhel/8/x86_64/os/"
url: "https://cdn-public.redhat.com/content/public/addon/dist/convert2rhel8/8/x86_64/os/"
verify_ssl_on_sync: true
download_policy: immediate
ssl_ca_cert: "Convert2RHEL CA"
state: present
when: satellite_content_rhel_enable_rhel8

Expand Down
2 changes: 1 addition & 1 deletion tests/test_playbooks/content_view_filter_rule_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
ansible.builtin.assert:
fail_msg: "Ensuring content view filter info is valid failed!"
that:
- "{{ result['content_view_filter_rules']|length }} != 0"
- result['content_view_filter_rules']|length != 0


- name: "Fetch content_view_filter_info - deb exlude"
Expand Down
54 changes: 54 additions & 0 deletions tests/test_playbooks/convert2rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,57 @@
satellite_content_rhel_enable_rhel8: true
satellite_convert2rhel_enable_oracle7: true
satellite_convert2rhel_enable_oracle8: true

- hosts: localhost
collections:
- redhat.satellite
gather_facts: false
vars_files:
- vars/server.yml
tasks:
- name: remove groups
include_tasks: tasks/hostgroup.yml
vars:
hostgroup_name: "{{ item }}"
hostgroup_state: "absent"
loop:
- CentOS 7 converting
- CentOS 8 converting
- Oracle Linux 7 converting
- Oracle Linux 8 converting
- name: remove keys
include_tasks: tasks/activation_key.yml
vars:
activation_key_name: "{{ item }}"
activation_key_state: "absent"
loop:
- convert2rhel_centos7
- convert2rhel_centos8
- convert2rhel_oracle7
- convert2rhel_oracle8
- convert2rhel_rhel7
- convert2rhel_rhel8
- name: remove content views
include_tasks: tasks/content_view.yml
vars:
content_view_name: "{{ item }}"
content_view_state: "absent"
loop:
- convert2rhel_centos7
- convert2rhel_centos8
- name: remove products
include_tasks: tasks/product.yml
vars:
product_name: "{{ item }}"
product_state: "absent"
loop:
- Oracle Linux 8 Convert2RHEL
- Oracle Linux 7 Convert2RHEL
- Convert2RHEL7
- Convert2RHEL8

- name: remove organization
include_tasks: tasks/organization.yml
vars:
organization_name: "Test Organization"
organization_state: "absent"
8 changes: 4 additions & 4 deletions tests/test_playbooks/filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
msg: "{{ 'Test__String)' | redhat.satellite.cp_label }}"
- assert:
that:
- "{{ 'Test String' | redhat.satellite.cp_label == 'Test_String' }}"
- "{{ 'Test__String' | redhat.satellite.cp_label == 'Test__String' }}"
- "{{ 'Test--String' | redhat.satellite.cp_label == 'Test--String' }}"
- "{{ 'Test (String) 1234' | redhat.satellite.cp_label == 'Test_String_1234' }}"
- "'Test String' | redhat.satellite.cp_label == 'Test_String'"
- "'Test__String' | redhat.satellite.cp_label == 'Test__String'"
- "'Test--String' | redhat.satellite.cp_label == 'Test--String'"
- "'Test (String) 1234' | redhat.satellite.cp_label == 'Test_String_1234'"
...
Loading

0 comments on commit 6a3c748

Please sign in to comment.