diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4e2de305..87ab327e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 8c53f674..2dcb8bb4 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -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' diff --git a/galaxy.yml b/galaxy.yml index 8229a130..13133f58 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -60,7 +60,7 @@ authors: - "metalcated " - "russianguppie <46544650+russianguppie@users.noreply.github.com>" - "willtome " -version: "1.5.0" +version: "1.5.1" license: - "GPL-3.0-or-later" tags: diff --git a/plugins/module_utils/foreman_helper.py b/plugins/module_utils/foreman_helper.py index 56cc36b4..aee0f917 100644 --- a/plugins/module_utils/foreman_helper.py +++ b/plugins/module_utils/foreman_helper.py @@ -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) diff --git a/plugins/modules/content_view_version.py b/plugins/modules/content_view_version.py index a08bf723..563032bb 100644 --- a/plugins/modules/content_view_version.py +++ b/plugins/modules/content_view_version.py @@ -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 @@ -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 @@ -162,6 +162,7 @@ ''' +import re from ansible_collections.redhat.satellite.plugins.module_utils.foreman_helper import KatelloEntityAnsibleModule @@ -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') diff --git a/plugins/modules/job_template.py b/plugins/modules/job_template.py index d71814ac..9209916a 100644 --- a/plugins/modules/job_template.py +++ b/plugins/modules/job_template.py @@ -66,7 +66,6 @@ snippet: description: - Determines whether the template shall be a snippet - default: false type: bool template: description: @@ -82,7 +81,6 @@ advanced: description: - Template Input is advanced - default: false type: bool description: description: diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-0.yml b/tests/test_playbooks/fixtures/host_interface_attributes-0.yml index 5ff399df..81a105bc 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-0.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-0.yml @@ -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 @@ -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: @@ -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: @@ -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,\"\ @@ -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: @@ -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: @@ -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: @@ -240,7 +240,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -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: @@ -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: @@ -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 @@ -319,7 +319,7 @@ interactions: Connection: - keep-alive Content-Length: - - '298' + - '294' Content-Type: - application/json User-Agent: @@ -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 @@ -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: diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-1.yml b/tests/test_playbooks/fixtures/host_interface_attributes-1.yml index d55c97df..d9483820 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-1.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-1.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -126,16 +126,18 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 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.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ3OTcsImp0aSI6ImQ4OTI3MTNmNzMyZjI5ZDM0NjUzNTBlNzE2MGI1YzVhNTYxODk5YWFlYzU3ZjVlY2NlNjA0MTgzYjIzMTkyMGYiLCJleHAiOjE2MDgwMjExOTcsIm5iZiI6MTYwNzkzMTE5N30.uDzqJwQERwjqkaSDLLbfgxoU7Fn02Bxw7dMZEjegzVg","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 @@ -154,7 +156,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -172,7 +174,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '2291' + - '2919' status: code: 200 message: OK @@ -191,14 +193,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,\"\ @@ -223,7 +225,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=97 Strict-Transport-Security: @@ -263,8 +265,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: @@ -284,7 +286,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=96 Strict-Transport-Security: @@ -302,7 +304,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -324,8 +326,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: @@ -346,7 +348,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=95 Strict-Transport-Security: @@ -364,7 +366,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '413' + - '412' status: code: 200 message: OK @@ -380,16 +382,16 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40/interfaces?per_page=4294967296 + uri: https://foreman.example.org/api/hosts/4/interfaces?per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": null,\n \"sort\": {\n \"by\": null,\n \ - \ \"order\": null\n },\n \"results\": [{\"subnet_id\":7,\"subnet_name\"\ + \ \"order\": null\n },\n \"results\": [{\"subnet_id\":3,\"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\"\ + :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}]\n\ }\n" @@ -411,7 +413,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=94 Strict-Transport-Security: @@ -429,7 +431,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '600' + - '599' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-2.yml b/tests/test_playbooks/fixtures/host_interface_attributes-2.yml index da3ba0f6..42a96373 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-2.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-2.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -126,16 +126,18 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 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.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ3OTgsImp0aSI6ImNlMWNkYWU1NTRhYjljNGMxYjMyNjY5MWE5MjIyOTEyYzNlOTg4M2VjYTViZTQwOGYwNWJiMmMxMGZmMTA4NjIiLCJleHAiOjE2MDgwMjExOTgsIm5iZiI6MTYwNzkzMTE5OH0.HJpoJDYLIkkgsbvjc1AUnagvjiwidw0sOe_cxBHADfk","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 @@ -154,7 +156,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -172,7 +174,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '2291' + - '2919' status: code: 200 message: OK @@ -191,14 +193,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,\"\ @@ -223,7 +225,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=97 Strict-Transport-Security: @@ -245,6 +247,75 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/api/subnets?search=name%3D%22Test+subnet4+Secondary%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ + : 4294967296,\n \"search\": \"name=\\\"Test subnet4 Secondary\\\"\",\n \"\ + sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ + network\":\"198.51.100.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:31:16 UTC\",\"updated_at\":\"2020-12-14 08:31:16\ + \ UTC\",\"ipam\":\"DHCP\",\"boot_mode\":\"DHCP\",\"id\":2,\"name\":\"Test\ + \ subnet4 Secondary\",\"description\":null,\"network_address\":\"198.51.100.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 + Connection: + - Keep-Alive + Content-Security-Policy: + - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' + Content-Type: + - application/json; charset=utf-8 + Foreman_api_version: + - '2' + Foreman_current_location: + - ; ANY + Foreman_current_organization: + - ; ANY + Foreman_version: + - 2.3.0 + Keep-Alive: + - timeout=15, max=96 + Strict-Transport-Security: + - max-age=631139040; includeSubdomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Frame-Options: + - sameorigin + X-Permitted-Cross-Domain-Policies: + - none + X-XSS-Protection: + - 1; mode=block + content-length: + - '926' + status: + code: 200 + message: OK - request: body: null headers: @@ -263,8 +334,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: @@ -284,9 +355,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=96 + - timeout=15, max=95 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -302,7 +373,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -324,8 +395,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: @@ -346,9 +417,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=95 + - timeout=15, max=94 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -364,7 +435,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '413' + - '412' status: code: 200 message: OK @@ -380,16 +451,16 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40/interfaces?per_page=4294967296 + uri: https://foreman.example.org/api/hosts/4/interfaces?per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": null,\n \"sort\": {\n \"by\": null,\n \ - \ \"order\": null\n },\n \"results\": [{\"subnet_id\":7,\"subnet_name\"\ + \ \"order\": null\n },\n \"results\": [{\"subnet_id\":3,\"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\"\ + :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}]\n\ }\n" @@ -411,9 +482,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=94 + - timeout=15, max=93 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -429,13 +500,13 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '600' + - '599' status: code: 200 message: OK - request: - body: '{"interface": {"mac": "ee:ff:00:00:00:02", "ip": "192.0.2.42", "type": - "interface", "identifier": "fam02"}}' + body: '{"interface": {"mac": "ee:ff:00:00:00:02", "ip": "198.51.100.42", "type": + "interface", "subnet_id": 2, "identifier": "fam02"}}' headers: Accept: - application/json;version=2 @@ -444,17 +515,17 @@ interactions: Connection: - keep-alive Content-Length: - - '107' + - '126' Content-Type: - application/json User-Agent: - apypie (https://github.com/Apipie/apypie) method: POST - uri: https://foreman.example.org/api/hosts/40/interfaces + uri: https://foreman.example.org/api/hosts/4/interfaces response: body: - string: '{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:53 UTC","updated_at":"2020-11-25 11:00:53 UTC","managed":true,"identifier":"fam02","id":52,"name":null,"ip":"192.0.2.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":null,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false}' + string: '{"subnet_id":2,"subnet_name":"Test subnet4 Secondary","subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:18 UTC","updated_at":"2020-12-14 08:33:18 UTC","managed":true,"identifier":"fam02","id":9,"name":null,"ip":"198.51.100.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":1500,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -473,9 +544,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=93 + - timeout=15, max=92 Strict-Transport-Security: - max-age=631139040; includeSubdomains Transfer-Encoding: diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-3.yml b/tests/test_playbooks/fixtures/host_interface_attributes-3.yml index af27ccbb..4bdf35be 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-3.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-3.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -126,17 +126,20 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 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},{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:53 UTC","updated_at":"2020-11-25 11:00:53 UTC","managed":true,"identifier":"fam02","id":52,"name":null,"ip":"192.0.2.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":null,"fqdn":null,"primary":false,"provision":false,"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.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ3OTksImp0aSI6ImFlZDhjNzcyZjU1NDdjNDY1YzY4ZTEyZmU0OTVmMDRlZTI2NDk1NjY2ZWNhZDY1NTI1YjBlZDdjMWU1ODQ4MGEiLCJleHAiOjE2MDgwMjExOTksIm5iZiI6MTYwNzkzMTE5OX0.y45yP0D999oKZnPnFxm6fW9eNoEalP_Efj5rPDfXOy4","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},{"subnet_id":2,"subnet_name":"Test + subnet4 Secondary","subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:18 UTC","updated_at":"2020-12-14 08:33:18 UTC","managed":true,"identifier":"fam02","id":9,"name":null,"ip":"198.51.100.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":1500,"fqdn":null,"primary":false,"provision":false,"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 @@ -155,7 +158,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -173,7 +176,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '2684' + - '3331' status: code: 200 message: OK @@ -192,14 +195,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,\"\ @@ -224,7 +227,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=97 Strict-Transport-Security: @@ -246,6 +249,75 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/api/subnets?search=name%3D%22Test+subnet4+Secondary%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ + : 4294967296,\n \"search\": \"name=\\\"Test subnet4 Secondary\\\"\",\n \"\ + sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ + network\":\"198.51.100.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:31:16 UTC\",\"updated_at\":\"2020-12-14 08:31:16\ + \ UTC\",\"ipam\":\"DHCP\",\"boot_mode\":\"DHCP\",\"id\":2,\"name\":\"Test\ + \ subnet4 Secondary\",\"description\":null,\"network_address\":\"198.51.100.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 + Connection: + - Keep-Alive + Content-Security-Policy: + - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' + Content-Type: + - application/json; charset=utf-8 + Foreman_api_version: + - '2' + Foreman_current_location: + - ; ANY + Foreman_current_organization: + - ; ANY + Foreman_version: + - 2.3.0 + Keep-Alive: + - timeout=15, max=96 + Strict-Transport-Security: + - max-age=631139040; includeSubdomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Frame-Options: + - sameorigin + X-Permitted-Cross-Domain-Policies: + - none + X-XSS-Protection: + - 1; mode=block + content-length: + - '926' + status: + code: 200 + message: OK - request: body: null headers: @@ -264,8 +336,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: @@ -285,9 +357,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=96 + - timeout=15, max=95 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -303,7 +375,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -325,8 +397,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: @@ -347,9 +419,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=95 + - timeout=15, max=94 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -365,7 +437,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '413' + - '412' status: code: 200 message: OK @@ -381,24 +453,25 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40/interfaces?per_page=4294967296 + uri: https://foreman.example.org/api/hosts/4/interfaces?per_page=4294967296 response: body: string: "{\n \"total\": 2,\n \"subtotal\": 2,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": null,\n \"sort\": {\n \"by\": null,\n \ - \ \"order\": null\n },\n \"results\": [{\"subnet_id\":7,\"subnet_name\"\ + \ \"order\": null\n },\n \"results\": [{\"subnet_id\":3,\"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\"\ + :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},{\"\ - subnet_id\":null,\"subnet_name\":null,\"subnet6_id\":null,\"subnet6_name\"\ - :null,\"domain_id\":null,\"domain_name\":null,\"created_at\":\"2020-11-25\ - \ 11:00:53 UTC\",\"updated_at\":\"2020-11-25 11:00:53 UTC\",\"managed\":true,\"\ - identifier\":\"fam02\",\"id\":52,\"name\":null,\"ip\":\"192.0.2.42\",\"ip6\"\ - :null,\"mac\":\"ee:ff:00:00:00:02\",\"mtu\":null,\"fqdn\":null,\"primary\"\ - :false,\"provision\":false,\"type\":\"interface\",\"virtual\":false}]\n}\n" + subnet_id\":2,\"subnet_name\":\"Test subnet4 Secondary\",\"subnet6_id\":null,\"\ + subnet6_name\":null,\"domain_id\":null,\"domain_name\":null,\"created_at\"\ + :\"2020-12-14 08:33:18 UTC\",\"updated_at\":\"2020-12-14 08:33:18 UTC\",\"\ + managed\":true,\"identifier\":\"fam02\",\"id\":9,\"name\":null,\"ip\":\"198.51.100.42\"\ + ,\"ip6\":null,\"mac\":\"ee:ff:00:00:00:02\",\"mtu\":1500,\"fqdn\":null,\"\ + primary\":false,\"provision\":false,\"type\":\"interface\",\"virtual\":false}]\n\ + }\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -417,9 +490,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=94 + - timeout=15, max=93 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -435,7 +508,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '993' + - '1011' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-4.yml b/tests/test_playbooks/fixtures/host_interface_attributes-4.yml index f24f9c20..256b769e 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-4.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-4.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -126,17 +126,20 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 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},{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:53 UTC","updated_at":"2020-11-25 11:00:53 UTC","managed":true,"identifier":"fam02","id":52,"name":null,"ip":"192.0.2.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":null,"fqdn":null,"primary":false,"provision":false,"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.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ4MDAsImp0aSI6ImQ4MzJmNzRkMDkxZWEzYWM3OWU3MjE1OTM4N2JjMDQ4OTFiNzBiZWUxMjhiYTMzYjg0ZTg3NWM5ZjIzNzQyNzAiLCJleHAiOjE2MDgwMjEyMDAsIm5iZiI6MTYwNzkzMTIwMH0.jOLNy4QHxCYdUB1BYNOvaHp4C5ZNyXT9yL6MQQKNkrg","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},{"subnet_id":2,"subnet_name":"Test + subnet4 Secondary","subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:18 UTC","updated_at":"2020-12-14 08:33:18 UTC","managed":true,"identifier":"fam02","id":9,"name":null,"ip":"198.51.100.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":1500,"fqdn":null,"primary":false,"provision":false,"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 @@ -155,7 +158,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -173,7 +176,76 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '2684' + - '3331' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/api/subnets?search=name%3D%22Test+subnet4+Secondary%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ + : 4294967296,\n \"search\": \"name=\\\"Test subnet4 Secondary\\\"\",\n \"\ + sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ + network\":\"198.51.100.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:31:16 UTC\",\"updated_at\":\"2020-12-14 08:31:16\ + \ UTC\",\"ipam\":\"DHCP\",\"boot_mode\":\"DHCP\",\"id\":2,\"name\":\"Test\ + \ subnet4 Secondary\",\"description\":null,\"network_address\":\"198.51.100.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 + Connection: + - Keep-Alive + Content-Security-Policy: + - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' + Content-Type: + - application/json; charset=utf-8 + Foreman_api_version: + - '2' + Foreman_current_location: + - ; ANY + Foreman_current_organization: + - ; ANY + Foreman_version: + - 2.3.0 + Keep-Alive: + - timeout=15, max=97 + Strict-Transport-Security: + - max-age=631139040; includeSubdomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Frame-Options: + - sameorigin + X-Permitted-Cross-Domain-Policies: + - none + X-XSS-Protection: + - 1; mode=block + content-length: + - '926' status: code: 200 message: OK @@ -195,8 +267,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: @@ -216,9 +288,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=97 + - timeout=15, max=96 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -234,7 +306,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -256,8 +328,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: @@ -278,9 +350,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=96 + - timeout=15, max=95 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -296,7 +368,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '413' + - '412' status: code: 200 message: OK @@ -312,24 +384,25 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40/interfaces?per_page=4294967296 + uri: https://foreman.example.org/api/hosts/4/interfaces?per_page=4294967296 response: body: string: "{\n \"total\": 2,\n \"subtotal\": 2,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": null,\n \"sort\": {\n \"by\": null,\n \ - \ \"order\": null\n },\n \"results\": [{\"subnet_id\":7,\"subnet_name\"\ + \ \"order\": null\n },\n \"results\": [{\"subnet_id\":3,\"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\"\ + :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},{\"\ - subnet_id\":null,\"subnet_name\":null,\"subnet6_id\":null,\"subnet6_name\"\ - :null,\"domain_id\":null,\"domain_name\":null,\"created_at\":\"2020-11-25\ - \ 11:00:53 UTC\",\"updated_at\":\"2020-11-25 11:00:53 UTC\",\"managed\":true,\"\ - identifier\":\"fam02\",\"id\":52,\"name\":null,\"ip\":\"192.0.2.42\",\"ip6\"\ - :null,\"mac\":\"ee:ff:00:00:00:02\",\"mtu\":null,\"fqdn\":null,\"primary\"\ - :false,\"provision\":false,\"type\":\"interface\",\"virtual\":false}]\n}\n" + subnet_id\":2,\"subnet_name\":\"Test subnet4 Secondary\",\"subnet6_id\":null,\"\ + subnet6_name\":null,\"domain_id\":null,\"domain_name\":null,\"created_at\"\ + :\"2020-12-14 08:33:18 UTC\",\"updated_at\":\"2020-12-14 08:33:18 UTC\",\"\ + managed\":true,\"identifier\":\"fam02\",\"id\":9,\"name\":null,\"ip\":\"198.51.100.42\"\ + ,\"ip6\":null,\"mac\":\"ee:ff:00:00:00:02\",\"mtu\":1500,\"fqdn\":null,\"\ + primary\":false,\"provision\":false,\"type\":\"interface\",\"virtual\":false}]\n\ + }\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -348,9 +421,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=95 + - timeout=15, max=94 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -366,7 +439,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '993' + - '1011' status: code: 200 message: OK @@ -384,10 +457,10 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: DELETE - uri: https://foreman.example.org/api/hosts/40/interfaces/51 + uri: https://foreman.example.org/api/hosts/4/interfaces/8 response: body: - string: '{"id":51,"mac":"ee:ff:00:00:00:01","ip":"192.0.2.23","name":"test-host.example.net","host_id":40,"subnet_id":7,"domain_id":8,"attrs":{},"created_at":"2020-11-25T11:00:52.147Z","updated_at":"2020-11-25T11:00:52.147Z","provider":null,"username":null,"password":null,"virtual":false,"link":true,"identifier":"fam01","tag":"","attached_to":"","managed":true,"mode":"balance-rr","attached_devices":"","bond_options":"","primary":true,"provision":true,"compute_attributes":{},"ip6":null,"subnet6_id":null}' + string: '{"id":8,"mac":"ee:ff:00:00:00:01","ip":"192.0.2.23","name":"test-host.example.net","host_id":4,"subnet_id":3,"domain_id":2,"attrs":{},"created_at":"2020-12-14T08:33:16.357Z","updated_at":"2020-12-14T08:33:16.357Z","provider":null,"username":null,"password":null,"virtual":false,"link":true,"identifier":"fam01","tag":"","attached_to":"","managed":true,"mode":"balance-rr","attached_devices":"","bond_options":"","primary":true,"provision":true,"compute_attributes":{},"ip6":null,"subnet6_id":null}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -406,9 +479,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=94 + - timeout=15, max=93 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -424,7 +497,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '499' + - '497' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-5.yml b/tests/test_playbooks/fixtures/host_interface_attributes-5.yml index 28cfd4be..2b1e3f54 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-5.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-5.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -126,14 +126,17 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 response: body: string: '{"ip":null,"ip6":null,"environment_id":null,"environment_name":null,"last_report":null,"mac":null,"realm_id":null,"realm_name":null,"sp_mac":null,"sp_ip":null,"sp_name":null,"domain_id":null,"domain_name":null,"architecture_id":null,"architecture_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"subnet_id":null,"subnet_name":null,"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":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:53 UTC","updated_at":"2020-11-25 11:00:53 UTC","managed":true,"identifier":"fam02","id":52,"name":null,"ip":"192.0.2.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":null,"fqdn":null,"primary":false,"provision":false,"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.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ4MDEsImp0aSI6ImUwOWQ5NGE2MTQ1ZmMyZjA2ZGE1M2JjNTgyYmU1ZWNlNmY1NDhiNTU4NzFkNjVkNTI2ZTllY2I0OGEwNTM1MzciLCJleHAiOjE2MDgwMjEyMDEsIm5iZiI6MTYwNzkzMTIwMX0.iRvIscaSurJvSaiGzv8U0BPNNIfiPkRNt5GqQ4BYu2Y","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":2,"subnet_name":"Test + subnet4 Secondary","subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:18 UTC","updated_at":"2020-12-14 08:33:18 UTC","managed":true,"identifier":"fam02","id":9,"name":null,"ip":"198.51.100.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":1500,"fqdn":null,"primary":false,"provision":false,"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 @@ -152,7 +155,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -170,7 +173,76 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '2206' + - '2854' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/api/subnets?search=name%3D%22Test+subnet4+Secondary%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ + : 4294967296,\n \"search\": \"name=\\\"Test subnet4 Secondary\\\"\",\n \"\ + sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ + network\":\"198.51.100.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:31:16 UTC\",\"updated_at\":\"2020-12-14 08:31:16\ + \ UTC\",\"ipam\":\"DHCP\",\"boot_mode\":\"DHCP\",\"id\":2,\"name\":\"Test\ + \ subnet4 Secondary\",\"description\":null,\"network_address\":\"198.51.100.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 + Connection: + - Keep-Alive + Content-Security-Policy: + - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' + Content-Type: + - application/json; charset=utf-8 + Foreman_api_version: + - '2' + Foreman_current_location: + - ; ANY + Foreman_current_organization: + - ; ANY + Foreman_version: + - 2.3.0 + Keep-Alive: + - timeout=15, max=97 + Strict-Transport-Security: + - max-age=631139040; includeSubdomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Frame-Options: + - sameorigin + X-Permitted-Cross-Domain-Policies: + - none + X-XSS-Protection: + - 1; mode=block + content-length: + - '926' status: code: 200 message: OK @@ -192,8 +264,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: @@ -213,9 +285,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=97 + - timeout=15, max=96 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -231,7 +303,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -253,8 +325,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: @@ -275,9 +347,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=96 + - timeout=15, max=95 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -293,7 +365,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '413' + - '412' status: code: 200 message: OK @@ -309,18 +381,18 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40/interfaces?per_page=4294967296 + uri: https://foreman.example.org/api/hosts/4/interfaces?per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": null,\n \"sort\": {\n \"by\": null,\n \ - \ \"order\": null\n },\n \"results\": [{\"subnet_id\":null,\"subnet_name\"\ - :null,\"subnet6_id\":null,\"subnet6_name\":null,\"domain_id\":null,\"domain_name\"\ - :null,\"created_at\":\"2020-11-25 11:00:53 UTC\",\"updated_at\":\"2020-11-25\ - \ 11:00:53 UTC\",\"managed\":true,\"identifier\":\"fam02\",\"id\":52,\"name\"\ - :null,\"ip\":\"192.0.2.42\",\"ip6\":null,\"mac\":\"ee:ff:00:00:00:02\",\"\ - mtu\":null,\"fqdn\":null,\"primary\":false,\"provision\":false,\"type\":\"\ - interface\",\"virtual\":false}]\n}\n" + \ \"order\": null\n },\n \"results\": [{\"subnet_id\":2,\"subnet_name\"\ + :\"Test subnet4 Secondary\",\"subnet6_id\":null,\"subnet6_name\":null,\"domain_id\"\ + :null,\"domain_name\":null,\"created_at\":\"2020-12-14 08:33:18 UTC\",\"updated_at\"\ + :\"2020-12-14 08:33:18 UTC\",\"managed\":true,\"identifier\":\"fam02\",\"\ + id\":9,\"name\":null,\"ip\":\"198.51.100.42\",\"ip6\":null,\"mac\":\"ee:ff:00:00:00:02\"\ + ,\"mtu\":1500,\"fqdn\":null,\"primary\":false,\"provision\":false,\"type\"\ + :\"interface\",\"virtual\":false}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -339,9 +411,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - - timeout=15, max=95 + - timeout=15, max=94 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -357,7 +429,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '551' + - '570' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-6.yml b/tests/test_playbooks/fixtures/host_interface_attributes-6.yml index ff28fa93..9041e312 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-6.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-6.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -126,14 +126,17 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 response: body: string: '{"ip":null,"ip6":null,"environment_id":null,"environment_name":null,"last_report":null,"mac":null,"realm_id":null,"realm_name":null,"sp_mac":null,"sp_ip":null,"sp_name":null,"domain_id":null,"domain_name":null,"architecture_id":null,"architecture_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"subnet_id":null,"subnet_name":null,"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":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:53 UTC","updated_at":"2020-11-25 11:00:53 UTC","managed":true,"identifier":"fam02","id":52,"name":null,"ip":"192.0.2.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":null,"fqdn":null,"primary":false,"provision":false,"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.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ4MDIsImp0aSI6IjVmNzJjN2IwYjFlNmY0NGQ2MWIzZjY0MDMwMTE4ZGVkNWYwZDA0NDgxODg2MzE4YzM3MzFhMDRmMTFiYmRkMDMiLCJleHAiOjE2MDgwMjEyMDIsIm5iZiI6MTYwNzkzMTIwMn0.E_gCSedeN6jW3dK9D0rVJ3Ks0tagVTJN6c0ofp7uVwQ","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":2,"subnet_name":"Test + subnet4 Secondary","subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:18 UTC","updated_at":"2020-12-14 08:33:18 UTC","managed":true,"identifier":"fam02","id":9,"name":null,"ip":"198.51.100.42","ip6":null,"mac":"ee:ff:00:00:00:02","mtu":1500,"fqdn":null,"primary":false,"provision":false,"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 @@ -152,7 +155,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -170,7 +173,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '2206' + - '2854' status: code: 200 message: OK @@ -192,8 +195,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: @@ -213,7 +216,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=97 Strict-Transport-Security: @@ -231,7 +234,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -253,8 +256,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: @@ -275,7 +278,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=96 Strict-Transport-Security: @@ -293,7 +296,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '413' + - '412' status: code: 200 message: OK @@ -309,18 +312,18 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40/interfaces?per_page=4294967296 + uri: https://foreman.example.org/api/hosts/4/interfaces?per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": null,\n \"sort\": {\n \"by\": null,\n \ - \ \"order\": null\n },\n \"results\": [{\"subnet_id\":null,\"subnet_name\"\ - :null,\"subnet6_id\":null,\"subnet6_name\":null,\"domain_id\":null,\"domain_name\"\ - :null,\"created_at\":\"2020-11-25 11:00:53 UTC\",\"updated_at\":\"2020-11-25\ - \ 11:00:53 UTC\",\"managed\":true,\"identifier\":\"fam02\",\"id\":52,\"name\"\ - :null,\"ip\":\"192.0.2.42\",\"ip6\":null,\"mac\":\"ee:ff:00:00:00:02\",\"\ - mtu\":null,\"fqdn\":null,\"primary\":false,\"provision\":false,\"type\":\"\ - interface\",\"virtual\":false}]\n}\n" + \ \"order\": null\n },\n \"results\": [{\"subnet_id\":2,\"subnet_name\"\ + :\"Test subnet4 Secondary\",\"subnet6_id\":null,\"subnet6_name\":null,\"domain_id\"\ + :null,\"domain_name\":null,\"created_at\":\"2020-12-14 08:33:18 UTC\",\"updated_at\"\ + :\"2020-12-14 08:33:18 UTC\",\"managed\":true,\"identifier\":\"fam02\",\"\ + id\":9,\"name\":null,\"ip\":\"198.51.100.42\",\"ip6\":null,\"mac\":\"ee:ff:00:00:00:02\"\ + ,\"mtu\":1500,\"fqdn\":null,\"primary\":false,\"provision\":false,\"type\"\ + :\"interface\",\"virtual\":false}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -339,7 +342,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=95 Strict-Transport-Security: @@ -357,7 +360,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '551' + - '570' status: code: 200 message: OK @@ -378,11 +381,11 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: POST - uri: https://foreman.example.org/api/hosts/40/interfaces + uri: https://foreman.example.org/api/hosts/4/interfaces response: body: - string: '{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:56 UTC","updated_at":"2020-11-25 11:00:56 UTC","managed":true,"identifier":"eth0","id":53,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false}' + string: '{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:22 UTC","updated_at":"2020-12-14 08:33:22 UTC","managed":true,"identifier":"eth0","id":10,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -401,7 +404,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=94 Strict-Transport-Security: @@ -438,11 +441,11 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: POST - uri: https://foreman.example.org/api/hosts/40/interfaces + uri: https://foreman.example.org/api/hosts/4/interfaces response: body: - string: '{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:56 UTC","updated_at":"2020-11-25 11:00:56 UTC","managed":true,"identifier":"eth1","id":54,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ee","mtu":null,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false}' + string: '{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:22 UTC","updated_at":"2020-12-14 08:33:22 UTC","managed":true,"identifier":"eth1","id":11,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ee","mtu":null,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -461,7 +464,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=93 Strict-Transport-Security: @@ -500,11 +503,11 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: POST - uri: https://foreman.example.org/api/hosts/40/interfaces + uri: https://foreman.example.org/api/hosts/4/interfaces response: body: - string: '{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":8,"domain_name":"example.net","created_at":"2020-11-25 - 11:00:56 UTC","updated_at":"2020-11-25 11:00:56 UTC","managed":true,"identifier":"bond0","id":55,"name":"test-host.example.net","ip":"192.0.2.100","ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":"test-host.example.net","primary":true,"provision":true,"type":"bond","mode":"802.3ad","attached_devices":"eth0,eth1","bond_options":"miimon=100 + string: '{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":2,"domain_name":"example.net","created_at":"2020-12-14 + 08:33:22 UTC","updated_at":"2020-12-14 08:33:22 UTC","managed":true,"identifier":"bond0","id":12,"name":"test-host.example.net","ip":"192.0.2.100","ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":"test-host.example.net","primary":true,"provision":true,"type":"bond","mode":"802.3ad","attached_devices":"eth0,eth1","bond_options":"miimon=100 lacp_rate=1","virtual":true}' headers: Cache-Control: @@ -524,7 +527,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=92 Strict-Transport-Security: @@ -558,10 +561,10 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: DELETE - uri: https://foreman.example.org/api/hosts/40/interfaces/52 + uri: https://foreman.example.org/api/hosts/4/interfaces/9 response: body: - string: '{"id":52,"mac":"ee:ff:00:00:00:02","ip":"192.0.2.42","name":null,"host_id":40,"subnet_id":null,"domain_id":null,"attrs":{},"created_at":"2020-11-25T11:00:53.769Z","updated_at":"2020-11-25T11:00:53.769Z","provider":null,"username":null,"password":null,"virtual":false,"link":true,"identifier":"fam02","tag":"","attached_to":"","managed":true,"mode":"balance-rr","attached_devices":"","bond_options":"","primary":false,"provision":false,"compute_attributes":{},"ip6":null,"subnet6_id":null}' + string: '{"id":9,"mac":"ee:ff:00:00:00:02","ip":"198.51.100.42","name":null,"host_id":4,"subnet_id":2,"domain_id":null,"attrs":{},"created_at":"2020-12-14T08:33:18.462Z","updated_at":"2020-12-14T08:33:18.462Z","provider":null,"username":null,"password":null,"virtual":false,"link":true,"identifier":"fam02","tag":"","attached_to":"","managed":true,"mode":"balance-rr","attached_devices":"","bond_options":"","primary":false,"provision":false,"compute_attributes":{},"ip6":null,"subnet6_id":null}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -580,7 +583,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=91 Strict-Transport-Security: @@ -598,7 +601,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '488' + - '486' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-7.yml b/tests/test_playbooks/fixtures/host_interface_attributes-7.yml index 93700e6c..be2732af 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-7.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-7.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -126,17 +126,19 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 response: body: - string: '{"ip":"192.0.2.100","ip6":null,"environment_id":null,"environment_name":null,"last_report":null,"mac":"aa:bb:cc:dd:ee:ff","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":null,"subnet_name":null,"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":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":8,"domain_name":"example.net","created_at":"2020-11-25 - 11:00:56 UTC","updated_at":"2020-11-25 11:00:56 UTC","managed":true,"identifier":"bond0","id":55,"name":"test-host.example.net","ip":"192.0.2.100","ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":"test-host.example.net","primary":true,"provision":true,"type":"bond","mode":"802.3ad","attached_devices":"eth0,eth1","bond_options":"miimon=100 - lacp_rate=1","virtual":true},{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:56 UTC","updated_at":"2020-11-25 11:00:56 UTC","managed":true,"identifier":"eth0","id":53,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false},{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-11-25 - 11:00:56 UTC","updated_at":"2020-11-25 11:00:56 UTC","managed":true,"identifier":"eth1","id":54,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ee","mtu":null,"fqdn":null,"primary":false,"provision":false,"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}}' + string: '{"ip":"192.0.2.100","ip6":null,"environment_id":null,"environment_name":null,"last_report":null,"mac":"aa:bb:cc:dd:ee:ff","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":null,"subnet_name":null,"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.eyJob3N0X2lkIjo0LCJpYXQiOjE2MDc5MzQ4MDMsImp0aSI6IjliZjllNGVlNzlhYzA1ZmNkM2ZjZjEyM2VlYTQxYjI0NDljMTlmMmU0MjUzZjE0YWRkMjMxMDMzMDQ2YzJmNTEiLCJleHAiOjE2MDgwMjEyMDMsIm5iZiI6MTYwNzkzMTIwM30.hG7yMrzWaMyGlqErJV9q8wPrF__eRqAbit4L14MPEeA","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":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":2,"domain_name":"example.net","created_at":"2020-12-14 + 08:33:22 UTC","updated_at":"2020-12-14 08:33:22 UTC","managed":true,"identifier":"bond0","id":12,"name":"test-host.example.net","ip":"192.0.2.100","ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":"test-host.example.net","primary":true,"provision":true,"type":"bond","mode":"802.3ad","attached_devices":"eth0,eth1","bond_options":"miimon=100 + lacp_rate=1","virtual":true},{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:22 UTC","updated_at":"2020-12-14 08:33:22 UTC","managed":true,"identifier":"eth0","id":10,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ff","mtu":null,"fqdn":null,"primary":false,"provision":false,"type":"interface","virtual":false},{"subnet_id":null,"subnet_name":null,"subnet6_id":null,"subnet6_name":null,"domain_id":null,"domain_name":null,"created_at":"2020-12-14 + 08:33:22 UTC","updated_at":"2020-12-14 08:33:22 UTC","managed":true,"identifier":"eth1","id":11,"name":null,"ip":null,"ip6":null,"mac":"aa:bb:cc:dd:ee:ee","mtu":null,"fqdn":null,"primary":false,"provision":false,"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 @@ -155,7 +157,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -173,7 +175,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '3129' + - '3758' status: code: 200 message: OK @@ -195,8 +197,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: @@ -216,7 +218,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=97 Strict-Transport-Security: @@ -234,7 +236,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '385' + - '384' status: code: 200 message: OK @@ -256,8 +258,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: @@ -278,7 +280,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=96 Strict-Transport-Security: @@ -296,7 +298,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '413' + - '412' status: code: 200 message: OK @@ -312,27 +314,27 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://foreman.example.org/api/hosts/40/interfaces?per_page=4294967296 + uri: https://foreman.example.org/api/hosts/4/interfaces?per_page=4294967296 response: body: string: "{\n \"total\": 3,\n \"subtotal\": 3,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": null,\n \"sort\": {\n \"by\": null,\n \ \ \"order\": null\n },\n \"results\": [{\"subnet_id\":null,\"subnet_name\"\ :null,\"subnet6_id\":null,\"subnet6_name\":null,\"domain_id\":null,\"domain_name\"\ - :null,\"created_at\":\"2020-11-25 11:00:56 UTC\",\"updated_at\":\"2020-11-25\ - \ 11:00:56 UTC\",\"managed\":true,\"identifier\":\"eth0\",\"id\":53,\"name\"\ + :null,\"created_at\":\"2020-12-14 08:33:22 UTC\",\"updated_at\":\"2020-12-14\ + \ 08:33:22 UTC\",\"managed\":true,\"identifier\":\"eth0\",\"id\":10,\"name\"\ :null,\"ip\":null,\"ip6\":null,\"mac\":\"aa:bb:cc:dd:ee:ff\",\"mtu\":null,\"\ fqdn\":null,\"primary\":false,\"provision\":false,\"type\":\"interface\",\"\ virtual\":false},{\"subnet_id\":null,\"subnet_name\":null,\"subnet6_id\":null,\"\ subnet6_name\":null,\"domain_id\":null,\"domain_name\":null,\"created_at\"\ - :\"2020-11-25 11:00:56 UTC\",\"updated_at\":\"2020-11-25 11:00:56 UTC\",\"\ - managed\":true,\"identifier\":\"eth1\",\"id\":54,\"name\":null,\"ip\":null,\"\ + :\"2020-12-14 08:33:22 UTC\",\"updated_at\":\"2020-12-14 08:33:22 UTC\",\"\ + managed\":true,\"identifier\":\"eth1\",\"id\":11,\"name\":null,\"ip\":null,\"\ ip6\":null,\"mac\":\"aa:bb:cc:dd:ee:ee\",\"mtu\":null,\"fqdn\":null,\"primary\"\ :false,\"provision\":false,\"type\":\"interface\",\"virtual\":false},{\"subnet_id\"\ :null,\"subnet_name\":null,\"subnet6_id\":null,\"subnet6_name\":null,\"domain_id\"\ - :8,\"domain_name\":\"example.net\",\"created_at\":\"2020-11-25 11:00:56 UTC\"\ - ,\"updated_at\":\"2020-11-25 11:00:56 UTC\",\"managed\":true,\"identifier\"\ - :\"bond0\",\"id\":55,\"name\":\"test-host.example.net\",\"ip\":\"192.0.2.100\"\ + :2,\"domain_name\":\"example.net\",\"created_at\":\"2020-12-14 08:33:22 UTC\"\ + ,\"updated_at\":\"2020-12-14 08:33:22 UTC\",\"managed\":true,\"identifier\"\ + :\"bond0\",\"id\":12,\"name\":\"test-host.example.net\",\"ip\":\"192.0.2.100\"\ ,\"ip6\":null,\"mac\":\"aa:bb:cc:dd:ee:ff\",\"mtu\":null,\"fqdn\":\"test-host.example.net\"\ ,\"primary\":true,\"provision\":true,\"type\":\"bond\",\"mode\":\"802.3ad\"\ ,\"attached_devices\":\"eth0,eth1\",\"bond_options\":\"miimon=100 lacp_rate=1\"\ @@ -355,7 +357,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=95 Strict-Transport-Security: diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-8.yml b/tests/test_playbooks/fixtures/host_interface_attributes-8.yml index ca9b4bd7..8ebc83da 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-8.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-8.yml @@ -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 @@ -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: @@ -73,7 +73,7 @@ interactions: string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\ : 4294967296,\n \"search\": \"name=\\\"test-host.example.net\\\"\",\n \"\ sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"\ - id\":40,\"name\":\"test-host.example.net\"}]\n}\n" + id\":4,\"name\":\"test-host.example.net\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -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: @@ -110,7 +110,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '227' + - '226' status: code: 200 message: OK @@ -128,10 +128,10 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: DELETE - uri: https://foreman.example.org/api/hosts/40 + uri: https://foreman.example.org/api/hosts/4 response: body: - string: '{"id":40,"name":"test-host.example.net","last_compile":null,"last_report":null,"updated_at":"2020-11-25T11:00:52.146Z","created_at":"2020-11-25T11:00:52.146Z","root_pass":null,"architecture_id":null,"operatingsystem_id":null,"environment_id":null,"ptable_id":null,"medium_id":null,"build":false,"comment":null,"disk":null,"installed_at":null,"model_id":null,"hostgroup_id":null,"owner_id":4,"owner_type":"User","enabled":true,"puppet_ca_proxy_id":null,"managed":false,"use_image":null,"image_file":"","uuid":null,"compute_resource_id":null,"puppet_proxy_id":null,"certname":"test-host.example.net","image_id":null,"organization_id":15,"location_id":16,"otp":null,"realm_id":null,"compute_profile_id":null,"provision_method":"build","grub_pass":"","global_status":0,"lookup_value_matcher":"fqdn=test-host.example.net","pxe_loader":null,"initiated_at":null,"build_errors":null}' + string: '{"id":4,"name":"test-host.example.net","last_compile":null,"last_report":null,"updated_at":"2020-12-14T08:33:16.355Z","created_at":"2020-12-14T08:33:16.355Z","root_pass":null,"architecture_id":null,"operatingsystem_id":null,"environment_id":null,"ptable_id":null,"medium_id":null,"build":false,"comment":null,"disk":null,"installed_at":null,"model_id":null,"hostgroup_id":null,"owner_id":4,"owner_type":"User","enabled":true,"puppet_ca_proxy_id":null,"managed":false,"use_image":null,"image_file":"","uuid":null,"compute_resource_id":null,"puppet_proxy_id":null,"certname":"test-host.example.net","image_id":null,"organization_id":3,"location_id":4,"otp":null,"realm_id":null,"compute_profile_id":null,"provision_method":"build","grub_pass":"","global_status":0,"lookup_value_matcher":"fqdn=test-host.example.net","pxe_loader":null,"initiated_at":null,"build_errors":null,"registration_facet_attributes":{"id":3,"host_id":4,"jwt_secret":"OzPLYeivGhlp6M7pB1ypZg==","created_at":"2020-12-14T08:33:16.420Z","updated_at":"2020-12-14T08:33:16.420Z"}}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -150,7 +150,7 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 2.2.0 + - 2.3.0 Keep-Alive: - timeout=15, max=98 Strict-Transport-Security: @@ -168,7 +168,7 @@ interactions: X-XSS-Protection: - 1; mode=block content-length: - - '875' + - '1045' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/host_interface_attributes-9.yml b/tests/test_playbooks/fixtures/host_interface_attributes-9.yml index fdc1cc30..09bde5f0 100644 --- a/tests/test_playbooks/fixtures/host_interface_attributes-9.yml +++ b/tests/test_playbooks/fixtures/host_interface_attributes-9.yml @@ -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 @@ -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: @@ -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: diff --git a/tests/test_playbooks/host_interface_attributes.yml b/tests/test_playbooks/host_interface_attributes.yml index 2c3a7c1e..b91a2048 100644 --- a/tests/test_playbooks/host_interface_attributes.yml +++ b/tests/test_playbooks/host_interface_attributes.yml @@ -37,6 +37,18 @@ subnet_organizations: - "{{ host.organization }}" subnet_state: present + - include: tasks/subnet.yml + vars: + subnet_name: "{{ host.subnet }} Secondary" + subnet_network: '198.51.100.0' + subnet_mask: '255.255.255.0' + subnet_domains: + - "{{ host.domain }}" + subnet_locations: + - "{{ host.location }}" + subnet_organizations: + - "{{ host.organization }}" + subnet_state: present - include_tasks: tasks/hostgroup.yml vars: hostgroup_name: "{{ host.hostgroup }}" @@ -117,8 +129,9 @@ subnet: "{{ host.subnet }}" - type: "interface" identifier: "fam02" - ip: "192.0.2.42" + ip: "198.51.100.42" mac: "EE:FF:00:00:00:02" + subnet: "{{ host.subnet }} Secondary" expected_change: true - name: update host, add new interface again, no change @@ -136,8 +149,9 @@ subnet: "{{ host.subnet }}" - type: "interface" identifier: "fam02" - ip: "192.0.2.42" + ip: "198.51.100.42" mac: "EE:FF:00:00:00:02" + subnet: "{{ host.subnet }} Secondary" expected_change: false - name: update host, delete interface @@ -150,8 +164,9 @@ host_interfaces_attributes: - type: "interface" identifier: "fam02" - ip: "192.0.2.42" + ip: "198.51.100.42" mac: "EE:FF:00:00:00:02" + subnet: "{{ host.subnet }} Secondary" expected_change: true - name: update host, delete interface again, no change @@ -164,8 +179,9 @@ host_interfaces_attributes: - type: "interface" identifier: "fam02" - ip: "192.0.2.42" + ip: "198.51.100.42" mac: "EE:FF:00:00:00:02" + subnet: "{{ host.subnet }} Secondary" expected_change: false - name: update host, make interfaces bond @@ -268,11 +284,22 @@ subnet_mask: '255.255.255.224' subnet_domains: [] subnet_state: present + - include_tasks: tasks/subnet.yml + vars: + subnet_name: "{{ host.subnet }} Secondary" + subnet_mask: '255.255.255.224' + subnet_domains: [] + subnet_state: present - include_tasks: tasks/subnet.yml vars: subnet_name: "{{ host.subnet }}" subnet_mask: '255.255.255.224' subnet_state: absent + - include_tasks: tasks/subnet.yml + vars: + subnet_name: "{{ host.subnet }} Secondary" + subnet_mask: '255.255.255.224' + subnet_state: absent - include_tasks: tasks/domain.yml vars: domain_name: "{{ host.domain }}"