Skip to content

Commit

Permalink
Merge tag 'v3.14.0' into rel3140
Browse files Browse the repository at this point in the history
v3.14.0
  • Loading branch information
evgeni committed Sep 8, 2023
2 parents 028afaf + cdbf4cd commit 9ddbdb5
Show file tree
Hide file tree
Showing 42 changed files with 6,576 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'RedHatSatellite/satellite-ansible-collection'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: configure git
run: |
git config user.name "${GITHUB_ACTOR}"
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- devel
include:
- python: "3.8"
ansible: "stable-2.9"
ansible: "v2.9.17"
- python: "3.8"
ansible: "stable-2.10"
- python: "2.7"
Expand All @@ -45,7 +45,7 @@ jobs:
- python: "3.11"
ansible: "devel"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -61,13 +61,16 @@ jobs:
run: sudo apt-get install -y libyaml-dev rpm
- 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
run: pip install --upgrade 'Jinja2<3.1'
if: matrix.ansible == 'v2.9.17'
- name: Install dependencies
run: make test-setup
- name: prepare a redhat-uep.pem, even if we run on Ubuntu
run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
- name: Install required collections for ansible-base (2.10+)
run: ansible-galaxy collection install community.docker
if: matrix.ansible != 'stable-2.9'
if: matrix.ansible != 'v2.9.17'
- name: Run crud tests
run: make test-crud
- name: Run other tests
Expand All @@ -76,12 +79,12 @@ jobs:
run: make dist-test
- name: Run sanity tests
run: make SANITY_OPTS="--docker" sanity
if: matrix.ansible != 'stable-2.9' && 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'

checkmode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -100,7 +103,7 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -122,7 +125,7 @@ jobs:
galaxy-importer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -137,7 +140,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -159,7 +162,7 @@ jobs:
execution_environment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'RedHatSatellite/satellite-ansible-collection'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -25,3 +25,7 @@ jobs:
run: make dist
- name: Deploy Ansible Collection
run: make publish GALAXY_API_KEY=${{ secrets.GALAXY_API_KEY }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: redhat-satellite-*.tar.gz
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ Lucas Bickel <[email protected]> <[email protected]>
Kenny Tordeurs <[email protected]> <[email protected]>
Paul Armstrong <[email protected]> <[email protected]>
Lukas Magauer <[email protected]> <[email protected]>
Griffin Sullivan <[email protected]> <[email protected]>
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ redhat.satellite Release Notes

This changelog describes changes after version 0.8.1.

v3.14.0
=======

Bugfixes
--------

- content_view_publish role - correctly pass ``version`` not ``description`` to the module (https://bugzilla.redhat.com/show_bug.cgi?id=2234444)

New Modules
-----------

- redhat.satellite.smart_class_parameter_override_value - Manage Smart Class Parameter Override Values

v3.13.0
=======

Expand Down
12 changes: 12 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,18 @@ releases:
name: wait_for_task
namespace: ''
release_date: '2023-08-15'
3.14.0:
changes:
bugfixes:
- content_view_publish role - correctly pass ``version`` not ``description``
to the module (https://bugzilla.redhat.com/show_bug.cgi?id=2234444)
fragments:
- bz2234444.yaml
modules:
- description: Manage Smart Class Parameter Override Values
name: smart_class_parameter_override_value
namespace: ''
release_date: '2023-09-08'
3.2.0:
changes:
bugfixes:
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ authors:
- "russianguppie <[email protected]>"
- "willtome <[email protected]>"
- "yuqo2450 <[email protected]>"
version: "3.13.0"
version: "3.14.0"
license:
- "GPL-3.0-or-later"
tags:
Expand Down
3 changes: 2 additions & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ action_groups:
- setting
- setting_info
- smart_class_parameter
- smart_class_parameter_override_value
- smart_proxy
- status_info
- subnet
Expand Down Expand Up @@ -182,4 +183,4 @@ plugin_routing:
redirect: redhat.satellite.sync_plan
katello_upload:
redirect: redhat.satellite.content_upload
requires_ansible: '>=2.9'
requires_ansible: '>=2.9.17'
6 changes: 6 additions & 0 deletions plugins/modules/content_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
description:
- Solve RPM dependencies by default on Content View publish
type: bool
import_only:
description:
- Designate this Content View for importing from upstream servers only.
type: bool
version_added: 3.14.0
composite:
description:
- A composite view contains other content views.
Expand Down Expand Up @@ -167,6 +172,7 @@ def main():
composite=dict(type='bool', default=False),
auto_publish=dict(type='bool', default=False),
solve_dependencies=dict(type='bool'),
import_only=dict(type='bool'),
components=dict(type='nested_list', foreman_spec=cvc_foreman_spec, resolve=False),
repositories=dict(type='entity_list', elements='dict', resolve=False, options=dict(
name=dict(required=True),
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/job_invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
time_span:
description:
- Distribute tasks over given number of seconds
- This is removed since foreman_remote_execution-11.0.0
type: int
concurrency_level:
description:
Expand Down
8 changes: 6 additions & 2 deletions plugins/modules/smart_class_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@
description: Name of the puppetclass that own the parameter
required: true
type: str
aliases:
- puppetclass
parameter:
description: Name of the parameter
required: true
type: str
aliases:
- smart_class_parameter
description:
description: Description of the Smart Class Parameter
type: str
Expand Down Expand Up @@ -205,8 +209,8 @@ def ensure_override_values(self, entity, expected_override_values):
def main():
module = ForemanSmartClassParameterModule(
argument_spec=dict(
puppetclass_name=dict(required=True),
parameter=dict(required=True),
puppetclass_name=dict(required=True, aliases=['puppetclass']),
parameter=dict(required=True, aliases=['smart_class_parameter']),
state=dict(default='present', choices=['present_with_defaults', 'present']),
),
foreman_spec=dict(
Expand Down
131 changes: 131 additions & 0 deletions plugins/modules/smart_class_parameter_override_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2023 Evgeni Golov <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, division, print_function
__metaclass__ = type


DOCUMENTATION = '''
---
module: smart_class_parameter_override_value
version_added: 3.14.0
short_description: Manage Smart Class Parameter Override Values
description:
- Manage Smart Class Parameter Override Values
author:
- "Evgeni Golov (@evgeni)"
options:
puppetclass:
description:
- Puppet Class the Smart Class Parameter belongs to
type: str
required: true
aliases:
- puppetclass_name
smart_class_parameter:
description:
- Smart Class Parameter the Override Value belongs to
required: true
type: str
aliases:
- parameter
match:
description:
- Override match
required: true
type: str
omit:
description:
- Foreman will not send this parameter in classification output
required: false
type: bool
value:
description:
- Override value, required if omit is false
required: false
type: raw
extends_documentation_fragment:
- redhat.satellite.foreman
- redhat.satellite.foreman.entity_state
'''

EXAMPLES = '''
- name: Set ntp::servers override value
redhat.satellite.smart_class_parameter_override_value:
server_url: "https://satellite.example.com"
username: "admin"
password: "changeme"
puppetclass: ntp
smart_class_parameter: servers
match: domain=example.org
value:
- ntp1.example.org
- ntp2.example.org
state: present
'''

RETURN = '''
entity:
description: Final state of the affected entities grouped by their type.
returned: success
type: dict
contains:
override_values:
description: List of override_values.
type: list
elements: dict
'''

from ansible_collections.redhat.satellite.plugins.module_utils.foreman_helper import ForemanEntityAnsibleModule, parameter_value_to_str


class ForemanOverrideValueModule(ForemanEntityAnsibleModule):
pass


def main():
module = ForemanOverrideValueModule(
foreman_spec=dict(
puppetclass=dict(required=True, type='entity', ensure=False, aliases=['puppetclass_name']),
smart_class_parameter=dict(required=True, type='entity', scope=['puppetclass'], search_by='parameter', aliases=['parameter']),
match=dict(required=True, type='str'),
value=dict(required=False, type='raw'),
omit=dict(required=False, type='bool'),
),
)

module_params = module.foreman_params

with module.api_connection():
scp = module.lookup_entity('smart_class_parameter')
parameter_type = scp.get('parameter_type', 'string')
scope = {'smart_class_parameter_id': scp['id']}
override_values = module.list_resource('override_values', params=scope)
entity = next((ov for ov in override_values if ov['match'] == module_params['match']), None)
if entity is not None:
# this is a hack, otherwise update_entity() tries to update that
entity['smart_class_parameter_id'] = scp['id']
entity['value'] = parameter_value_to_str(entity['value'], parameter_type)
module.set_entity('entity', entity)
if 'value' in module_params:
module_params['value'] = parameter_value_to_str(module_params['value'], parameter_type)
module.ensure_entity('override_values', module_params, entity, params=scope)


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion roles/content_view_publish/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
organization: "{{ satellite_organization }}"
content_view: "{{ content_view.name | default(content_view.content_view) | default(content_view) }}"
description: "{{ content_view.description | default(omit) }}"
version: "{{ content_view.description | default(omit) }}"
version: "{{ content_view.version | default(omit) }}"
lifecycle_environments: "{{ content_view.lifecycle_environments | default(omit) }}"
force_promote: "{{ content_view.force_promote | default(omit) }}"
force_yum_metadata_regeneration: "{{ content_view.force_yum_metadata_regeneration | default(omit) }}"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def drop_incompatible_items(d):
dd = {}
for k, v in d.items():
if k in ['msg', 'start', 'end', 'delta', 'uuid', 'timeout', '_ansible_no_log', 'warn', 'connection',
'extended_allitems', 'loop_control', 'expand_argument_vars', 'retries']:
'extended_allitems', 'loop_control', 'expand_argument_vars', 'retries', 'parent', 'parent_type', 'finalized', 'squashed']:
continue

if isinstance(v, dict):
Expand Down
Loading

0 comments on commit 9ddbdb5

Please sign in to comment.