Skip to content

Commit

Permalink
Merge tag 'v2.0.1' into r200
Browse files Browse the repository at this point in the history
release 2.0.1
  • Loading branch information
evgeni committed Mar 2, 2021
2 parents 3d898c6 + 6b2ea0d commit efa1b95
Show file tree
Hide file tree
Showing 19 changed files with 402 additions and 363 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ redhat.satellite Release Notes

This changelog describes changes after version 0.8.1.

v2.0.1
======

Bugfixes
--------

- host - don't filter ``false`` values for ``interfaces_attributes`` (https://github.com/theforeman/foreman-ansible-modules/issues/1148)
- host_info, repository_info - correctly fetch all entities when neither ``name`` nor ``search`` is set
- host_info, repository_info - enforce mutual exclusivity of ``name`` and ``search``

v2.0.0
======

Expand Down Expand Up @@ -36,6 +46,13 @@ Bugfixes
- host, hostgroup - select kickstart_repository based on lifecycle_environment and content_view if those are set (https://github.com/theforeman/foreman-ansible-modules/issues/1090, https://bugzilla.redhat.com/1915872)
- resource_info - correctly show the exact resource when passing ``id`` in ``params``

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

- redhat.satellite.host_info - Fetch information about Hosts
- redhat.satellite.puppetclasses_import - Import Puppet Classes from a Proxy
- redhat.satellite.repository_info - Fetch information about Repositories

v1.5.0
======

Expand Down
21 changes: 21 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,25 @@ releases:
- bz1901716-dont_scope_requests.yml
- host-hostgroup-ak-parameter.yml
- resource_info-params-id.yml
modules:
- description: Fetch information about Hosts
name: host_info
namespace: ''
- description: Import Puppet Classes from a Proxy
name: puppetclasses_import
namespace: ''
- description: Fetch information about Repositories
name: repository_info
namespace: ''
release_date: '2021-02-22'
2.0.1:
changes:
bugfixes:
- host - don't filter ``false`` values for ``interfaces_attributes`` (https://github.com/theforeman/foreman-ansible-modules/issues/1148)
- host_info, repository_info - correctly fetch all entities when neither ``name``
nor ``search`` is set
- host_info, repository_info - enforce mutual exclusivity of ``name`` and ``search``
fragments:
- 1148-dont-filter-false-params.yml
- 20210224-info_module_fixes.yml
release_date: '2021-03-02'
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ authors:
- "metalcated <[email protected]>"
- "russianguppie <[email protected]>"
- "willtome <[email protected]>"
version: "2.0.0"
version: "2.0.1"
license:
- "GPL-3.0-or-later"
tags:
Expand Down
5 changes: 3 additions & 2 deletions plugins/module_utils/foreman_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,8 @@ def __init__(self, **kwargs):
location=dict(type='entity'),
)
foreman_spec.update(kwargs.pop('foreman_spec', {}))
super(ForemanInfoAnsibleModule, self).__init__(foreman_spec=foreman_spec, **kwargs)
mutually_exclusive = kwargs.pop('mutually_exclusive', []) + [['name', 'search']]
super(ForemanInfoAnsibleModule, self).__init__(foreman_spec=foreman_spec, mutually_exclusive=mutually_exclusive, **kwargs)

def run(self, **kwargs):
"""
Expand All @@ -1356,7 +1357,7 @@ def run(self, **kwargs):
self._info_result = {self.entity_name: self.lookup_entity('entity')}
else:
_flat_entity = _flatten_entity(self.foreman_params, self.foreman_spec)
self._info_result = {resource: self.list_resource(resource, self.foreman_params['search'], _flat_entity)}
self._info_result = {resource: self.list_resource(resource, self.foreman_params.get('search'), _flat_entity)}

def exit_json(self, **kwargs):
kwargs.update(self._info_result)
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/compute_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@
description:
- Set a randomly generated password on the display connection for I(provider=vmware) and I(provider=libvirt)
type: bool
version_added: 1.6.0
version_added: 2.0.0
keyboard_layout:
description:
- Default VNC Keyboard for I(provider=ovirt)
type: str
version_added: 1.6.0
version_added: 2.0.0
choices:
- 'ar'
- 'da'
Expand Down Expand Up @@ -168,7 +168,7 @@
description:
- X509 Certification Authorities, only valid for I(provider=ovirt)
type: str
version_added: 1.6.0
version_added: 2.0.0
extends_documentation_fragment:
- redhat.satellite.foreman
- redhat.satellite.foreman.entity_state_with_defaults
Expand Down
4 changes: 0 additions & 4 deletions plugins/modules/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,6 @@ def main():
elif 'owner_group' in module.foreman_params:
module.foreman_params['owner_type'] = 'Usergroup'

if 'interfaces_attributes' in module.foreman_params:
filtered = [nic for nic in ({k: v for k, v in obj.items() if v} for obj in module.foreman_params['interfaces_attributes']) if nic]
module.foreman_params['interfaces_attributes'] = filtered

with module.api_connection():
entity = module.lookup_entity('entity')

Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/host_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
DOCUMENTATION = '''
---
module: host_info
version_added: 1.6.0
version_added: 2.0.0
short_description: Fetch information about Hosts
description:
- Fetch information about Hosts
Expand All @@ -42,7 +42,7 @@
name: "host.example.com"
- name: "Show all hosts with domain example.com"
redhat.satellite.host:
redhat.satellite.host_info:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/puppetclasses_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
DOCUMENTATION = '''
---
module: puppetclasses_import
version_added: 1.6.0
version_added: 2.0.0
short_description: Import Puppet Classes from a Proxy
description:
- Import Puppet Classes from a Proxy
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/repository_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
DOCUMENTATION = '''
---
module: repository_info
version_added: 1.6.0
version_added: 2.0.0
short_description: Fetch information about Repositories
description:
- Fetch information about Repositories
Expand Down Expand Up @@ -50,7 +50,7 @@
organization: "Default Organization"
- name: "Find repository using a search"
redhat.satellite.repository:
redhat.satellite.repository_info:
username: "admin"
password: "changeme"
server_url: "https://satellite.example.com"
Expand Down
62 changes: 31 additions & 31 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.3.0","api_version":2}'
string: '{"result":"ok","status":200,"version":"2.5.0-develop","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.3.0
- 2.5.0-develop
Keep-Alive:
- timeout=15, max=100
Strict-Transport-Security:
Expand All @@ -51,7 +51,7 @@ interactions:
X-XSS-Protection:
- 1; mode=block
content-length:
- '62'
- '70'
status:
code: 200
message: OK
Expand Down Expand Up @@ -92,7 +92,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.3.0
- 2.5.0-develop
Keep-Alive:
- timeout=15, max=99
Strict-Transport-Security:
Expand Down Expand Up @@ -134,15 +134,15 @@ interactions:
\ \"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-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,\"\
template_id\":null,\"template_name\":null,\"bmc_id\":null,\"bmc_name\":null,\"\
dhcp\":null,\"tftp\":null,\"httpboot\":null,\"externalipam\":null,\"dns\"\
:null,\"template\":null,\"bmc\":null}]\n}\n"
:null,\"dns_secondary\":null,\"from\":null,\"to\":null,\"created_at\":\"2021-02-23\
\ 10:45:37 UTC\",\"updated_at\":\"2021-02-23 10:45:37 UTC\",\"ipam\":\"DHCP\"\
,\"boot_mode\":\"DHCP\",\"nic_delay\":null,\"id\":1,\"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,\"template_id\":null,\"template_name\":null,\"bmc_id\":null,\"\
bmc_name\":null,\"dhcp\":null,\"tftp\":null,\"httpboot\":null,\"externalipam\"\
:null,\"dns\":null,\"template\":null,\"bmc\":null}]\n}\n"
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Expand All @@ -161,7 +161,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.3.0
- 2.5.0-develop
Keep-Alive:
- timeout=15, max=98
Strict-Transport-Security:
Expand All @@ -179,7 +179,7 @@ interactions:
X-XSS-Protection:
- 1; mode=block
content-length:
- '900'
- '917'
status:
code: 200
message: OK
Expand All @@ -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-12-14\
\ 08:31:13 UTC\",\"updated_at\":\"2020-12-14 08:31:13 UTC\",\"id\":4,\"name\"\
:null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2021-02-23\
\ 10:45:33 UTC\",\"updated_at\":\"2021-02-23 10:45:33 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.3.0
- 2.5.0-develop
Keep-Alive:
- timeout=15, max=97
Strict-Transport-Security:
Expand Down Expand Up @@ -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-12-14\
\ 08:31:10 UTC\",\"updated_at\":\"2020-12-14 08:31:10 UTC\",\"id\":3,\"name\"\
:null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2021-02-23\
\ 10:45:31 UTC\",\"updated_at\":\"2021-02-23 10:45:31 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.3.0
- 2.5.0-develop
Keep-Alive:
- timeout=15, max=96
Strict-Transport-Security:
Expand All @@ -310,7 +310,7 @@ interactions:
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}]}}'
"subnet_id": 1}]}}'
headers:
Accept:
- application/json;version=2
Expand All @@ -328,15 +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":2,"domain_name":"example.net","architecture_id":null,"architecture_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"subnet_id":3,"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":1,"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-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}}'
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":"2021-02-23
10:45:42 UTC","updated_at":"2021-02-23 10:45:42 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":2,"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":[{"priority":0,"created_at":"2021-02-23
09:35:53 UTC","updated_at":"2021-02-23 09:35:53 UTC","id":2,"name":"host_registration_remote_execution","parameter_type":"boolean","value":true},{"priority":0,"created_at":"2021-02-23
09:35:53 UTC","updated_at":"2021-02-23 09:35:53 UTC","id":1,"name":"host_registration_insights","parameter_type":"boolean","value":false}],"interfaces":[{"subnet_id":1,"subnet_name":"Test
subnet4","subnet6_id":null,"subnet6_name":null,"domain_id":2,"domain_name":"example.net","created_at":"2021-02-23
10:45:42 UTC","updated_at":"2021-02-23 10:45:42 UTC","managed":true,"identifier":"fam01","id":2,"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 @@ -355,7 +355,7 @@ interactions:
Foreman_current_organization:
- 3; Test Organization
Foreman_version:
- 2.3.0
- 2.5.0-develop
Keep-Alive:
- timeout=15, max=95
Strict-Transport-Security:
Expand Down
Loading

0 comments on commit efa1b95

Please sign in to comment.