From 7a06cb16788796b39721c5b8ae333b3c59e1c6ab Mon Sep 17 00:00:00 2001 From: Matthias Dellweg <2500@gmx.de> Date: Tue, 16 Mar 2021 12:58:43 +0100 Subject: [PATCH] Add ansible roles parameter to hostgroup module fixes #1123 --- plugins/modules/hostgroup.py | 24 + .../fixtures/luna_hostgroup-0.yml | 390 +++++++---------- .../fixtures/luna_hostgroup-1.yml | 413 +++++++++--------- .../fixtures/luna_hostgroup-2.yml | 104 ++--- .../fixtures/luna_hostgroup-3.yml | 128 +----- tests/test_playbooks/luna_hostgroup.yml | 5 + tests/test_playbooks/tasks/hostgroup.yml | 1 + 7 files changed, 413 insertions(+), 652 deletions(-) diff --git a/plugins/modules/hostgroup.py b/plugins/modules/hostgroup.py index d0c3707723..fd7629af4e 100644 --- a/plugins/modules/hostgroup.py +++ b/plugins/modules/hostgroup.py @@ -55,6 +55,12 @@ parameters: description: - Hostgroup specific host parameters + ansible_roles: + description: + - A list of ansible roles to associate with the hostgroup. + required: false + type: list + items: str extends_documentation_fragment: - theforeman.foreman.foreman - theforeman.foreman.foreman.entity_state @@ -159,6 +165,7 @@ def main(): name=dict(required=True), description=dict(), parent=dict(type='entity'), + ansible_roles=dict(type='entity_list', ensure=False), organization=dict(type='entity', required=False, ensure=False), ), argument_spec=dict( @@ -173,6 +180,7 @@ def main(): module_params = module.foreman_params with module.api_connection(): + old_entity = module.lookup_entity('entity') if not module.desired_absent: if 'organization' in module_params: if 'organizations' in module_params: @@ -182,9 +190,25 @@ def main(): module_params['organizations'] = [module_params['organization']] expected_puppetclasses = module_params.pop('puppetclasses', None) entity = module.run() + if not module.desired_absent and 'environment_id' in entity: ensure_puppetclasses(module, 'hostgroup', entity, expected_puppetclasses) + ansible_roles = module_params.get('ansible_roles') + if not module.desired_absent and ansible_roles is not None: + desired_ansible_role_ids = [item['id'] for item in ansible_roles] + current_ansible_role_ids = [ + item['id'] for item in module.resource_action( + 'hostgroups', 'ansible_roles', {'id': entity['id']}, + ignore_check_mode=True, record_change=False, + ) + ] if old_entity else [] + if set(current_ansible_role_ids) != set(desired_ansible_role_ids): + module.resource_action( + 'hostgroups', 'assign_ansible_roles', + {'id': entity['id'], 'ansible_role_ids': desired_ansible_role_ids}, + ) + if __name__ == '__main__': main() diff --git a/tests/test_playbooks/fixtures/luna_hostgroup-0.yml b/tests/test_playbooks/fixtures/luna_hostgroup-0.yml index e549e04f3a..46a7309d6d 100644 --- a/tests/test_playbooks/fixtures/luna_hostgroup-0.yml +++ b/tests/test_playbooks/fixtures/luna_hostgroup-0.yml @@ -11,27 +11,21 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/status + uri: https://foreman.example.org/api/status response: body: - string: '{"result":"ok","status":200,"version":"1.23.1","api_version":2}' + string: '{"result":"ok","status":200,"version":"2.5.0-develop","api_version":2}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - Keep-Alive - Content-Length: - - '63' Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"f26fab35869f9a602399f2f56dc6b2ef" Foreman_api_version: - '2' Foreman_current_location: @@ -39,17 +33,13 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=10000 - Server: - - Apache - Set-Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13; path=/; secure; HttpOnly; SameSite=Lax - Status: - - 200 OK + - timeout=15, max=100 Strict-Transport-Security: - max-age=631139040; includeSubdomains + Vary: + - Accept-Encoding X-Content-Type-Options: - nosniff X-Download-Options: @@ -58,14 +48,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - c6b3d20e-3994-45c6-9ca0-d3379021a6ec - X-Runtime: - - '0.103037' X-XSS-Protection: - 1; mode=block + content-length: + - '70' status: code: 200 message: OK @@ -78,12 +64,10 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 + uri: https://foreman.example.org/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 response: body: string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": @@ -96,14 +80,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"396d8c1d0d394fdd698ebcb071369922-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -111,13 +91,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9999 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=99 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -130,12 +106,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - bbd71b7b-9a0d-4b8c-bf91-4cd882411dbf - X-Runtime: - - '0.016505' X-XSS-Protection: - 1; mode=block content-length: @@ -152,18 +122,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/katello/api/organizations?search=name%3D%22Test+Org1%22&per_page=4294967296 + uri: https://foreman.example.org/katello/api/organizations?search=name%3D%22Test+Org1%22&per_page=4294967296 response: body: string: "{\n \"total\": 3,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"name=\\\"Test Org1\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org1\",\"created_at\":\"2019-12-09 - 14:27:45 UTC\",\"updated_at\":\"2019-12-09 14:27:45 UTC\",\"id\":11,\"name\":\"Test + null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org1\",\"created_at\":\"2021-03-16 + 11:04:32 UTC\",\"updated_at\":\"2021-03-16 11:04:32 UTC\",\"id\":10,\"name\":\"Test Org1\",\"title\":\"Test Org1\",\"description\":\"A test organization\"}]\n}\n" headers: Cache-Control: @@ -172,14 +140,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"6be3309e4f3f4f9ae6dea3a2986eca25-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -187,13 +151,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9998 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=98 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -206,12 +166,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - aa575e02-7eab-41c9-9b0c-a88d17d7096d - X-Runtime: - - '0.016634' X-XSS-Protection: - 1; mode=block content-length: @@ -228,18 +182,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/katello/api/organizations?search=name%3D%22Test+Org2%22&per_page=4294967296 + uri: https://foreman.example.org/katello/api/organizations?search=name%3D%22Test+Org2%22&per_page=4294967296 response: body: string: "{\n \"total\": 3,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"name=\\\"Test Org2\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org2\",\"created_at\":\"2019-12-09 - 14:28:22 UTC\",\"updated_at\":\"2019-12-09 14:28:22 UTC\",\"id\":15,\"name\":\"Test + null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org2\",\"created_at\":\"2021-03-16 + 11:04:34 UTC\",\"updated_at\":\"2021-03-16 11:04:34 UTC\",\"id\":11,\"name\":\"Test Org2\",\"title\":\"Test Org2\",\"description\":\"A test organization\"}]\n}\n" headers: Cache-Control: @@ -248,14 +200,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"41a1ec65a1e49713133c4a5bdaeb0bc9-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -263,13 +211,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9997 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=97 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -282,12 +226,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 1ad8618e-d1a8-4059-a889-a0027921e15e - X-Runtime: - - '0.017133' X-XSS-Protection: - 1; mode=block content-length: @@ -304,18 +242,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/locations?search=title%3D%22Foo%22&per_page=4294967296 + uri: https://foreman.example.org/api/locations?search=title%3D%22Foo%22&per_page=4294967296 response: body: string: "{\n \"total\": 4,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"Foo\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2019-12-09 - 14:27:41 UTC\",\"updated_at\":\"2019-12-09 14:27:41 UTC\",\"id\":8,\"name\":\"Foo\",\"title\":\"Foo\",\"description\":null}]\n}\n" + null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2021-03-16 + 10:51:22 UTC\",\"updated_at\":\"2021-03-16 10:51:22 UTC\",\"id\":3,\"name\":\"Foo\",\"title\":\"Foo\",\"description\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -323,14 +259,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"b32456db3271cb146cf5ccc3cf7fab5b-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -338,13 +270,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9996 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=96 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -357,12 +285,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - ecf7268f-0a96-4c36-993b-841de6f09a86 - X-Runtime: - - '0.016500' X-XSS-Protection: - 1; mode=block content-length: @@ -379,18 +301,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/locations?search=title%3D%22Foo%2FBaz%22&per_page=4294967296 + uri: https://foreman.example.org/api/locations?search=title%3D%22Foo%2FBaz%22&per_page=4294967296 response: body: string: "{\n \"total\": 4,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"Foo/Baz\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":\"8\",\"parent_id\":8,\"parent_name\":\"Foo\",\"created_at\":\"2019-12-09 - 14:28:19 UTC\",\"updated_at\":\"2019-12-09 14:28:19 UTC\",\"id\":13,\"name\":\"Baz\",\"title\":\"Foo/Baz\",\"description\":null}]\n}\n" + null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":\"3\",\"parent_id\":3,\"parent_name\":\"Foo\",\"created_at\":\"2021-03-16 + 11:04:29 UTC\",\"updated_at\":\"2021-03-16 11:04:29 UTC\",\"id\":8,\"name\":\"Baz\",\"title\":\"Foo/Baz\",\"description\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -398,14 +318,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"d91a838de591999dd2cfce0812d21285-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -413,13 +329,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9995 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=95 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -432,16 +344,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 2e6b6ea8-b160-4909-8729-d205a76a5349 - X-Runtime: - - '0.023232' X-XSS-Protection: - 1; mode=block content-length: - - '360' + - '359' status: code: 200 message: OK @@ -454,18 +360,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/locations?search=title%3D%22Bar%22&per_page=4294967296 + uri: https://foreman.example.org/api/locations?search=title%3D%22Bar%22&per_page=4294967296 response: body: string: "{\n \"total\": 4,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"Bar\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2019-12-09 - 14:28:20 UTC\",\"updated_at\":\"2019-12-09 14:28:20 UTC\",\"id\":14,\"name\":\"Bar\",\"title\":\"Bar\",\"description\":null}]\n}\n" + null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2021-03-16 + 11:04:30 UTC\",\"updated_at\":\"2021-03-16 11:04:30 UTC\",\"id\":9,\"name\":\"Bar\",\"title\":\"Bar\",\"description\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -473,14 +377,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"8f94aad972ec85a9889d19c811d9a6c9-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -488,13 +388,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9994 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=94 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -507,16 +403,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - bf69bd52-4978-4513-91b6-1b161c5165b2 - X-Runtime: - - '0.017449' X-XSS-Protection: - 1; mode=block content-length: - - '355' + - '354' status: code: 200 message: OK @@ -529,19 +419,20 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/smart_proxies?search=name%3D%22katello.example.com%22&per_page=4294967296 + uri: https://foreman.example.org/api/smart_proxies?search=name%3D%22centos7-luna.shu.example.com%22&per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": - 4294967296,\n \"search\": \"name=\\\"katello.example.com\\\"\",\n \"sort\": - {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"created_at\":\"2019-12-05 - 15:08:34 UTC\",\"updated_at\":\"2019-12-05 15:08:34 UTC\",\"name\":\"katello.example.com\",\"id\":1,\"url\":\"https://katello.example.com:9090\",\"download_policy\":\"on_demand\",\"features\":[{\"capabilities\":[],\"name\":\"Pulp\",\"id\":2},{\"capabilities\":[],\"name\":\"Openscap\",\"id\":16},{\"capabilities\":[],\"name\":\"DNS\",\"id\":6},{\"capabilities\":[],\"name\":\"Templates\",\"id\":1},{\"capabilities\":[],\"name\":\"TFTP\",\"id\":5},{\"capabilities\":[],\"name\":\"Puppet - CA\",\"id\":9},{\"capabilities\":[],\"name\":\"Puppet\",\"id\":8},{\"capabilities\":[],\"name\":\"BMC\",\"id\":10},{\"capabilities\":[],\"name\":\"Logs\",\"id\":13},{\"capabilities\":[],\"name\":\"HTTPBoot\",\"id\":14}]}]\n}\n" + 4294967296,\n \"search\": \"name=\\\"centos7-luna.shu.example.com\\\"\",\n + \ \"sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": + [{\"created_at\":\"2021-03-16 10:03:09 UTC\",\"updated_at\":\"2021-03-16 10:03:15 + UTC\",\"name\":\"centos7-luna.shu.example.com\",\"id\":1,\"url\":\"https://centos7-luna.shu.example.com:9090\",\"remote_execution_pubkey\":\"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQDR75cBKgge8EKlwZWAPjpdeE3uT/kV7c4NoGWButu5CwiOXV7tri8+af0DUi8wx9VjdPmxxJQDpo8NxA4dnEUlxDBsezKXdRj09da9c/fyI8no4AmcjgYyHpR2UnMLGXuxwVy9+fiLMhzeQWj6Mxp7mVv+73MfsYV+z3UFHW5H25YXiz2njbhG+gWAE8ozWWApt2QFyyKXS40be7sXVYwu6njIaUIoA9J7FxO4gTbT2/IpiPuDFJiotqmkqkQIBQEWco8Amj6OZAjhj9St3OaVSkLLZXv7HugecuQTkhbrFVzOj2rkwonfY8ZpjrdkBWD7cQVC4idKh9CHsmnLYqlZ + foreman-proxy@centos7-luna.shu.example.com\",\"download_policy\":\"on_demand\",\"supported_pulp_types\":{\"pulp2\":{\"supported_types\":[]},\"pulp3\":{\"supported_types\":[\"deb\",\"docker\",\"file\",\"yum\"],\"overriden_to_pulp2\":[]}},\"features\":[{\"capabilities\":[],\"name\":\"Discovery\",\"id\":20},{\"capabilities\":[],\"name\":\"Dynflow\",\"id\":18},{\"capabilities\":[],\"name\":\"Ansible\",\"id\":21},{\"capabilities\":[],\"name\":\"Openscap\",\"id\":22},{\"capabilities\":[],\"name\":\"SSH\",\"id\":19},{\"capabilities\":[\"pulp_certguard\",\"pulp_container\",\"pulp_deb\",\"pulp_file\",\"pulp_rpm\",\"pulpcore\"],\"name\":\"Pulpcore\",\"id\":4},{\"capabilities\":[],\"name\":\"Puppet + CA\",\"id\":10},{\"capabilities\":[],\"name\":\"Puppet\",\"id\":9},{\"capabilities\":[],\"name\":\"Logs\",\"id\":14},{\"capabilities\":[],\"name\":\"Registration\",\"id\":17}]}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -549,14 +440,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"3a5fc619df20901ef30103310c325482-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -564,13 +451,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9993 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=93 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -583,16 +466,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 5d0e6bb6-342c-41e6-bd59-6ed8562c9fba - X-Runtime: - - '0.026756' X-XSS-Protection: - 1; mode=block content-length: - - '816' + - '1530' status: code: 200 message: OK @@ -605,17 +482,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 + uri: https://foreman.example.org/ansible/api/ansible_roles?search=name%3D%22thulium_drake.motd%22&per_page=4294967296 response: body: - string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": - 4294967296,\n \"search\": \"title=\\\"New host group\\\"\",\n \"sort\": - {\n \"by\": null,\n \"order\": null\n },\n \"results\": []\n}\n" + string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"thulium_drake.motd\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"id\":1,\"name\":\"thulium_drake.motd\",\"created_at\":\"2021-03-16 + 10:23:34 UTC\",\"updated_at\":\"2021-03-16 10:23:34 UTC\"}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -623,14 +499,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"396d8c1d0d394fdd698ebcb071369922-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -638,13 +510,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9992 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=92 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -657,22 +525,16 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 367e6f71-0b9b-4694-bbc8-2ff43efef20f - X-Runtime: - - '0.020480' X-XSS-Protection: - 1; mode=block content-length: - - '181' + - '298' status: code: 200 message: OK - request: body: '{"hostgroup": {"name": "New host group", "openscap_proxy_id": 1, "location_ids": - [8, 13, 14], "organization_ids": [11, 15]}}' + [3, 8, 9], "organization_ids": [10, 11]}}' headers: Accept: - application/json;version=2 @@ -681,21 +543,19 @@ interactions: Connection: - keep-alive Content-Length: - - '124' + - '122' Content-Type: - application/json - Cookie: - - _session_id=9e49259ab342731e8c6c34d46e7d4b13 User-Agent: - apypie (https://github.com/Apipie/apypie) method: POST - uri: https://katello.example.com/api/hostgroups + uri: https://foreman.example.org/api/hostgroups response: body: - string: '{"subnet_id":null,"subnet_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"domain_id":null,"domain_name":null,"environment_id":null,"environment_name":null,"compute_profile_id":null,"compute_profile_name":null,"ancestry":null,"parent_id":null,"parent_name":null,"ptable_id":null,"ptable_name":null,"medium_id":null,"medium_name":null,"pxe_loader":null,"subnet6_id":null,"subnet6_name":null,"compute_resource_id":null,"compute_resource_name":null,"architecture_id":null,"architecture_name":null,"realm_id":null,"realm_name":null,"created_at":"2019-12-09 - 14:28:25 UTC","updated_at":"2019-12-09 14:28:25 UTC","id":8,"name":"New host - group","title":"New host group","description":null,"puppet_proxy_id":null,"puppet_proxy_name":null,"puppet_ca_proxy_id":null,"puppet_ca_proxy_name":null,"openscap_proxy_id":1,"openscap_proxy_name":"katello.example.com","puppet_proxy":null,"puppet_ca_proxy":null,"openscap_proxy":{"name":"katello.example.com","id":1,"url":"https://katello.example.com:9090"},"parameters":[],"template_combinations":[],"puppetclasses":[],"config_groups":[],"all_puppetclasses":[],"locations":[{"id":8,"name":"Foo","title":"Foo","description":null},{"id":13,"name":"Baz","title":"Foo/Baz","description":null},{"id":14,"name":"Bar","title":"Bar","description":null}],"organizations":[{"id":11,"name":"Test - Org1","title":"Test Org1","description":"A test organization"},{"id":15,"name":"Test + string: '{"subnet_id":null,"subnet_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"domain_id":null,"domain_name":null,"environment_id":null,"environment_name":null,"compute_profile_id":null,"compute_profile_name":null,"ancestry":null,"parent_id":null,"parent_name":null,"ptable_id":null,"ptable_name":null,"medium_id":null,"medium_name":null,"pxe_loader":null,"subnet6_id":null,"subnet6_name":null,"compute_resource_id":null,"compute_resource_name":null,"architecture_id":null,"architecture_name":null,"realm_id":null,"realm_name":null,"created_at":"2021-03-16 + 11:54:44 UTC","updated_at":"2021-03-16 11:54:44 UTC","id":9,"name":"New host + group","title":"New host group","description":null,"puppet_proxy_id":null,"puppet_proxy_name":null,"puppet_ca_proxy_id":null,"puppet_ca_proxy_name":null,"openscap_proxy_id":1,"openscap_proxy_name":"centos7-luna.shu.example.com","puppet_proxy":null,"puppet_ca_proxy":null,"openscap_proxy":{"name":"centos7-luna.shu.example.com","id":1,"url":"https://centos7-luna.shu.example.com:9090"},"inherited_compute_profile_id":null,"inherited_environment_id":null,"inherited_domain_id":null,"inherited_puppet_proxy_id":null,"inherited_puppet_ca_proxy_id":null,"inherited_compute_resource_id":null,"inherited_operatingsystem_id":null,"inherited_architecture_id":null,"inherited_medium_id":null,"inherited_ptable_id":null,"inherited_subnet_id":null,"inherited_subnet6_id":null,"inherited_realm_id":null,"inherited_pxe_loader":null,"parameters":[],"template_combinations":[],"puppetclasses":[],"config_groups":[],"all_puppetclasses":[],"locations":[{"id":3,"name":"Foo","title":"Foo","description":null},{"id":8,"name":"Baz","title":"Foo/Baz","description":null},{"id":9,"name":"Bar","title":"Bar","description":null}],"organizations":[{"id":10,"name":"Test + Org1","title":"Test Org1","description":"A test organization"},{"id":11,"name":"Test Org2","title":"Test Org2","description":"A test organization"}]}' headers: Cache-Control: @@ -704,14 +564,70 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + 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.5.0-develop + Keep-Alive: + - timeout=15, max=91 + Strict-Transport-Security: + - max-age=631139040; includeSubdomains + Transfer-Encoding: + - chunked + 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 + status: + code: 201 + message: Created +- request: + body: '{"ansible_role_ids": [1]}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '25' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: POST + uri: https://foreman.example.org/api/hostgroups/9/assign_ansible_roles + response: + body: + string: '{"id":9,"name":"New host group","created_at":"2021-03-16T11:54:44.185Z","updated_at":"2021-03-16T11:54:44.185Z","environment_id":null,"operatingsystem_id":null,"architecture_id":null,"medium_id":null,"ptable_id":null,"root_pass":null,"puppet_ca_proxy_id":null,"use_image":null,"image_file":"","ancestry":null,"vm_defaults":null,"subnet_id":null,"domain_id":null,"puppet_proxy_id":null,"title":"New + host group","realm_id":null,"compute_profile_id":null,"grub_pass":"","lookup_value_matcher":"hostgroup=New + host group","openscap_proxy_id":1,"subnet6_id":null,"pxe_loader":null,"description":null,"compute_resource_id":null}' + 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 - Date: - - Mon, 09 Dec 2019 14:28:25 GMT - ETag: - - W/"d14c874e8f208ea237cc47d26fe71163" Foreman_api_version: - '2' Foreman_current_location: @@ -719,15 +635,11 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9991 - Server: - - Apache - Set-Cookie: - - request_method=POST; path=/; secure; HttpOnly; SameSite=Lax - Status: - - 201 Created + - timeout=15, max=90 + Location: + - https://centos7-luna/hostgroups/9-New%20host%20group Strict-Transport-Security: - max-age=631139040; includeSubdomains Transfer-Encoding: @@ -740,12 +652,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 5f7376cc-eba7-48cf-8869-88593c4127fe - X-Runtime: - - '0.103796' X-XSS-Protection: - 1; mode=block status: diff --git a/tests/test_playbooks/fixtures/luna_hostgroup-1.yml b/tests/test_playbooks/fixtures/luna_hostgroup-1.yml index 04d0eb28ce..b051600e2a 100644 --- a/tests/test_playbooks/fixtures/luna_hostgroup-1.yml +++ b/tests/test_playbooks/fixtures/luna_hostgroup-1.yml @@ -11,27 +11,21 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/status + uri: https://foreman.example.org/api/status response: body: - string: '{"result":"ok","status":200,"version":"1.23.1","api_version":2}' + string: '{"result":"ok","status":200,"version":"2.5.0-develop","api_version":2}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - Keep-Alive - Content-Length: - - '63' Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"f26fab35869f9a602399f2f56dc6b2ef" Foreman_api_version: - '2' Foreman_current_location: @@ -39,17 +33,13 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=10000 - Server: - - Apache - Set-Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05; path=/; secure; HttpOnly; SameSite=Lax - Status: - - 200 OK + - timeout=15, max=100 Strict-Transport-Security: - max-age=631139040; includeSubdomains + Vary: + - Accept-Encoding X-Content-Type-Options: - nosniff X-Download-Options: @@ -58,14 +48,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - fce038b6-4102-4239-a3e0-63c1dd731a17 - X-Runtime: - - '0.097967' X-XSS-Protection: - 1; mode=block + content-length: + - '70' status: code: 200 message: OK @@ -78,19 +64,17 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 + uri: https://foreman.example.org/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"New host group\\\"\",\n \"sort\": - {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"subnet_id\":null,\"subnet_name\":null,\"operatingsystem_id\":null,\"operatingsystem_name\":null,\"domain_id\":null,\"domain_name\":null,\"environment_id\":null,\"environment_name\":null,\"compute_profile_id\":null,\"compute_profile_name\":null,\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"ptable_id\":null,\"ptable_name\":null,\"medium_id\":null,\"medium_name\":null,\"pxe_loader\":null,\"subnet6_id\":null,\"subnet6_name\":null,\"compute_resource_id\":null,\"compute_resource_name\":null,\"architecture_id\":null,\"architecture_name\":null,\"realm_id\":null,\"realm_name\":null,\"created_at\":\"2019-12-09 - 14:28:25 UTC\",\"updated_at\":\"2019-12-09 14:28:25 UTC\",\"id\":8,\"name\":\"New - host group\",\"title\":\"New host group\",\"description\":null,\"puppet_proxy_id\":null,\"puppet_proxy_name\":null,\"puppet_ca_proxy_id\":null,\"puppet_ca_proxy_name\":null,\"openscap_proxy_id\":1,\"openscap_proxy_name\":\"katello.example.com\",\"puppet_proxy\":null,\"puppet_ca_proxy\":null,\"openscap_proxy\":{\"name\":\"katello.example.com\",\"id\":1,\"url\":\"https://katello.example.com:9090\"}}]\n}\n" + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"subnet_id\":null,\"subnet_name\":null,\"operatingsystem_id\":null,\"operatingsystem_name\":null,\"domain_id\":null,\"domain_name\":null,\"environment_id\":null,\"environment_name\":null,\"compute_profile_id\":null,\"compute_profile_name\":null,\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"ptable_id\":null,\"ptable_name\":null,\"medium_id\":null,\"medium_name\":null,\"pxe_loader\":null,\"subnet6_id\":null,\"subnet6_name\":null,\"compute_resource_id\":null,\"compute_resource_name\":null,\"architecture_id\":null,\"architecture_name\":null,\"realm_id\":null,\"realm_name\":null,\"created_at\":\"2021-03-16 + 11:54:44 UTC\",\"updated_at\":\"2021-03-16 11:54:44 UTC\",\"id\":9,\"name\":\"New + host group\",\"title\":\"New host group\",\"description\":null,\"puppet_proxy_id\":null,\"puppet_proxy_name\":null,\"puppet_ca_proxy_id\":null,\"puppet_ca_proxy_name\":null,\"openscap_proxy_id\":1,\"openscap_proxy_name\":\"centos7-luna.shu.example.com\",\"puppet_proxy\":null,\"puppet_ca_proxy\":null,\"openscap_proxy\":{\"name\":\"centos7-luna.shu.example.com\",\"id\":1,\"url\":\"https://centos7-luna.shu.example.com:9090\"},\"inherited_compute_profile_id\":null,\"inherited_environment_id\":null,\"inherited_domain_id\":null,\"inherited_puppet_proxy_id\":null,\"inherited_puppet_ca_proxy_id\":null,\"inherited_compute_resource_id\":null,\"inherited_operatingsystem_id\":null,\"inherited_architecture_id\":null,\"inherited_medium_id\":null,\"inherited_ptable_id\":null,\"inherited_subnet_id\":null,\"inherited_subnet6_id\":null,\"inherited_realm_id\":null,\"inherited_pxe_loader\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -98,14 +82,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"394598f0443d35f9f3cce12dd4130659-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -113,13 +93,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9999 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=99 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -132,16 +108,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 1f9165a4-c772-4452-8131-f0651a8e2c94 - X-Runtime: - - '0.022047' X-XSS-Protection: - 1; mode=block content-length: - - '1186' + - '1646' status: code: 200 message: OK @@ -154,18 +124,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/hostgroups/8 + uri: https://foreman.example.org/api/hostgroups/9 response: body: - string: '{"content_source_id":null,"content_source_name":null,"content_view_id":null,"content_view_name":null,"lifecycle_environment_id":null,"lifecycle_environment_name":null,"kickstart_repository_id":null,"kickstart_repository_name":null,"subnet_id":null,"subnet_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"domain_id":null,"domain_name":null,"environment_id":null,"environment_name":null,"compute_profile_id":null,"compute_profile_name":null,"ancestry":null,"parent_id":null,"parent_name":null,"ptable_id":null,"ptable_name":null,"medium_id":null,"medium_name":null,"pxe_loader":null,"subnet6_id":null,"subnet6_name":null,"compute_resource_id":null,"compute_resource_name":null,"architecture_id":null,"architecture_name":null,"realm_id":null,"realm_name":null,"created_at":"2019-12-09 - 14:28:25 UTC","updated_at":"2019-12-09 14:28:25 UTC","id":8,"name":"New host - group","title":"New host group","description":null,"puppet_proxy_id":null,"puppet_proxy_name":null,"puppet_ca_proxy_id":null,"puppet_ca_proxy_name":null,"openscap_proxy_id":1,"openscap_proxy_name":"katello.example.com","puppet_proxy":null,"puppet_ca_proxy":null,"openscap_proxy":{"name":"katello.example.com","id":1,"url":"https://katello.example.com:9090"},"parameters":[],"template_combinations":[],"puppetclasses":[],"config_groups":[],"all_puppetclasses":[],"locations":[{"id":14,"name":"Bar","title":"Bar","description":null},{"id":8,"name":"Foo","title":"Foo","description":null},{"id":13,"name":"Baz","title":"Foo/Baz","description":null}],"organizations":[{"id":11,"name":"Test - Org1","title":"Test Org1","description":"A test organization"},{"id":15,"name":"Test + string: '{"content_source_id":null,"content_source_name":null,"content_view_id":null,"content_view_name":null,"lifecycle_environment_id":null,"lifecycle_environment_name":null,"kickstart_repository_id":null,"subnet_id":null,"subnet_name":null,"operatingsystem_id":null,"operatingsystem_name":null,"domain_id":null,"domain_name":null,"environment_id":null,"environment_name":null,"compute_profile_id":null,"compute_profile_name":null,"ancestry":null,"parent_id":null,"parent_name":null,"ptable_id":null,"ptable_name":null,"medium_id":null,"medium_name":null,"pxe_loader":null,"subnet6_id":null,"subnet6_name":null,"compute_resource_id":null,"compute_resource_name":null,"architecture_id":null,"architecture_name":null,"realm_id":null,"realm_name":null,"created_at":"2021-03-16 + 11:54:44 UTC","updated_at":"2021-03-16 11:54:44 UTC","id":9,"name":"New host + group","title":"New host group","description":null,"puppet_proxy_id":null,"puppet_proxy_name":null,"puppet_ca_proxy_id":null,"puppet_ca_proxy_name":null,"openscap_proxy_id":1,"openscap_proxy_name":"centos7-luna.shu.example.com","puppet_proxy":null,"puppet_ca_proxy":null,"openscap_proxy":{"name":"centos7-luna.shu.example.com","id":1,"url":"https://centos7-luna.shu.example.com:9090"},"inherited_compute_profile_id":null,"inherited_environment_id":null,"inherited_domain_id":null,"inherited_puppet_proxy_id":null,"inherited_puppet_ca_proxy_id":null,"inherited_compute_resource_id":null,"inherited_operatingsystem_id":null,"inherited_architecture_id":null,"inherited_medium_id":null,"inherited_ptable_id":null,"inherited_subnet_id":null,"inherited_subnet6_id":null,"inherited_realm_id":null,"inherited_pxe_loader":null,"parameters":[],"template_combinations":[],"puppetclasses":[],"config_groups":[],"all_puppetclasses":[],"locations":[{"id":9,"name":"Bar","title":"Bar","description":null},{"id":3,"name":"Foo","title":"Foo","description":null},{"id":8,"name":"Baz","title":"Foo/Baz","description":null}],"organizations":[{"id":10,"name":"Test + Org1","title":"Test Org1","description":"A test organization"},{"id":11,"name":"Test Org2","title":"Test Org2","description":"A test organization"}]}' headers: Cache-Control: @@ -174,14 +142,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"4a81d7b5e343dc38739f2882cb23b770-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -189,13 +153,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9998 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=98 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -208,16 +168,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 0d6d5a40-6de0-4ef0-b097-75f639f0639e - X-Runtime: - - '0.038008' X-XSS-Protection: - 1; mode=block content-length: - - '1712' + - '2137' status: code: 200 message: OK @@ -230,18 +184,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/katello/api/organizations?search=name%3D%22Test+Org1%22&per_page=4294967296 + uri: https://foreman.example.org/katello/api/organizations?search=name%3D%22Test+Org1%22&per_page=4294967296 response: body: string: "{\n \"total\": 3,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"name=\\\"Test Org1\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org1\",\"created_at\":\"2019-12-09 - 14:27:45 UTC\",\"updated_at\":\"2019-12-09 14:27:45 UTC\",\"id\":11,\"name\":\"Test + null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org1\",\"created_at\":\"2021-03-16 + 11:04:32 UTC\",\"updated_at\":\"2021-03-16 11:04:32 UTC\",\"id\":10,\"name\":\"Test Org1\",\"title\":\"Test Org1\",\"description\":\"A test organization\"}]\n}\n" headers: Cache-Control: @@ -250,14 +202,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"6be3309e4f3f4f9ae6dea3a2986eca25-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -265,13 +213,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9997 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=97 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -284,12 +228,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 3fd538d9-6809-4b0f-9906-f5c877e9f68e - X-Runtime: - - '0.017225' X-XSS-Protection: - 1; mode=block content-length: @@ -306,18 +244,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/katello/api/organizations?search=name%3D%22Test+Org2%22&per_page=4294967296 + uri: https://foreman.example.org/katello/api/organizations?search=name%3D%22Test+Org2%22&per_page=4294967296 response: body: string: "{\n \"total\": 3,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"name=\\\"Test Org2\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org2\",\"created_at\":\"2019-12-09 - 14:28:22 UTC\",\"updated_at\":\"2019-12-09 14:28:22 UTC\",\"id\":15,\"name\":\"Test + null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Org2\",\"created_at\":\"2021-03-16 + 11:04:34 UTC\",\"updated_at\":\"2021-03-16 11:04:34 UTC\",\"id\":11,\"name\":\"Test Org2\",\"title\":\"Test Org2\",\"description\":\"A test organization\"}]\n}\n" headers: Cache-Control: @@ -326,14 +262,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"41a1ec65a1e49713133c4a5bdaeb0bc9-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -341,13 +273,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9996 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=96 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -360,12 +288,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - e801c6af-0914-4acc-8315-1c498058fa57 - X-Runtime: - - '0.016790' X-XSS-Protection: - 1; mode=block content-length: @@ -382,18 +304,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/locations?search=title%3D%22Foo%22&per_page=4294967296 + uri: https://foreman.example.org/api/locations?search=title%3D%22Foo%22&per_page=4294967296 response: body: string: "{\n \"total\": 4,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"Foo\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2019-12-09 - 14:27:41 UTC\",\"updated_at\":\"2019-12-09 14:27:41 UTC\",\"id\":8,\"name\":\"Foo\",\"title\":\"Foo\",\"description\":null}]\n}\n" + null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2021-03-16 + 10:51:22 UTC\",\"updated_at\":\"2021-03-16 10:51:22 UTC\",\"id\":3,\"name\":\"Foo\",\"title\":\"Foo\",\"description\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -401,14 +321,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"b32456db3271cb146cf5ccc3cf7fab5b-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -416,13 +332,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9995 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=95 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -435,12 +347,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 819a0e67-4a69-4a60-835a-9fe14d6aa48b - X-Runtime: - - '0.016222' X-XSS-Protection: - 1; mode=block content-length: @@ -457,18 +363,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/locations?search=title%3D%22Foo%2FBaz%22&per_page=4294967296 + uri: https://foreman.example.org/api/locations?search=title%3D%22Foo%2FBaz%22&per_page=4294967296 response: body: string: "{\n \"total\": 4,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"Foo/Baz\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":\"8\",\"parent_id\":8,\"parent_name\":\"Foo\",\"created_at\":\"2019-12-09 - 14:28:19 UTC\",\"updated_at\":\"2019-12-09 14:28:19 UTC\",\"id\":13,\"name\":\"Baz\",\"title\":\"Foo/Baz\",\"description\":null}]\n}\n" + null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":\"3\",\"parent_id\":3,\"parent_name\":\"Foo\",\"created_at\":\"2021-03-16 + 11:04:29 UTC\",\"updated_at\":\"2021-03-16 11:04:29 UTC\",\"id\":8,\"name\":\"Baz\",\"title\":\"Foo/Baz\",\"description\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -476,14 +380,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"d91a838de591999dd2cfce0812d21285-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -491,13 +391,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9994 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=94 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -510,16 +406,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 98bdac06-f9d6-448b-976d-c367bc46c21c - X-Runtime: - - '0.017015' X-XSS-Protection: - 1; mode=block content-length: - - '360' + - '359' status: code: 200 message: OK @@ -532,18 +422,16 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/locations?search=title%3D%22Bar%22&per_page=4294967296 + uri: https://foreman.example.org/api/locations?search=title%3D%22Bar%22&per_page=4294967296 response: body: string: "{\n \"total\": 4,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"Bar\\\"\",\n \"sort\": {\n \"by\": - null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2019-12-09 - 14:28:20 UTC\",\"updated_at\":\"2019-12-09 14:28:20 UTC\",\"id\":14,\"name\":\"Bar\",\"title\":\"Bar\",\"description\":null}]\n}\n" + null,\n \"order\": null\n },\n \"results\": [{\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"created_at\":\"2021-03-16 + 11:04:30 UTC\",\"updated_at\":\"2021-03-16 11:04:30 UTC\",\"id\":9,\"name\":\"Bar\",\"title\":\"Bar\",\"description\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -551,14 +439,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"8f94aad972ec85a9889d19c811d9a6c9-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -566,13 +450,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9993 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=93 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -585,16 +465,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 6fc7024e-06cf-4270-bbfd-a9eedc4c987c - X-Runtime: - - '0.015747' X-XSS-Protection: - 1; mode=block content-length: - - '355' + - '354' status: code: 200 message: OK @@ -607,19 +481,136 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=6ba38324430d49d1dc8f18ab07ec7b05 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/smart_proxies?search=name%3D%22katello.example.com%22&per_page=4294967296 + uri: https://foreman.example.org/api/smart_proxies?search=name%3D%22centos7-luna.shu.example.com%22&per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": - 4294967296,\n \"search\": \"name=\\\"katello.example.com\\\"\",\n \"sort\": - {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"created_at\":\"2019-12-05 - 15:08:34 UTC\",\"updated_at\":\"2019-12-05 15:08:34 UTC\",\"name\":\"katello.example.com\",\"id\":1,\"url\":\"https://katello.example.com:9090\",\"download_policy\":\"on_demand\",\"features\":[{\"capabilities\":[],\"name\":\"Pulp\",\"id\":2},{\"capabilities\":[],\"name\":\"Openscap\",\"id\":16},{\"capabilities\":[],\"name\":\"DNS\",\"id\":6},{\"capabilities\":[],\"name\":\"Templates\",\"id\":1},{\"capabilities\":[],\"name\":\"TFTP\",\"id\":5},{\"capabilities\":[],\"name\":\"Puppet - CA\",\"id\":9},{\"capabilities\":[],\"name\":\"Puppet\",\"id\":8},{\"capabilities\":[],\"name\":\"BMC\",\"id\":10},{\"capabilities\":[],\"name\":\"Logs\",\"id\":13},{\"capabilities\":[],\"name\":\"HTTPBoot\",\"id\":14}]}]\n}\n" + 4294967296,\n \"search\": \"name=\\\"centos7-luna.shu.example.com\\\"\",\n + \ \"sort\": {\n \"by\": null,\n \"order\": null\n },\n \"results\": + [{\"created_at\":\"2021-03-16 10:03:09 UTC\",\"updated_at\":\"2021-03-16 10:03:15 + UTC\",\"name\":\"centos7-luna.shu.example.com\",\"id\":1,\"url\":\"https://centos7-luna.shu.example.com:9090\",\"remote_execution_pubkey\":\"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQDR75cBKgge8EKlwZWAPjpdeE3uT/kV7c4NoGWButu5CwiOXV7tri8+af0DUi8wx9VjdPmxxJQDpo8NxA4dnEUlxDBsezKXdRj09da9c/fyI8no4AmcjgYyHpR2UnMLGXuxwVy9+fiLMhzeQWj6Mxp7mVv+73MfsYV+z3UFHW5H25YXiz2njbhG+gWAE8ozWWApt2QFyyKXS40be7sXVYwu6njIaUIoA9J7FxO4gTbT2/IpiPuDFJiotqmkqkQIBQEWco8Amj6OZAjhj9St3OaVSkLLZXv7HugecuQTkhbrFVzOj2rkwonfY8ZpjrdkBWD7cQVC4idKh9CHsmnLYqlZ + foreman-proxy@centos7-luna.shu.example.com\",\"download_policy\":\"on_demand\",\"supported_pulp_types\":{\"pulp2\":{\"supported_types\":[]},\"pulp3\":{\"supported_types\":[\"deb\",\"docker\",\"file\",\"yum\"],\"overriden_to_pulp2\":[]}},\"features\":[{\"capabilities\":[],\"name\":\"Discovery\",\"id\":20},{\"capabilities\":[],\"name\":\"Dynflow\",\"id\":18},{\"capabilities\":[],\"name\":\"Ansible\",\"id\":21},{\"capabilities\":[],\"name\":\"Openscap\",\"id\":22},{\"capabilities\":[],\"name\":\"SSH\",\"id\":19},{\"capabilities\":[\"pulp_certguard\",\"pulp_container\",\"pulp_deb\",\"pulp_file\",\"pulp_rpm\",\"pulpcore\"],\"name\":\"Pulpcore\",\"id\":4},{\"capabilities\":[],\"name\":\"Puppet + CA\",\"id\":10},{\"capabilities\":[],\"name\":\"Puppet\",\"id\":9},{\"capabilities\":[],\"name\":\"Logs\",\"id\":14},{\"capabilities\":[],\"name\":\"Registration\",\"id\":17}]}]\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.5.0-develop + Keep-Alive: + - timeout=15, max=92 + 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: + - '1530' + 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/ansible/api/ansible_roles?search=name%3D%22thulium_drake.motd%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"thulium_drake.motd\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"id\":1,\"name\":\"thulium_drake.motd\",\"created_at\":\"2021-03-16 + 10:23:34 UTC\",\"updated_at\":\"2021-03-16 10:23:34 UTC\"}]\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.5.0-develop + Keep-Alive: + - timeout=15, max=91 + 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: + - '298' + 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/hostgroups/9/ansible_roles + response: + body: + string: '[{"id":1,"name":"thulium_drake.motd","created_at":"2021-03-16 10:23:34 + UTC","updated_at":"2021-03-16 10:23:34 UTC"}]' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -627,14 +618,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:26 GMT - ETag: - - W/"3a5fc619df20901ef30103310c325482-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -642,13 +629,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9992 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=90 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -661,16 +644,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 89e4cfdb-7598-411a-b588-9357137c9918 - X-Runtime: - - '0.022489' X-XSS-Protection: - 1; mode=block content-length: - - '816' + - '116' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/luna_hostgroup-2.yml b/tests/test_playbooks/fixtures/luna_hostgroup-2.yml index 6b6b1734f2..546d9c755b 100644 --- a/tests/test_playbooks/fixtures/luna_hostgroup-2.yml +++ b/tests/test_playbooks/fixtures/luna_hostgroup-2.yml @@ -11,27 +11,21 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/status + uri: https://foreman.example.org/api/status response: body: - string: '{"result":"ok","status":200,"version":"1.23.1","api_version":2}' + string: '{"result":"ok","status":200,"version":"2.5.0-develop","api_version":2}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - Keep-Alive - Content-Length: - - '63' Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:27 GMT - ETag: - - W/"f26fab35869f9a602399f2f56dc6b2ef" Foreman_api_version: - '2' Foreman_current_location: @@ -39,17 +33,13 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=10000 - Server: - - Apache - Set-Cookie: - - _session_id=1f21c2a34b67a5d96c31904614024b11; path=/; secure; HttpOnly; SameSite=Lax - Status: - - 200 OK + - timeout=15, max=100 Strict-Transport-Security: - max-age=631139040; includeSubdomains + Vary: + - Accept-Encoding X-Content-Type-Options: - nosniff X-Download-Options: @@ -58,14 +48,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 30eb7ef7-d5f8-4cfb-a3dc-f0667e7d39c6 - X-Runtime: - - '0.098008' X-XSS-Protection: - 1; mode=block + content-length: + - '70' status: code: 200 message: OK @@ -78,19 +64,17 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=1f21c2a34b67a5d96c31904614024b11 User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 + uri: https://foreman.example.org/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 response: body: string: "{\n \"total\": 1,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": 4294967296,\n \"search\": \"title=\\\"New host group\\\"\",\n \"sort\": - {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"subnet_id\":null,\"subnet_name\":null,\"operatingsystem_id\":null,\"operatingsystem_name\":null,\"domain_id\":null,\"domain_name\":null,\"environment_id\":null,\"environment_name\":null,\"compute_profile_id\":null,\"compute_profile_name\":null,\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"ptable_id\":null,\"ptable_name\":null,\"medium_id\":null,\"medium_name\":null,\"pxe_loader\":null,\"subnet6_id\":null,\"subnet6_name\":null,\"compute_resource_id\":null,\"compute_resource_name\":null,\"architecture_id\":null,\"architecture_name\":null,\"realm_id\":null,\"realm_name\":null,\"created_at\":\"2019-12-09 - 14:28:25 UTC\",\"updated_at\":\"2019-12-09 14:28:25 UTC\",\"id\":8,\"name\":\"New - host group\",\"title\":\"New host group\",\"description\":null,\"puppet_proxy_id\":null,\"puppet_proxy_name\":null,\"puppet_ca_proxy_id\":null,\"puppet_ca_proxy_name\":null,\"openscap_proxy_id\":1,\"openscap_proxy_name\":\"katello.example.com\",\"puppet_proxy\":null,\"puppet_ca_proxy\":null,\"openscap_proxy\":{\"name\":\"katello.example.com\",\"id\":1,\"url\":\"https://katello.example.com:9090\"}}]\n}\n" + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"subnet_id\":null,\"subnet_name\":null,\"operatingsystem_id\":null,\"operatingsystem_name\":null,\"domain_id\":null,\"domain_name\":null,\"environment_id\":null,\"environment_name\":null,\"compute_profile_id\":null,\"compute_profile_name\":null,\"ancestry\":null,\"parent_id\":null,\"parent_name\":null,\"ptable_id\":null,\"ptable_name\":null,\"medium_id\":null,\"medium_name\":null,\"pxe_loader\":null,\"subnet6_id\":null,\"subnet6_name\":null,\"compute_resource_id\":null,\"compute_resource_name\":null,\"architecture_id\":null,\"architecture_name\":null,\"realm_id\":null,\"realm_name\":null,\"created_at\":\"2021-03-16 + 11:54:44 UTC\",\"updated_at\":\"2021-03-16 11:54:44 UTC\",\"id\":9,\"name\":\"New + host group\",\"title\":\"New host group\",\"description\":null,\"puppet_proxy_id\":null,\"puppet_proxy_name\":null,\"puppet_ca_proxy_id\":null,\"puppet_ca_proxy_name\":null,\"openscap_proxy_id\":1,\"openscap_proxy_name\":\"centos7-luna.shu.example.com\",\"puppet_proxy\":null,\"puppet_ca_proxy\":null,\"openscap_proxy\":{\"name\":\"centos7-luna.shu.example.com\",\"id\":1,\"url\":\"https://centos7-luna.shu.example.com:9090\"},\"inherited_compute_profile_id\":null,\"inherited_environment_id\":null,\"inherited_domain_id\":null,\"inherited_puppet_proxy_id\":null,\"inherited_puppet_ca_proxy_id\":null,\"inherited_compute_resource_id\":null,\"inherited_operatingsystem_id\":null,\"inherited_architecture_id\":null,\"inherited_medium_id\":null,\"inherited_ptable_id\":null,\"inherited_subnet_id\":null,\"inherited_subnet6_id\":null,\"inherited_realm_id\":null,\"inherited_pxe_loader\":null}]\n}\n" headers: Cache-Control: - max-age=0, private, must-revalidate @@ -98,14 +82,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:27 GMT - ETag: - - W/"394598f0443d35f9f3cce12dd4130659-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -113,13 +93,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9999 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=99 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -132,16 +108,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 457f75fb-5c45-4f9f-aeba-7f118def1416 - X-Runtime: - - '0.018137' X-XSS-Protection: - 1; mode=block content-length: - - '1186' + - '1646' status: code: 200 message: OK @@ -156,17 +126,15 @@ interactions: - keep-alive Content-Length: - '0' - Cookie: - - _session_id=1f21c2a34b67a5d96c31904614024b11 User-Agent: - apypie (https://github.com/Apipie/apypie) method: DELETE - uri: https://katello.example.com/api/hostgroups/8 + uri: https://foreman.example.org/api/hostgroups/9 response: body: - string: '{"id":8,"name":"New host group","created_at":"2019-12-09T14:28:25.907Z","updated_at":"2019-12-09T14:28:25.907Z","environment_id":null,"operatingsystem_id":null,"architecture_id":null,"medium_id":null,"ptable_id":null,"root_pass":null,"puppet_ca_proxy_id":null,"use_image":null,"image_file":"","ancestry":null,"vm_defaults":null,"subnet_id":null,"domain_id":null,"puppet_proxy_id":null,"title":"New - host group","realm_id":null,"compute_profile_id":null,"content_source_id":null,"grub_pass":"","content_view_id":null,"lifecycle_environment_id":null,"lookup_value_matcher":"hostgroup=New - host group","kickstart_repository_id":null,"subnet6_id":null,"pxe_loader":null,"description":null,"compute_resource_id":null,"openscap_proxy_id":1}' + string: '{"id":9,"name":"New host group","created_at":"2021-03-16T11:54:44.185Z","updated_at":"2021-03-16T11:54:44.185Z","environment_id":null,"operatingsystem_id":null,"architecture_id":null,"medium_id":null,"ptable_id":null,"root_pass":null,"puppet_ca_proxy_id":null,"use_image":null,"image_file":"","ancestry":null,"vm_defaults":null,"subnet_id":null,"domain_id":null,"puppet_proxy_id":null,"title":"New + host group","realm_id":null,"compute_profile_id":null,"grub_pass":"","lookup_value_matcher":"hostgroup=New + host group","openscap_proxy_id":1,"subnet6_id":null,"pxe_loader":null,"description":null,"compute_resource_id":null}' headers: Cache-Control: - max-age=0, private, must-revalidate @@ -174,14 +142,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:27 GMT - ETag: - - W/"ef4982856e1dd37e0342606b32d99b23-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -189,15 +153,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9998 - Server: - - Apache - Set-Cookie: - - request_method=DELETE; path=/; secure; HttpOnly; SameSite=Lax - Status: - - 200 OK + - timeout=15, max=98 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -210,16 +168,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - ddfb1911-1292-410b-85b6-3f81ffd337cd - X-Runtime: - - '0.053429' X-XSS-Protection: - 1; mode=block content-length: - - '732' + - '621' status: code: 200 message: OK diff --git a/tests/test_playbooks/fixtures/luna_hostgroup-3.yml b/tests/test_playbooks/fixtures/luna_hostgroup-3.yml index 8732362db7..424569ee66 100644 --- a/tests/test_playbooks/fixtures/luna_hostgroup-3.yml +++ b/tests/test_playbooks/fixtures/luna_hostgroup-3.yml @@ -11,27 +11,21 @@ interactions: User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/status + uri: https://foreman.example.org/api/status response: body: - string: '{"result":"ok","status":200,"version":"1.23.1","api_version":2}' + string: '{"result":"ok","status":200,"version":"2.5.0-develop","api_version":2}' headers: Cache-Control: - max-age=0, private, must-revalidate Connection: - Keep-Alive - Content-Length: - - '63' Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:27 GMT - ETag: - - W/"f26fab35869f9a602399f2f56dc6b2ef" Foreman_api_version: - '2' Foreman_current_location: @@ -39,85 +33,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=10000 - Server: - - Apache - Set-Cookie: - - _session_id=1adb71aaae1c9a1f3b18a0245a6fe4cc; path=/; secure; HttpOnly; SameSite=Lax - Status: - - 200 OK - Strict-Transport-Security: - - max-age=631139040; includeSubdomains - X-Content-Type-Options: - - nosniff - X-Download-Options: - - noopen - X-Frame-Options: - - sameorigin - X-Permitted-Cross-Domain-Policies: - - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 2652d84b-f032-4376-a3c5-a247d87d7c72 - X-Runtime: - - '0.097978' - X-XSS-Protection: - - 1; mode=block - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json;version=2 - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Cookie: - - _session_id=1adb71aaae1c9a1f3b18a0245a6fe4cc - User-Agent: - - apypie (https://github.com/Apipie/apypie) - method: GET - uri: https://katello.example.com/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 - response: - body: - string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": - 4294967296,\n \"search\": \"title=\\\"New host group\\\"\",\n \"sort\": - {\n \"by\": null,\n \"order\": null\n },\n \"results\": []\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: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' - Content-Type: - - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:27 GMT - ETag: - - W/"396d8c1d0d394fdd698ebcb071369922-gzip" - Foreman_api_version: - - '2' - Foreman_current_location: - - ; ANY - Foreman_current_organization: - - ; ANY - Foreman_version: - - 1.23.1 - Keep-Alive: - - timeout=5, max=9999 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=100 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -130,16 +48,10 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - 1e4ac1c2-d94c-4b13-8cfe-5bcb5ebf1dab - X-Runtime: - - '0.015445' X-XSS-Protection: - 1; mode=block content-length: - - '181' + - '70' status: code: 200 message: OK @@ -152,12 +64,10 @@ interactions: - gzip, deflate Connection: - keep-alive - Cookie: - - _session_id=1adb71aaae1c9a1f3b18a0245a6fe4cc User-Agent: - apypie (https://github.com/Apipie/apypie) method: GET - uri: https://katello.example.com/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 + uri: https://foreman.example.org/api/hostgroups?search=title%3D%22New+host+group%22&per_page=4294967296 response: body: string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": @@ -170,14 +80,10 @@ interactions: - Keep-Alive Content-Security-Policy: - 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:; - img-src ''self'' data: *.gravatar.com; script-src ''unsafe-eval'' ''unsafe-inline'' - ''self''; style-src ''unsafe-inline'' ''self''' + img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self''; + style-src ''unsafe-inline'' ''self''' Content-Type: - application/json; charset=utf-8 - Date: - - Mon, 09 Dec 2019 14:28:27 GMT - ETag: - - W/"396d8c1d0d394fdd698ebcb071369922-gzip" Foreman_api_version: - '2' Foreman_current_location: @@ -185,13 +91,9 @@ interactions: Foreman_current_organization: - ; ANY Foreman_version: - - 1.23.1 + - 2.5.0-develop Keep-Alive: - - timeout=5, max=9998 - Server: - - Apache - Status: - - 200 OK + - timeout=15, max=99 Strict-Transport-Security: - max-age=631139040; includeSubdomains Vary: @@ -204,12 +106,6 @@ interactions: - sameorigin X-Permitted-Cross-Domain-Policies: - none - X-Powered-By: - - Phusion Passenger 4.0.53 - X-Request-Id: - - d33c16a6-603e-41f6-a9c2-96c001da895d - X-Runtime: - - '0.015153' X-XSS-Protection: - 1; mode=block content-length: diff --git a/tests/test_playbooks/luna_hostgroup.yml b/tests/test_playbooks/luna_hostgroup.yml index df920566a6..bb5fef9876 100644 --- a/tests/test_playbooks/luna_hostgroup.yml +++ b/tests/test_playbooks/luna_hostgroup.yml @@ -1,3 +1,4 @@ +# `ansible-galaxy role install thulium_drake.motd -p /usr/share/ansible/roles` --- - hosts: localhost collections: @@ -35,6 +36,8 @@ hostgroup_locations: "{{ hostgroup.locations }}" hostgroup_organizations: "{{ hostgroup.organizations }}" hostgroup_openscap_proxy: "{{ hostgroup.openscap_proxy }}" + hostgroup_ansible_roles: + - thulium_drake.motd hostgroup_state: present expected_change: true @@ -44,6 +47,8 @@ hostgroup_locations: "{{ hostgroup.locations }}" hostgroup_organizations: "{{ hostgroup.organizations }}" hostgroup_openscap_proxy: "{{ hostgroup.openscap_proxy }}" + hostgroup_ansible_roles: + - thulium_drake.motd hostgroup_state: present expected_change: false diff --git a/tests/test_playbooks/tasks/hostgroup.yml b/tests/test_playbooks/tasks/hostgroup.yml index a0e675f553..b17220d379 100644 --- a/tests/test_playbooks/tasks/hostgroup.yml +++ b/tests/test_playbooks/tasks/hostgroup.yml @@ -36,6 +36,7 @@ content_source: "{{ hostgroup_content_source | default(omit) }}" lifecycle_environment: "{{ hostgroup_lifecycle_environment | default(omit) }}" content_view: "{{ hostgroup_content_view | default(omit) }}" + ansible_roles: "{{ hostgroup_ansible_roles | default(omit) }}" parameters: "{{ hostgroup_parameters | default(omit) }}" state: "{{ hostgroup_state }}" register: result