Skip to content

Commit

Permalink
Merge pull request #18 from RedHatSatellite/rel151
Browse files Browse the repository at this point in the history
release 1.5.1
  • Loading branch information
evgeni authored Dec 14, 2020
2 parents ac3afb0 + 0c6325e commit e92ca17
Show file tree
Hide file tree
Showing 17 changed files with 682 additions and 332 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ redhat.satellite Release Notes

This changelog describes changes after version 0.8.1.

v1.5.1
======

Bugfixes
--------

- content_view_version - make the ``version`` parameter not fail when the version was entered without a minor part (https://github.com/theforeman/foreman-ansible-modules/issues/1087)
- host - fix subnet/domain assignment when multiple interfaces are defined (https://github.com/theforeman/foreman-ansible-modules/issues/1095)

v1.5.0
======

Expand Down
10 changes: 10 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,13 @@ releases:
- redhat.satellite.content_view_version_cleanup_role.yml
- redhat.satellite.manifest_role.yml
release_date: '2020-12-03'
1.5.1:
changes:
bugfixes:
- content_view_version - make the ``version`` parameter not fail when the version
was entered without a minor part (https://github.com/theforeman/foreman-ansible-modules/issues/1087)
- host - fix subnet/domain assignment when multiple interfaces are defined (https://github.com/theforeman/foreman-ansible-modules/issues/1095)
fragments:
- 1087-content_view_version-safenet.yml
- 1095-nested_list-lookup-fix.yml
release_date: '2020-12-14'
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ authors:
- "metalcated <[email protected]>"
- "russianguppie <[email protected]>"
- "willtome <[email protected]>"
version: "1.5.0"
version: "1.5.1"
license:
- "GPL-3.0-or-later"
tags:
Expand Down
4 changes: 2 additions & 2 deletions plugins/module_utils/foreman_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,10 @@ def auto_lookup_nested_entities(self):
if entity_spec.get('type') in {'nested_list'}:
for nested_key, nested_spec in self.foreman_spec[key]['foreman_spec'].items():
for item in self.foreman_params.get(key, []):
if (nested_key in item and nested_spec.get('resolve', True) and not nested_spec.get('resolved', False)
if (nested_key in item and nested_spec.get('resolve', True)
and item[nested_key] is not None and not isinstance(item[nested_key], (dict, list))
and nested_spec.get('type') in {'entity', 'entity_list'}):
item[nested_key] = self._lookup_entity(item[nested_key], nested_spec)
nested_spec['resolved'] = True

def record_before(self, resource, entity):
self._before[resource].append(entity)
Expand Down
12 changes: 10 additions & 2 deletions plugins/modules/content_view_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
server_url: "https://satellite.example.com"
content_view: "CV 1"
organization: "Default Organization"
version: 2.0
version: "2.0"
lifecycle_environments:
- Test
- Pre Prod
Expand Down Expand Up @@ -122,7 +122,7 @@
server_url: "https://satellite.example.com"
content_view: "Web Servers"
organization: "Default Organization"
version: 1.0
version: "1.0"
state: absent
# Obtain information about a Content View and its versions
Expand Down Expand Up @@ -162,6 +162,7 @@
'''


import re
from ansible_collections.redhat.satellite.plugins.module_utils.foreman_helper import KatelloEntityAnsibleModule


Expand Down Expand Up @@ -204,6 +205,13 @@ def main():

module.task_timeout = 60 * 60

if 'version' in module.foreman_params and not re.match(r'^\d+\.\d+$', module.foreman_params['version']):
try:
major_version = int(module.foreman_params['version'])
module.foreman_params['version'] = "{0}.0".format(major_version)
except ValueError:
module.fail_json("The 'version' needs to be in the format 'X.Y', not '{0}'".format(module.foreman_params['version']))

with module.api_connection():
scope = module.scope_for('organization')
content_view = module.lookup_entity('content_view')
Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/job_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
snippet:
description:
- Determines whether the template shall be a snippet
default: false
type: bool
template:
description:
Expand All @@ -82,7 +81,6 @@
advanced:
description:
- Template Input is advanced
default: false
type: bool
description:
description:
Expand Down
62 changes: 32 additions & 30 deletions tests/test_playbooks/fixtures/host_interface_attributes-0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interactions:
uri: https://foreman.example.org/api/status
response:
body:
string: '{"result":"ok","status":200,"version":"2.2.0","api_version":2}'
string: '{"result":"ok","status":200,"version":"2.3.0","api_version":2}'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Expand All @@ -33,7 +33,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.2.0
- 2.3.0
Keep-Alive:
- timeout=15, max=100
Strict-Transport-Security:
Expand Down Expand Up @@ -92,7 +92,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.2.0
- 2.3.0
Keep-Alive:
- timeout=15, max=99
Strict-Transport-Security:
Expand Down Expand Up @@ -129,14 +129,14 @@ interactions:
uri: https://foreman.example.org/api/subnets?search=name%3D%22Test+subnet4%22&per_page=4294967296
response:
body:
string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\
: 4294967296,\n \"search\": \"name=\\\"Test subnet4\\\"\",\n \"sort\": {\n\
\ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"network\"\
:\"192.0.2.0\",\"network_type\":\"IPv4\",\"cidr\":24,\"mask\":\"255.255.255.0\"\
,\"priority\":null,\"vlanid\":null,\"mtu\":1500,\"gateway\":null,\"dns_primary\"\
:null,\"dns_secondary\":null,\"from\":null,\"to\":null,\"created_at\":\"2020-11-25\
\ 10:57:51 UTC\",\"updated_at\":\"2020-11-25 10:57:51 UTC\",\"ipam\":\"DHCP\"\
,\"boot_mode\":\"DHCP\",\"id\":7,\"name\":\"Test subnet4\",\"description\"\
:null,\"dns_secondary\":null,\"from\":null,\"to\":null,\"created_at\":\"2020-12-14\
\ 08:33:11 UTC\",\"updated_at\":\"2020-12-14 08:33:11 UTC\",\"ipam\":\"DHCP\"\
,\"boot_mode\":\"DHCP\",\"id\":3,\"name\":\"Test subnet4\",\"description\"\
:null,\"network_address\":\"192.0.2.0/24\",\"dhcp_id\":null,\"dhcp_name\"\
:null,\"tftp_id\":null,\"tftp_name\":null,\"httpboot_id\":null,\"httpboot_name\"\
:null,\"externalipam_id\":null,\"externalipam_name\":null,\"dns_id\":null,\"\
Expand All @@ -161,7 +161,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.2.0
- 2.3.0
Keep-Alive:
- timeout=15, max=98
Strict-Transport-Security:
Expand Down Expand Up @@ -201,8 +201,8 @@ interactions:
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\
: 4294967296,\n \"search\": \"title=\\\"Test Location\\\"\",\n \"sort\"\
: {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"ancestry\"\
:null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2020-11-25\
\ 10:57:49 UTC\",\"updated_at\":\"2020-11-25 10:57:49 UTC\",\"id\":16,\"name\"\
:null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2020-12-14\
\ 08:31:13 UTC\",\"updated_at\":\"2020-12-14 08:31:13 UTC\",\"id\":4,\"name\"\
:\"Test Location\",\"title\":\"Test Location\",\"description\":null}]\n}\n"
headers:
Cache-Control:
Expand All @@ -222,7 +222,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.2.0
- 2.3.0
Keep-Alive:
- timeout=15, max=97
Strict-Transport-Security:
Expand All @@ -240,7 +240,7 @@ interactions:
X-XSS-Protection:
- 1; mode=block
content-length:
- '385'
- '384'
status:
code: 200
message: OK
Expand All @@ -262,8 +262,8 @@ interactions:
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\
: 4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\"\
: {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"ancestry\"\
:null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2020-11-25\
\ 10:57:47 UTC\",\"updated_at\":\"2020-11-25 10:57:47 UTC\",\"id\":15,\"name\"\
:null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2020-12-14\
\ 08:31:10 UTC\",\"updated_at\":\"2020-12-14 08:31:10 UTC\",\"id\":3,\"name\"\
:\"Test Organization\",\"title\":\"Test Organization\",\"description\":\"\
A test organization\"}]\n}\n"
headers:
Expand All @@ -284,7 +284,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.2.0
- 2.3.0
Keep-Alive:
- timeout=15, max=96
Strict-Transport-Security:
Expand All @@ -302,15 +302,15 @@ interactions:
X-XSS-Protection:
- 1; mode=block
content-length:
- '413'
- '412'
status:
code: 200
message: OK
- request:
body: '{"location_id": 16, "organization_id": 15, "host": {"name": "test-host.example.net",
"location_id": 16, "organization_id": 15, "build": false, "managed": false,
"interfaces_attributes": [{"type": "interface", "identifier": "fam01", "ip":
"192.0.2.23", "mac": "EE:FF:00:00:00:01", "subnet_id": 7}]}}'
body: '{"location_id": 4, "organization_id": 3, "host": {"name": "test-host.example.net",
"location_id": 4, "organization_id": 3, "build": false, "managed": false, "interfaces_attributes":
[{"type": "interface", "identifier": "fam01", "ip": "192.0.2.23", "mac": "EE:FF:00:00:00:01",
"subnet_id": 3}]}}'
headers:
Accept:
- application/json;version=2
Expand All @@ -319,7 +319,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '298'
- '294'
Content-Type:
- application/json
User-Agent:
Expand All @@ -328,13 +328,15 @@ interactions:
uri: https://foreman.example.org/api/hosts
response:
body:
string: '{"ip":"192.0.2.23","ip6":null,"environment_id":null,"environment_name":null,"last_report":null,"mac":"ee:ff:00:00:00:01","realm_id":null,"realm_name":null,"sp_mac":null,"sp_ip":null,"sp_name":null,"domain_id":8,"domain_name":"example.net","architecture_id":null,"architecture_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"subnet_id":7,"subnet_name":"Test
string: '{"ip":"192.0.2.23","ip6":null,"environment_id":null,"environment_name":null,"last_report":null,"mac":"ee:ff:00:00:00:01","realm_id":null,"realm_name":null,"sp_mac":null,"sp_ip":null,"sp_name":null,"domain_id":2,"domain_name":"example.net","architecture_id":null,"architecture_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"subnet_id":3,"subnet_name":"Test
subnet4","subnet6_id":null,"subnet6_name":null,"sp_subnet_id":null,"ptable_id":null,"ptable_name":null,"medium_id":null,"medium_name":null,"pxe_loader":null,"build":false,"comment":null,"disk":null,"installed_at":null,"model_id":null,"hostgroup_id":null,"owner_id":4,"owner_name":"Admin
User","owner_type":"User","enabled":true,"managed":false,"use_image":null,"image_file":"","uuid":null,"compute_resource_id":null,"compute_resource_name":null,"compute_profile_id":null,"compute_profile_name":null,"capabilities":["build"],"provision_method":"build","certname":"test-host.example.net","image_id":null,"image_name":null,"created_at":"2020-11-25
11:00:52 UTC","updated_at":"2020-11-25 11:00:52 UTC","last_compile":null,"global_status":0,"global_status_label":"OK","uptime_seconds":null,"organization_id":15,"organization_name":"Test
Organization","location_id":16,"location_name":"Test Location","puppet_status":0,"model_name":null,"name":"test-host.example.net","id":40,"puppet_proxy_id":null,"puppet_proxy_name":null,"puppet_ca_proxy_id":null,"puppet_ca_proxy_name":null,"puppet_proxy":null,"puppet_ca_proxy":null,"hostgroup_name":null,"hostgroup_title":null,"parameters":[],"all_parameters":[],"interfaces":[{"subnet_id":7,"subnet_name":"Test
subnet4","subnet6_id":null,"subnet6_name":null,"domain_id":8,"domain_name":"example.net","created_at":"2020-11-25
11:00:52 UTC","updated_at":"2020-11-25 11:00:52 UTC","managed":true,"identifier":"fam01","id":51,"name":"test-host.example.net","ip":"192.0.2.23","ip6":null,"mac":"ee:ff:00:00:00:01","mtu":1500,"fqdn":"test-host.example.net","primary":true,"provision":true,"type":"interface","virtual":false}],"puppetclasses":[],"config_groups":[],"all_puppetclasses":[],"permissions":{"view_hosts":true,"create_hosts":true,"edit_hosts":true,"destroy_hosts":true,"build_hosts":true,"power_hosts":true,"console_hosts":true,"ipmi_boot_hosts":true,"forget_status_hosts":true}}'
User","owner_type":"User","enabled":true,"managed":false,"use_image":null,"image_file":"","uuid":null,"compute_resource_id":null,"compute_resource_name":null,"compute_profile_id":null,"compute_profile_name":null,"capabilities":["build"],"provision_method":"build","certname":"test-host.example.net","image_id":null,"image_name":null,"created_at":"2020-12-14
08:33:16 UTC","updated_at":"2020-12-14 08:33:16 UTC","last_compile":null,"global_status":0,"global_status_label":"OK","uptime_seconds":null,"organization_id":3,"organization_name":"Test
Organization","location_id":4,"location_name":"Test Location","puppet_status":0,"model_name":null,"name":"test-host.example.net","id":4,"puppet_proxy_id":null,"puppet_proxy_name":null,"puppet_ca_proxy_id":null,"puppet_ca_proxy_name":null,"puppet_proxy":null,"puppet_ca_proxy":null,"registration_token":"eyJhbGciOiJIUzI1NiJ9.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ3OTYsImp0aSI6IjQwMDI3ZDliN2ExMTc4NTRjNzgxOWNhNmY1NDRmOTllNDhmNzQ2ZDQ1NDU0MmMxNzdlZmY1OGEzZWNhZTEzYzciLCJleHAiOjE2MDgwMjExOTYsIm5iZiI6MTYwNzkzMTE5Nn0.e0GvQh7ZZfQXxCLP8TniFgKmazZW7zi75nRT3B0FyKA","hostgroup_name":null,"hostgroup_title":null,"parameters":[],"all_parameters":[{"priority":0,"created_at":"2020-12-04
08:34:05 UTC","updated_at":"2020-12-04 08:34:05 UTC","id":2,"name":"host_registration_remote_execution","parameter_type":"boolean","value":true},{"priority":0,"created_at":"2020-12-04
08:34:05 UTC","updated_at":"2020-12-04 08:34:05 UTC","id":1,"name":"host_registration_insights","parameter_type":"boolean","value":false}],"interfaces":[{"subnet_id":3,"subnet_name":"Test
subnet4","subnet6_id":null,"subnet6_name":null,"domain_id":2,"domain_name":"example.net","created_at":"2020-12-14
08:33:16 UTC","updated_at":"2020-12-14 08:33:16 UTC","managed":true,"identifier":"fam01","id":8,"name":"test-host.example.net","ip":"192.0.2.23","ip6":null,"mac":"ee:ff:00:00:00:01","mtu":1500,"fqdn":"test-host.example.net","primary":true,"provision":true,"type":"interface","virtual":false}],"puppetclasses":[],"config_groups":[],"all_puppetclasses":[],"permissions":{"view_hosts":true,"create_hosts":true,"edit_hosts":true,"destroy_hosts":true,"build_hosts":true,"power_hosts":true,"console_hosts":true,"ipmi_boot_hosts":true,"forget_status_hosts":true}}'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Expand All @@ -349,11 +351,11 @@ interactions:
Foreman_api_version:
- '2'
Foreman_current_location:
- 16; Test Location
- 4; Test Location
Foreman_current_organization:
- 15; Test Organization
- 3; Test Organization
Foreman_version:
- 2.2.0
- 2.3.0
Keep-Alive:
- timeout=15, max=95
Strict-Transport-Security:
Expand Down
Loading

0 comments on commit e92ca17

Please sign in to comment.