From 9f33316cdbcb750b4025ba2cf2b9e5e1bd902f5d Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 15 Aug 2023 08:13:12 +0200 Subject: [PATCH 01/11] Bump version to 3.14.0-dev --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index 72a7aa3b..6fba54ec 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -98,7 +98,7 @@ authors: - "russianguppie <46544650+russianguppie@users.noreply.github.com>" - "willtome " - "yuqo2450 <79540477+yuqo2450@users.noreply.github.com>" -version: "3.13.0" +version: "3.14.0-dev" license: - "GPL-3.0-or-later" tags: From b41b65ef0c83adefb97e968ed5094bcf0c55bbd5 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 15 Aug 2023 09:25:49 +0200 Subject: [PATCH 02/11] add smart_class_parameter_override_value module --- meta/runtime.yml | 1 + .../smart_class_parameter_override_value.py | 131 ++++++++ .../smart_class_parameter_override_value.json | 1 + ...smart_class_parameter_override_value-0.yml | 284 +++++++++++++++++ ...smart_class_parameter_override_value-1.yml | 226 ++++++++++++++ ...mart_class_parameter_override_value-10.yml | 283 +++++++++++++++++ ...mart_class_parameter_override_value-11.yml | 225 ++++++++++++++ ...mart_class_parameter_override_value-12.yml | 284 +++++++++++++++++ ...mart_class_parameter_override_value-13.yml | 226 ++++++++++++++ ...mart_class_parameter_override_value-14.yml | 285 ++++++++++++++++++ ...mart_class_parameter_override_value-15.yml | 226 ++++++++++++++ ...mart_class_parameter_override_value-16.yml | 283 +++++++++++++++++ ...mart_class_parameter_override_value-17.yml | 225 ++++++++++++++ ...mart_class_parameter_override_value-18.yml | 284 +++++++++++++++++ ...mart_class_parameter_override_value-19.yml | 226 ++++++++++++++ ...smart_class_parameter_override_value-2.yml | 285 ++++++++++++++++++ ...mart_class_parameter_override_value-20.yml | 285 ++++++++++++++++++ ...mart_class_parameter_override_value-21.yml | 226 ++++++++++++++ ...mart_class_parameter_override_value-22.yml | 283 +++++++++++++++++ ...mart_class_parameter_override_value-23.yml | 225 ++++++++++++++ ...smart_class_parameter_override_value-3.yml | 226 ++++++++++++++ ...smart_class_parameter_override_value-4.yml | 283 +++++++++++++++++ ...smart_class_parameter_override_value-5.yml | 225 ++++++++++++++ ...smart_class_parameter_override_value-6.yml | 284 +++++++++++++++++ ...smart_class_parameter_override_value-7.yml | 226 ++++++++++++++ ...smart_class_parameter_override_value-8.yml | 285 ++++++++++++++++++ ...smart_class_parameter_override_value-9.yml | 226 ++++++++++++++ .../smart_class_parameter_override_value.yml | 245 +++++++++++++++ .../smart_class_parameter_override_value.yml | 20 ++ 29 files changed, 6514 insertions(+) create mode 100644 plugins/modules/smart_class_parameter_override_value.py create mode 120000 tests/fixtures/apidoc/smart_class_parameter_override_value.json create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-0.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-1.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-10.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-11.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-12.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-13.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-14.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-15.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-16.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-17.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-18.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-19.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-2.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-20.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-21.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-22.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-23.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-3.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-4.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-5.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-6.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-7.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-8.yml create mode 100644 tests/test_playbooks/fixtures/smart_class_parameter_override_value-9.yml create mode 100644 tests/test_playbooks/smart_class_parameter_override_value.yml create mode 100644 tests/test_playbooks/tasks/smart_class_parameter_override_value.yml diff --git a/meta/runtime.yml b/meta/runtime.yml index de3ff9c8..5080fa51 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -67,6 +67,7 @@ action_groups: - setting - setting_info - smart_class_parameter + - smart_class_parameter_override_value - smart_proxy - snapshot - snapshot_info diff --git a/plugins/modules/smart_class_parameter_override_value.py b/plugins/modules/smart_class_parameter_override_value.py new file mode 100644 index 00000000..f8d38435 --- /dev/null +++ b/plugins/modules/smart_class_parameter_override_value.py @@ -0,0 +1,131 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# (c) 2023 Evgeni Golov +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + + +DOCUMENTATION = ''' +--- +module: smart_class_parameter_override_value +version_added: 3.14.0 +short_description: Manage Smart Class Parameter Override Values +description: + - Manage Smart Class Parameter Override Values +author: + - "Evgeni Golov (@evgeni)" +options: + puppetclass: + description: + - Puppet Class the Smart Class Parameter belongs to + type: str + required: true + aliases: + - puppetclass_name + smart_class_parameter: + description: + - Smart Class Parameter the Override Value belongs to + required: true + type: str + aliases: + - parameter + match: + description: + - Override match + required: true + type: str + omit: + description: + - Foreman will not send this parameter in classification output + required: false + type: bool + value: + description: + - Override value, required if omit is false + required: false + type: raw + +extends_documentation_fragment: + - theforeman.foreman.foreman + - theforeman.foreman.foreman.entity_state +''' + +EXAMPLES = ''' +- name: Set ntp::servers override value + theforeman.foreman.smart_class_parameter_override_value: + server_url: "https://foreman.example.com" + username: "admin" + password: "changeme" + puppetclass: ntp + smart_class_parameter: servers + match: domain=example.org + value: + - ntp1.example.org + - ntp2.example.org + state: present +''' + +RETURN = ''' +entity: + description: Final state of the affected entities grouped by their type. + returned: success + type: dict + contains: + override_values: + description: List of override_values. + type: list + elements: dict +''' + +from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanEntityAnsibleModule, parameter_value_to_str + + +class ForemanOverrideValueModule(ForemanEntityAnsibleModule): + pass + + +def main(): + module = ForemanOverrideValueModule( + foreman_spec=dict( + puppetclass=dict(required=True, type='entity', ensure=False, aliases=['puppetclass_name']), + smart_class_parameter=dict(required=True, type='entity', scope=['puppetclass'], search_by='parameter', aliases=['parameter']), + match=dict(required=True, type='str'), + value=dict(required=False, type='raw'), + omit=dict(required=False, type='bool'), + ), + ) + + module_params = module.foreman_params + + with module.api_connection(): + scp = module.lookup_entity('smart_class_parameter') + parameter_type = scp.get('parameter_type', 'string') + scope = {'smart_class_parameter_id': scp['id']} + override_values = module.list_resource('override_values', params=scope) + entity = next((ov for ov in override_values if ov['match'] == module_params['match']), None) + if entity is not None: + # this is a hack, otherwise update_entity() tries to update that + entity['smart_class_parameter_id'] = scp['id'] + entity['value'] = parameter_value_to_str(entity['value'], parameter_type) + module.set_entity('entity', entity) + if 'value' in module_params: + module_params['value'] = parameter_value_to_str(module_params['value'], parameter_type) + module.ensure_entity('override_values', module_params, entity, params=scope) + + +if __name__ == '__main__': + main() diff --git a/tests/fixtures/apidoc/smart_class_parameter_override_value.json b/tests/fixtures/apidoc/smart_class_parameter_override_value.json new file mode 120000 index 00000000..f9e40151 --- /dev/null +++ b/tests/fixtures/apidoc/smart_class_parameter_override_value.json @@ -0,0 +1 @@ +foreman.json \ No newline at end of file diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-0.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-0.yml new file mode 100644 index 00000000..a26108a4 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-0.yml @@ -0,0 +1,284 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22config_dir%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"config_dir\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"string\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:17 UTC\",\"parameter\":\"config_dir\",\"id\":4,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '663' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"match": "domain=example.com", "value": "/etc/ntpd/foo"}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '77' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: POST + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values + response: + body: + string: '{"created_at":"2023-08-22 08:36:36 UTC","updated_at":"2023-08-22 08:36:36 + UTC","id":62,"match":"domain=example.com","value":"/etc/ntpd/foo","omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '153' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 201 + message: Created +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-1.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-1.yml new file mode 100644 index 00000000..6daf746e --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-1.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22config_dir%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"config_dir\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"string\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:17 UTC\",\"parameter\":\"config_dir\",\"id\":4,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '663' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:36 UTC\",\"updated_at\":\"2023-08-22 + 08:36:36 UTC\",\"id\":62,\"match\":\"domain=example.com\",\"value\":\"/etc/ntpd/foo\",\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '312' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-10.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-10.yml new file mode 100644 index 00000000..f5d6d564 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-10.yml @@ -0,0 +1,283 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22servers%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"servers\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"array\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"servers\",\"id\":41,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '657' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:39 UTC\",\"updated_at\":\"2023-08-22 + 08:36:41 UTC\",\"id\":63,\"match\":\"domain=example.com\",\"value\":[\"ntp.example.com\"],\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '316' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-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 + Content-Length: + - '0' + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: DELETE + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values/63 + response: + body: + string: '{"created_at":"2023-08-22 08:36:39 UTC","updated_at":"2023-08-22 08:36:41 + UTC","id":63,"match":"domain=example.com","value":["ntp.example.com"],"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '157' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-11.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-11.yml new file mode 100644 index 00000000..fceb3cc5 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-11.yml @@ -0,0 +1,225 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22servers%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"servers\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"array\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"servers\",\"id\":41,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '657' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-12.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-12.yml new file mode 100644 index 00000000..2bd51fe8 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-12.yml @@ -0,0 +1,284 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22stepout%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"stepout\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"integer\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:19 UTC\",\"parameter\":\"stepout\",\"id\":52,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '659' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"match": "domain=example.com", "value": "42"}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '66' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: POST + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values + response: + body: + string: '{"created_at":"2023-08-22 08:36:43 UTC","updated_at":"2023-08-22 08:36:43 + UTC","id":64,"match":"domain=example.com","value":42,"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '140' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 201 + message: Created +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-13.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-13.yml new file mode 100644 index 00000000..16ea9f3b --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-13.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22stepout%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"stepout\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"integer\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:19 UTC\",\"parameter\":\"stepout\",\"id\":52,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '659' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:43 UTC\",\"updated_at\":\"2023-08-22 + 08:36:43 UTC\",\"id\":64,\"match\":\"domain=example.com\",\"value\":42,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '299' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-14.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-14.yml new file mode 100644 index 00000000..2c65074e --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-14.yml @@ -0,0 +1,285 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22stepout%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"stepout\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"integer\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:19 UTC\",\"parameter\":\"stepout\",\"id\":52,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '659' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:43 UTC\",\"updated_at\":\"2023-08-22 + 08:36:43 UTC\",\"id\":64,\"match\":\"domain=example.com\",\"value\":42,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '299' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"value": "23"}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '35' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: PUT + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values/64 + response: + body: + string: '{"created_at":"2023-08-22 08:36:43 UTC","updated_at":"2023-08-22 08:36:44 + UTC","id":64,"match":"domain=example.com","value":23,"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '140' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-15.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-15.yml new file mode 100644 index 00000000..e5f3f663 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-15.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22stepout%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"stepout\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"integer\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:19 UTC\",\"parameter\":\"stepout\",\"id\":52,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '659' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:43 UTC\",\"updated_at\":\"2023-08-22 + 08:36:44 UTC\",\"id\":64,\"match\":\"domain=example.com\",\"value\":23,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '299' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-16.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-16.yml new file mode 100644 index 00000000..09a5ef8b --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-16.yml @@ -0,0 +1,283 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22stepout%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"stepout\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"integer\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:19 UTC\",\"parameter\":\"stepout\",\"id\":52,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '659' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:43 UTC\",\"updated_at\":\"2023-08-22 + 08:36:44 UTC\",\"id\":64,\"match\":\"domain=example.com\",\"value\":23,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '299' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-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 + Content-Length: + - '0' + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: DELETE + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values/64 + response: + body: + string: '{"created_at":"2023-08-22 08:36:43 UTC","updated_at":"2023-08-22 08:36:44 + UTC","id":64,"match":"domain=example.com","value":23,"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '140' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-17.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-17.yml new file mode 100644 index 00000000..fb7504ae --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-17.yml @@ -0,0 +1,225 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22stepout%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"stepout\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"integer\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:19 UTC\",\"parameter\":\"stepout\",\"id\":52,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '659' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/52/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-18.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-18.yml new file mode 100644 index 00000000..3593b199 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-18.yml @@ -0,0 +1,284 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22burst%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"burst\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"boolean\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"burst\",\"id\":2,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '654' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"match": "domain=example.com", "value": true}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '66' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: POST + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values + response: + body: + string: '{"created_at":"2023-08-22 08:36:46 UTC","updated_at":"2023-08-22 08:36:46 + UTC","id":65,"match":"domain=example.com","value":true,"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '142' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 201 + message: Created +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-19.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-19.yml new file mode 100644 index 00000000..c4a603f0 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-19.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22burst%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"burst\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"boolean\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"burst\",\"id\":2,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '654' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:46 UTC\",\"updated_at\":\"2023-08-22 + 08:36:46 UTC\",\"id\":65,\"match\":\"domain=example.com\",\"value\":true,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '301' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-2.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-2.yml new file mode 100644 index 00000000..1ca03e91 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-2.yml @@ -0,0 +1,285 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22config_dir%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"config_dir\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"string\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:17 UTC\",\"parameter\":\"config_dir\",\"id\":4,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '663' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:36 UTC\",\"updated_at\":\"2023-08-22 + 08:36:36 UTC\",\"id\":62,\"match\":\"domain=example.com\",\"value\":\"/etc/ntpd/foo\",\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '312' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"value": "/etc/ntpd/foonew"}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '49' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: PUT + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values/62 + response: + body: + string: '{"created_at":"2023-08-22 08:36:36 UTC","updated_at":"2023-08-22 08:36:37 + UTC","id":62,"match":"domain=example.com","value":"/etc/ntpd/foonew","omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '156' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-20.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-20.yml new file mode 100644 index 00000000..bfa2a9ae --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-20.yml @@ -0,0 +1,285 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22burst%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"burst\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"boolean\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"burst\",\"id\":2,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '654' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:46 UTC\",\"updated_at\":\"2023-08-22 + 08:36:46 UTC\",\"id\":65,\"match\":\"domain=example.com\",\"value\":true,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '301' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"value": false}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: PUT + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values/65 + response: + body: + string: '{"created_at":"2023-08-22 08:36:46 UTC","updated_at":"2023-08-22 08:36:48 + UTC","id":65,"match":"domain=example.com","value":false,"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '143' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-21.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-21.yml new file mode 100644 index 00000000..e4eaba1b --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-21.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22burst%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"burst\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"boolean\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"burst\",\"id\":2,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '654' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:46 UTC\",\"updated_at\":\"2023-08-22 + 08:36:48 UTC\",\"id\":65,\"match\":\"domain=example.com\",\"value\":false,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '302' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-22.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-22.yml new file mode 100644 index 00000000..566e532b --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-22.yml @@ -0,0 +1,283 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22burst%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"burst\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"boolean\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"burst\",\"id\":2,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '654' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:46 UTC\",\"updated_at\":\"2023-08-22 + 08:36:48 UTC\",\"id\":65,\"match\":\"domain=example.com\",\"value\":false,\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '302' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-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 + Content-Length: + - '0' + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: DELETE + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values/65 + response: + body: + string: '{"created_at":"2023-08-22 08:36:46 UTC","updated_at":"2023-08-22 08:36:48 + UTC","id":65,"match":"domain=example.com","value":false,"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '143' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-23.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-23.yml new file mode 100644 index 00000000..fcf37983 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-23.yml @@ -0,0 +1,225 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22burst%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"burst\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"boolean\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"burst\",\"id\":2,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '654' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/2/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-3.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-3.yml new file mode 100644 index 00000000..a3890e4f --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-3.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22config_dir%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"config_dir\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"string\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:17 UTC\",\"parameter\":\"config_dir\",\"id\":4,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '663' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:36 UTC\",\"updated_at\":\"2023-08-22 + 08:36:37 UTC\",\"id\":62,\"match\":\"domain=example.com\",\"value\":\"/etc/ntpd/foonew\",\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '315' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-4.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-4.yml new file mode 100644 index 00000000..b1f03cbe --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-4.yml @@ -0,0 +1,283 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22config_dir%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"config_dir\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"string\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:17 UTC\",\"parameter\":\"config_dir\",\"id\":4,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '663' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:36 UTC\",\"updated_at\":\"2023-08-22 + 08:36:37 UTC\",\"id\":62,\"match\":\"domain=example.com\",\"value\":\"/etc/ntpd/foonew\",\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '315' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-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 + Content-Length: + - '0' + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: DELETE + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values/62 + response: + body: + string: '{"created_at":"2023-08-22 08:36:36 UTC","updated_at":"2023-08-22 08:36:37 + UTC","id":62,"match":"domain=example.com","value":"/etc/ntpd/foonew","omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '156' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-5.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-5.yml new file mode 100644 index 00000000..4d1e537e --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-5.yml @@ -0,0 +1,225 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22config_dir%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"config_dir\\\"\",\n \"sort\": + {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"string\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:30 UTC\",\"updated_at\":\"2023-08-15 07:50:17 UTC\",\"parameter\":\"config_dir\",\"id\":4,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '663' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/4/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-6.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-6.yml new file mode 100644 index 00000000..57577348 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-6.yml @@ -0,0 +1,284 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22servers%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"servers\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"array\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"servers\",\"id\":41,\"puppetclass_id\":2,\"override_values_count\":0,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '657' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values?per_page=4294967296 + response: + body: + string: "{\n \"total\": 0,\n \"subtotal\": 0,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": null,\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-Length: + - '159' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"match": "domain=example.com", "value": "[\"ntp.example.org\"]"}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '85' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: POST + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values + response: + body: + string: '{"created_at":"2023-08-22 08:36:39 UTC","updated_at":"2023-08-22 08:36:39 + UTC","id":63,"match":"domain=example.com","value":["ntp.example.org"],"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '157' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 201 + message: Created +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-7.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-7.yml new file mode 100644 index 00000000..9725ab9b --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-7.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22servers%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"servers\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"array\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"servers\",\"id\":41,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '657' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:39 UTC\",\"updated_at\":\"2023-08-22 + 08:36:39 UTC\",\"id\":63,\"match\":\"domain=example.com\",\"value\":[\"ntp.example.org\"],\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '316' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-8.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-8.yml new file mode 100644 index 00000000..d53b4dc2 --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-8.yml @@ -0,0 +1,285 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22servers%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"servers\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"array\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"servers\",\"id\":41,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '657' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:39 UTC\",\"updated_at\":\"2023-08-22 + 08:36:39 UTC\",\"id\":63,\"match\":\"domain=example.com\",\"value\":[\"ntp.example.org\"],\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '316' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: '{"override_value": {"value": "[\"ntp.example.com\"]"}}' + headers: + Accept: + - application/json;version=2 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '54' + Content-Type: + - application/json + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: PUT + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values/63 + response: + body: + string: '{"created_at":"2023-08-22 08:36:39 UTC","updated_at":"2023-08-22 08:36:41 + UTC","id":63,"match":"domain=example.com","value":["ntp.example.com"],"omit":false}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '157' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=96 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/fixtures/smart_class_parameter_override_value-9.yml b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-9.yml new file mode 100644 index 00000000..da95a05a --- /dev/null +++ b/tests/test_playbooks/fixtures/smart_class_parameter_override_value-9.yml @@ -0,0 +1,226 @@ +interactions: +- 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/status + response: + body: + string: '{"result":"ok","status":200,"version":"3.7.0","api_version":2}' + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '62' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=100 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses?search=name%3D%22ntp%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 7,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"name=\\\"ntp\\\"\",\n \"sort\": {\n \"by\": + null,\n \"order\": null\n },\n \"results\": {\"ntp\":[{\"id\":2,\"name\":\"ntp\",\"created_at\":\"2023-07-26T07:53:30.943Z\",\"updated_at\":\"2023-07-26T07:53:30.943Z\"}]}\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '278' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=99 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/puppetclasses/2/smart_class_parameters?search=parameter%3D%22servers%22&per_page=4294967296 + response: + body: + string: "{\n \"total\": 70,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\": + 4294967296,\n \"search\": \"parameter=\\\"servers\\\"\",\n \"sort\": {\n + \ \"by\": null,\n \"order\": null\n },\n \"results\": [{\"description\":\"\",\"override\":true,\"parameter_type\":\"array\",\"hidden_value?\":false,\"omit\":false,\"required\":false,\"validator_type\":null,\"validator_rule\":null,\"merge_overrides\":false,\"merge_default\":false,\"avoid_duplicates\":false,\"override_value_order\":\"fqdn\\nhostgroup\\nos\\ndomain\",\"created_at\":\"2023-07-26 + 07:53:31 UTC\",\"updated_at\":\"2023-08-15 07:50:18 UTC\",\"parameter\":\"servers\",\"id\":41,\"puppetclass_id\":2,\"override_values_count\":1,\"default_value\":null,\"puppetclass_name\":\"ntp\"}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '657' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=98 + 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-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 + User-Agent: + - apypie (https://github.com/Apipie/apypie) + method: GET + uri: https://foreman.example.org/foreman_puppet/api/smart_class_parameters/41/override_values?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\": [{\"created_at\":\"2023-08-22 08:36:39 UTC\",\"updated_at\":\"2023-08-22 + 08:36:41 UTC\",\"id\":63,\"match\":\"domain=example.com\",\"value\":[\"ntp.example.com\"],\"omit\":false}]\n}\n" + headers: + Cache-Control: + - max-age=0, private, must-revalidate + Connection: + - Keep-Alive + Content-Length: + - '316' + 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: + - 3.7.0 + Keep-Alive: + - timeout=15, max=97 + 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-XSS-Protection: + - 1; mode=block + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_playbooks/smart_class_parameter_override_value.yml b/tests/test_playbooks/smart_class_parameter_override_value.yml new file mode 100644 index 00000000..5e9d6872 --- /dev/null +++ b/tests/test_playbooks/smart_class_parameter_override_value.yml @@ -0,0 +1,245 @@ +--- +## To record cassettes using this playbook (record_smart_class_parameter) +## some puppet classes need to be imported. +## See comments in #582 for details. To import the classes run: +## +## $ puppet module install puppetlabs-ntp +## $ hammer proxy import-classes --puppet-environment production --name $(hostname -f) +## + +- hosts: localhost + collections: + - theforeman.foreman + gather_facts: false + vars_files: + - vars/server.yml + tasks: + - include_tasks: tasks/smart_class_parameter.yml + vars: + smart_class_parameter_puppetclass_name: ntp + smart_class_parameter_parameter: "{{ item.param }}" + smart_class_parameter_override: true + smart_class_parameter_parameter_type: "{{ item.type }}" + smart_class_parameter_override_values: [] + smart_class_parameter_override_value_order: + - fqdn + - hostgroup + - os + - domain + smart_class_parameter_state: present + loop: + - param: config_dir + type: string + - param: servers + type: array + - param: burst + type: boolean + - param: stepout + type: integer + +- hosts: tests + collections: + - theforeman.foreman + gather_facts: false + vars_files: + - vars/server.yml + tasks: + - name: Test string smart class parameter override value + vars: + smart_class_parameter_override_value_puppetclass: ntp + smart_class_parameter_override_value_parameter: config_dir + block: + - name: create override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: "/etc/ntpd/foo" + smart_class_parameter_override_value_state: present + expected_change: true + - name: create override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: "/etc/ntpd/foo" + smart_class_parameter_override_value_state: present + expected_change: false + - name: update override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: "/etc/ntpd/foonew" + smart_class_parameter_override_value_state: present + expected_change: true + - name: update override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: "/etc/ntpd/foonew" + smart_class_parameter_override_value_state: present + expected_change: false + - name: delete override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: true + - include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: false + + - name: Test array smart class parameter override value + vars: + smart_class_parameter_override_value_puppetclass: ntp + smart_class_parameter_override_value_parameter: servers + block: + - name: create override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: [ntp.example.org] + smart_class_parameter_override_value_state: present + expected_change: true + - name: create override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: [ntp.example.org] + smart_class_parameter_override_value_state: present + expected_change: false + - name: update override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: [ntp.example.com] + smart_class_parameter_override_value_state: present + expected_change: true + - name: update override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: [ntp.example.com] + smart_class_parameter_override_value_state: present + expected_change: false + - name: delete override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: true + - include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: false + + - name: Test integer smart class parameter override value + vars: + smart_class_parameter_override_value_puppetclass: ntp + smart_class_parameter_override_value_parameter: stepout + block: + - name: create override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: 42 + smart_class_parameter_override_value_state: present + expected_change: true + - name: create override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: 42 + smart_class_parameter_override_value_state: present + expected_change: false + - name: update override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: 23 + smart_class_parameter_override_value_state: present + expected_change: true + - name: update override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: 23 + smart_class_parameter_override_value_state: present + expected_change: false + - name: delete override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: true + - include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: false + + - name: Test boolean smart class parameter override value + vars: + smart_class_parameter_override_value_puppetclass: ntp + smart_class_parameter_override_value_parameter: burst + block: + - name: create override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: true + smart_class_parameter_override_value_state: present + expected_change: true + - name: create override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: true + smart_class_parameter_override_value_state: present + expected_change: false + - name: update override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: false + smart_class_parameter_override_value_state: present + expected_change: true + - name: update override value again, no change + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_value: false + smart_class_parameter_override_value_state: present + expected_change: false + - name: delete override value + include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: true + - include_tasks: tasks/smart_class_parameter_override_value.yml + vars: + smart_class_parameter_override_value_match: "domain=example.com" + smart_class_parameter_override_value_state: absent + expected_change: false + +- hosts: localhost + collections: + - theforeman.foreman + gather_facts: false + vars_files: + - vars/server.yml + tasks: + - include_tasks: tasks/smart_class_parameter.yml + vars: + smart_class_parameter_puppetclass_name: ntp + smart_class_parameter_parameter: "{{ item }}" + smart_class_parameter_override: false + smart_class_parameter_state: present + loop: + - config_dir + - servers + - burst + - stepout +... diff --git a/tests/test_playbooks/tasks/smart_class_parameter_override_value.yml b/tests/test_playbooks/tasks/smart_class_parameter_override_value.yml new file mode 100644 index 00000000..ae4a4201 --- /dev/null +++ b/tests/test_playbooks/tasks/smart_class_parameter_override_value.yml @@ -0,0 +1,20 @@ +--- +- name: "Ensure override value '{{ smart_class_parameter_override_value_puppetclass }}::{{ smart_class_parameter_override_value_parameter }}' is {{ smart_class_parameter_override_value_state }}" + vars: + smart_class_parameter_override_value_state: present + smart_class_parameter_override_value: + username: "{{ foreman_username }}" + password: "{{ foreman_password }}" + server_url: "{{ foreman_server_url }}" + validate_certs: "{{ foreman_validate_certs }}" + puppetclass: "{{ smart_class_parameter_override_value_puppetclass }}" + smart_class_parameter: "{{ smart_class_parameter_override_value_parameter }}" + match: "{{ smart_class_parameter_override_value_match | default(omit) }}" + omit: "{{ smart_class_parameter_override_value_omit | default(omit) }}" + value: "{{ smart_class_parameter_override_value_value | default(omit) }}" + state: "{{ smart_class_parameter_override_value_state | default('present') }}" + register: result +- fail: + msg: "Ensuring override value is {{ smart_class_parameter_override_value_state }} failed! (expected_change: {{ expected_change | default('unknown') }})" + when: (expected_change is defined) and (result.changed != expected_change) +... From f0a9ced7b192ed04f93cd59503e14fe588e855d8 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 23 Aug 2023 08:55:56 +0200 Subject: [PATCH 03/11] add puppetclass/smart_class_parameter aliases to smart_class_parameter --- plugins/modules/smart_class_parameter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/modules/smart_class_parameter.py b/plugins/modules/smart_class_parameter.py index c71e2c95..7fb569fd 100644 --- a/plugins/modules/smart_class_parameter.py +++ b/plugins/modules/smart_class_parameter.py @@ -34,10 +34,14 @@ description: Name of the puppetclass that own the parameter required: true type: str + aliases: + - puppetclass parameter: description: Name of the parameter required: true type: str + aliases: + - smart_class_parameter description: description: Description of the Smart Class Parameter type: str @@ -205,8 +209,8 @@ def ensure_override_values(self, entity, expected_override_values): def main(): module = ForemanSmartClassParameterModule( argument_spec=dict( - puppetclass_name=dict(required=True), - parameter=dict(required=True), + puppetclass_name=dict(required=True, aliases=['puppetclass']), + parameter=dict(required=True, aliases=['smart_class_parameter']), state=dict(default='present', choices=['present_with_defaults', 'present']), ), foreman_spec=dict( From 7dae292c62c58ed21d2d74a4541eeca90bab1af7 Mon Sep 17 00:00:00 2001 From: Adam Ruzicka Date: Thu, 17 Aug 2023 11:21:05 +0200 Subject: [PATCH 04/11] Deprecate REX time span option --- plugins/modules/job_invocation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/job_invocation.py b/plugins/modules/job_invocation.py index 3866fc01..f430e646 100644 --- a/plugins/modules/job_invocation.py +++ b/plugins/modules/job_invocation.py @@ -117,6 +117,7 @@ time_span: description: - Distribute tasks over given number of seconds + - This is removed since foreman_remote_execution-11.0.0 type: int concurrency_level: description: From 6cc6283ed3c4a9b51c01a43210ac6809ebaf4bba Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 29 Aug 2023 08:19:57 +0200 Subject: [PATCH 05/11] add import_only to content_view module --- plugins/modules/content_view.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/modules/content_view.py b/plugins/modules/content_view.py index 8c19d8af..16da9c5f 100644 --- a/plugins/modules/content_view.py +++ b/plugins/modules/content_view.py @@ -68,6 +68,11 @@ description: - Solve RPM dependencies by default on Content View publish type: bool + import_only: + description: + - Designate this Content View for importing from upstream servers only. + type: bool + version_added: 3.14.0 composite: description: - A composite view contains other content views. @@ -167,6 +172,7 @@ def main(): composite=dict(type='bool', default=False), auto_publish=dict(type='bool', default=False), solve_dependencies=dict(type='bool'), + import_only=dict(type='bool'), components=dict(type='nested_list', foreman_spec=cvc_foreman_spec, resolve=False), repositories=dict(type='entity_list', elements='dict', resolve=False, options=dict( name=dict(required=True), From 9e28a9f9916ee57695b4c51f8f45b79f89c17d2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 19:19:35 +0000 Subject: [PATCH 06/11] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/main.yml | 12 ++++++------ .github/workflows/release.yml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2306be20..1a96cd9f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 278b4bd1..8e15720d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'theforeman/foreman-ansible-modules' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: configure git run: | git config user.name "${GITHUB_ACTOR}" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c1f3f67..1c6738bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,7 @@ jobs: - python: "3.11" ansible: "devel" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: @@ -81,7 +81,7 @@ jobs: checkmode: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: @@ -100,7 +100,7 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: @@ -122,7 +122,7 @@ jobs: galaxy-importer: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: @@ -137,7 +137,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: @@ -159,7 +159,7 @@ jobs: execution_environment: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b1bc9961..87f893ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'theforeman/foreman-ansible-modules' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: From cad0b27ceb73c894269f5f05d33bc3e83d98f52b Mon Sep 17 00:00:00 2001 From: Griffin Sullivan <48397354+Griffin-Sullivan@users.noreply.github.com> Date: Tue, 5 Sep 2023 14:05:09 -0400 Subject: [PATCH 07/11] correctly pass `version` not `description` to the module --- changelogs/fragments/bz2234444.yaml | 2 ++ roles/content_view_publish/tasks/main.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/bz2234444.yaml diff --git a/changelogs/fragments/bz2234444.yaml b/changelogs/fragments/bz2234444.yaml new file mode 100644 index 00000000..9ca48932 --- /dev/null +++ b/changelogs/fragments/bz2234444.yaml @@ -0,0 +1,2 @@ +bugfixes: + - content_view_publish role - correctly pass ``version`` not ``description`` to the module (https://bugzilla.redhat.com/show_bug.cgi?id=2234444) \ No newline at end of file diff --git a/roles/content_view_publish/tasks/main.yml b/roles/content_view_publish/tasks/main.yml index 5a8521b0..90f8ef5b 100644 --- a/roles/content_view_publish/tasks/main.yml +++ b/roles/content_view_publish/tasks/main.yml @@ -8,7 +8,7 @@ organization: "{{ foreman_organization }}" content_view: "{{ content_view.name | default(content_view.content_view) | default(content_view) }}" description: "{{ content_view.description | default(omit) }}" - version: "{{ content_view.description | default(omit) }}" + version: "{{ content_view.version | default(omit) }}" lifecycle_environments: "{{ content_view.lifecycle_environments | default(omit) }}" force_promote: "{{ content_view.force_promote | default(omit) }}" force_yum_metadata_regeneration: "{{ content_view.force_yum_metadata_regeneration | default(omit) }}" From 3eef35ce381500105dd55acef914228f1ea6d84d Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 7 Sep 2023 08:36:09 +0200 Subject: [PATCH 08/11] ensure we test and document the lowest ansible possible --- .github/workflows/main.yml | 9 ++++++--- meta/runtime.yml | 2 +- tests/test_callback.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c6738bb..631772e9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: - devel include: - python: "3.8" - ansible: "stable-2.9" + ansible: "v2.9.17" - python: "3.8" ansible: "stable-2.10" - python: "2.7" @@ -61,13 +61,16 @@ jobs: run: sudo apt-get install -y libyaml-dev rpm - name: Install Ansible run: pip install --upgrade https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz + - name: Ensure Jinja version is old enough for Ansible 2.9 + run: pip install --upgrade 'Jinja2<3.1' + if: matrix.ansible == 'v2.9.17' - name: Install dependencies run: make test-setup - name: prepare a redhat-uep.pem, even if we run on Ubuntu run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem - name: Install required collections for ansible-base (2.10+) run: ansible-galaxy collection install community.docker - if: matrix.ansible != 'stable-2.9' + if: matrix.ansible != 'v2.9.17' - name: Run crud tests run: make test-crud - name: Run other tests @@ -76,7 +79,7 @@ jobs: run: make dist-test - name: Run sanity tests run: make SANITY_OPTS="--docker" sanity - if: matrix.ansible != 'stable-2.9' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11' + if: matrix.ansible != 'v2.9.17' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11' checkmode: runs-on: ubuntu-latest diff --git a/meta/runtime.yml b/meta/runtime.yml index 5080fa51..9e34e240 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -187,4 +187,4 @@ plugin_routing: redirect: theforeman.foreman.sync_plan katello_upload: redirect: theforeman.foreman.content_upload -requires_ansible: '>=2.9' +requires_ansible: '>=2.9.17' diff --git a/tests/test_callback.py b/tests/test_callback.py index 03783e4b..4aa00862 100644 --- a/tests/test_callback.py +++ b/tests/test_callback.py @@ -39,7 +39,7 @@ def drop_incompatible_items(d): dd = {} for k, v in d.items(): if k in ['msg', 'start', 'end', 'delta', 'uuid', 'timeout', '_ansible_no_log', 'warn', 'connection', - 'extended_allitems', 'loop_control', 'expand_argument_vars', 'retries']: + 'extended_allitems', 'loop_control', 'expand_argument_vars', 'retries', 'parent', 'parent_type', 'finalized', 'squashed']: continue if isinstance(v, dict): From 9667a1d97add7be805ca6dacea5a0c45f0b6ac0a Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 8 Sep 2023 14:34:57 +0200 Subject: [PATCH 09/11] also publish built artifact to github (#1665) --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87f893ae..dd72ba7d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,3 +25,7 @@ jobs: run: make dist - name: Deploy Ansible Collection run: make publish GALAXY_API_KEY=${{ secrets.GALAXY_API_KEY }} + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: theforeman-foreman-*.tar.gz From 84567b902516a014356e7db753a9e49f833c96fa Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 8 Sep 2023 15:13:47 +0200 Subject: [PATCH 10/11] Release 3.14.0 (#1669) * Release 3.14.0 * Bump version to 3.15.0-dev --- .mailmap | 1 + CHANGELOG.rst | 13 +++++++++++++ changelogs/changelog.yaml | 12 ++++++++++++ changelogs/fragments/bz2234444.yaml | 2 -- galaxy.yml | 2 +- 5 files changed, 27 insertions(+), 3 deletions(-) delete mode 100644 changelogs/fragments/bz2234444.yaml diff --git a/.mailmap b/.mailmap index 45d09908..69942be4 100644 --- a/.mailmap +++ b/.mailmap @@ -30,3 +30,4 @@ Lucas Bickel <116588+hairmare@users.noreply.github.com> Kenny Tordeurs Paul Armstrong Lukas Magauer +Griffin Sullivan <48397354+Griffin-Sullivan@users.noreply.github.com> diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c402553e..cf6eb0e3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,19 @@ theforeman.foreman Release Notes This changelog describes changes after version 0.8.1. +v3.14.0 +======= + +Bugfixes +-------- + +- content_view_publish role - correctly pass ``version`` not ``description`` to the module (https://bugzilla.redhat.com/show_bug.cgi?id=2234444) + +New Modules +----------- + +- theforeman.foreman.smart_class_parameter_override_value - Manage Smart Class Parameter Override Values + v3.13.0 ======= diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 1a15335b..8a3c10a6 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -644,6 +644,18 @@ releases: name: wait_for_task namespace: '' release_date: '2023-08-15' + 3.14.0: + changes: + bugfixes: + - content_view_publish role - correctly pass ``version`` not ``description`` + to the module (https://bugzilla.redhat.com/show_bug.cgi?id=2234444) + fragments: + - bz2234444.yaml + modules: + - description: Manage Smart Class Parameter Override Values + name: smart_class_parameter_override_value + namespace: '' + release_date: '2023-09-08' 3.2.0: changes: bugfixes: diff --git a/changelogs/fragments/bz2234444.yaml b/changelogs/fragments/bz2234444.yaml deleted file mode 100644 index 9ca48932..00000000 --- a/changelogs/fragments/bz2234444.yaml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - content_view_publish role - correctly pass ``version`` not ``description`` to the module (https://bugzilla.redhat.com/show_bug.cgi?id=2234444) \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index 6fba54ec..395e7c75 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -98,7 +98,7 @@ authors: - "russianguppie <46544650+russianguppie@users.noreply.github.com>" - "willtome " - "yuqo2450 <79540477+yuqo2450@users.noreply.github.com>" -version: "3.14.0-dev" +version: "3.15.0-dev" license: - "GPL-3.0-or-later" tags: From cdbf4cd15ae62668ab5e4643f5ed9a21f19892e8 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 8 Sep 2023 15:18:29 +0200 Subject: [PATCH 11/11] correct version number in galaxy.yml for 3.14.0 --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index 395e7c75..22b3e15e 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -98,7 +98,7 @@ authors: - "russianguppie <46544650+russianguppie@users.noreply.github.com>" - "willtome " - "yuqo2450 <79540477+yuqo2450@users.noreply.github.com>" -version: "3.15.0-dev" +version: "3.14.0" license: - "GPL-3.0-or-later" tags: