Hide Forgot
Description of problem: Flags 'merge_overrides', 'avoid_duplicates' and 'merge_default' are specific for hash/array types, however Smart Variable allows to set them for non-hash/array types. Checked via Hammer/Api. For example, 1) Set 'avoid_duplicates' for 'boolean' type using nailgun syntax > smart_variable = entities.SmartVariable( > default_value=True, > variable_type='boolean', > ).create() > smart_variable.merge_overrides = True > smart_variable.avoid_duplicates = True > smart_variable.update(['merge_overrides', 'avoid_duplicates']) 2) Actual HTTP request and response > Making HTTP PUT request to https://example.com/api/v2/smart_variables/165 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"avoid_duplicates": true, "merge_overrides": true}. > Received HTTP 200 response {"description":null,"parameter_type":"boolean","default_value":true,"hidden_value?":false,"hidden_value":"*****","validator_type":null,"validator_rule":null,"override_value_order":"fqdn\nhostgroup\nos\ndomain","override_values_count":0,"merge_overrides":true,"merge_default":false,"avoid_duplicates":true,"puppetclass_id":2,"puppetclass_name":"ntp","created_at":"2016-09-13 15:18:27 UTC","updated_at":"2016-09-13 15:18:28 UTC","variable":"穁𦴜𣲩ಣ蜋告ꪮ𨻠𩰔䣮𥣒𠌿𨤂𡹑𧿨𨟱폅햝와䁷寸蓩ﳯ","id":165,"override_values":[]} 3) Set 'merge_overrides' and 'merge_default' using Hammer: > hammer -v -u admin -p changeme --output=csv smart-variable create --default-value="0415575684" --variable="9k8kBq1RCJ" --puppet-class="ntp" --variable-type="integer" > Smart variable [9k8kBq1RCJ] created,167 > hammer -v -u admin -p changeme --output=csv smart-variable update --merge-default="1" --name="9k8kBq1RCJ" --merge-overrides="1" > Smart variable [9k8kBq1RCJ] updated,167 Version-Release number of selected component (if applicable): 6.2.2 (build from 12/09/2016) How reproducible: Always Steps to Reproduce: 1. Create Smart Variable using Hammer or API with any non-hash/array type 2. Set any of specified above flags to True 3. Check whether variable was updated or error was raised Actual results: Variable was successfully updated for integer type Expected results: Error should be raise with message "Validation failed: Merge overrides can only be set for array or hash" Additional info: Installed packages: * candlepin-0.9.54.7-1.el7.noarch * candlepin-selinux-0.9.54.7-1.el7.noarch * foreman-1.11.0.53-1.el7sat.noarch * foreman-compute-1.11.0.53-1.el7sat.noarch * foreman-debug-1.11.0.53-1.el7sat.noarch * foreman-discovery-image-3.1.1-17.el7sat.noarch * foreman-ec2-1.11.0.53-1.el7sat.noarch * foreman-gce-1.11.0.53-1.el7sat.noarch * foreman-installer-1.11.0.10-1.el7sat.noarch * foreman-installer-katello-3.0.0.57-1.el7sat.noarch * foreman-libvirt-1.11.0.53-1.el7sat.noarch * foreman-openstack-1.11.0.53-1.el7sat.noarch * foreman-ovirt-1.11.0.53-1.el7sat.noarch * foreman-postgresql-1.11.0.53-1.el7sat.noarch * foreman-proxy-1.11.0.6-1.el7sat.noarch * foreman-rackspace-1.11.0.53-1.el7sat.noarch * foreman-selinux-1.11.0.2-1.el7sat.noarch * foreman-vmware-1.11.0.53-1.el7sat.noarch * katello-3.0.0-12.el7sat.noarch * katello-certs-tools-2.4.0-1.el7sat.noarch * katello-client-bootstrap-1.1.0-2.el7sat.noarch * katello-common-3.0.0-12.el7sat.noarch * katello-debug-3.0.0-12.el7sat.noarch * katello-default-ca-1.0-1.noarch * katello-installer-base-3.0.0.57-1.el7sat.noarch * katello-selinux-3.0.1.2-1.el7sat.noarch * katello-server-ca-1.0-1.noarch * katello-service-3.0.0-12.el7sat.noarch * openldap-2.4.40-9.el7_2.x86_64 * pulp-client-1.0-1.noarch * pulp-docker-plugins-2.0.1.1-1.el7sat.noarch * pulp-katello-1.0.1-1.el7sat.noarch * pulp-ostree-plugins-1.1.1-2.el7sat.noarch * pulp-puppet-plugins-2.8.3.3-1.el7sat.noarch * pulp-puppet-tools-2.8.3.3-1.el7sat.noarch * pulp-rpm-plugins-2.8.3.5-1.el7sat.noarch * pulp-selinux-2.8.3.4-1.el7sat.noarch * pulp-server-2.8.3.4-1.el7sat.noarch * python-ldap-2.4.15-2.el7.x86_64 * tfm-rubygem-ldap_fluff-0.4.3-1.el7sat.noarch * tfm-rubygem-net-ldap-0.13.0-1.el7sat.noarch
(In reply to Stanislav Tkachenko from comment #0) Update: Environment info: > OS: redhat > RELEASE: Red Hat Enterprise Linux Server release 7.2 (Maipo) > FOREMAN: 1.11.0.53 > RUBY: ruby 2.0.0p598 (2014-11-13) [x86_64-linux] > PUPPET: 3.8.6 > DENIALS: 0
Verified on Satellite 6.3 Snap 6.0: API: > Making HTTP POST request to https://sat6.com/api/v2/smart_variables with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"default_value": "50", "variable": "test", "variable_type": "string", "puppetclass_id": 33}. > Received HTTP 201 response: > Making HTTP PUT request to https://sat6.com/api/v2/smart_variables/23 with options {'verify': False, 'auth': ('admin', 'changeme'), 'headers': {'content-type': 'application/json'}} and data {"merge_overrides": true}. > Received HTTP 500 response: { "error": {"message":"Validation failed: Merge overrides can only be set for array or hash"} CLI: > hammer -v -u admin -p changeme --output=csv smart-variable create --default-value="0159814391" --variable="m6uIkGBnvN" --puppet-class="cli_test_variables" --variable-type="integer" > hammer -v -u admin -p changeme --output=csv smart-variable update --variable="m6uIkGBnvN" --merge-default="1" --merge-overrides="1" > [ERROR 2016-11-28 10:32:40 API] 500 Internal Server Error > [ERROR 2016-11-28 10:32:40 Exception] Validation failed: Merge overrides can only be set for array or hash > Could not update the smart variable: > Validation failed: Merge overrides can only be set for array or hash
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:0336