Hide Forgot
Description of problem: Settings unqouted Integer values are resulting in an error that an integer is required. Changing it to a quoted value does not give this error. I would expect the otherway around that a quoted integer shall give an error instead. This is also a regression compared to 6.0.8 that accepted the unqouted integer value. # curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"setting\":{\"value\":60}}" -XPUT https://localhost/api/v2/settings/52 { "error": {"id":52,"errors":{"value":["is invalid: must be integer"]},"full_messages":["Value is invalid: must be integer"]} } # curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"setting\":{\"value\":\"60\"}}" -XPUT https://localhost/api/v2/settings/52 {"created_at":"2015-07-08T08:45:44Z","default":30,"description":"Puppet interval in minutes","id":52,"name":"puppet_interval","settings_type":"integer","updated_at":"2015-07-08T09:57:12Z","value":60} Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. See curl commands above 2. 3. Actual results: Unqouted integer value gives error Expected results: Unqouted integer works Additional info:
Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.
Regexes do not work with Integer, convert to String first Patch: --- /usr/share/foreman/app/models/setting.rb +++ /usr/share/foreman/app/models/setting.rb @@ -117,7 +117,7 @@ self.value = boolean when "integer" - if val =~ /\A\d+\Z/ + if val.to_s =~ /\A\d+\Z/ self.value = val.to_i else invalid_value_error _("must be integer")
Created redmine issue http://projects.theforeman.org/issues/11673 from this bug
Fix opened against upstream https://github.com/theforeman/foreman/pull/2666
Upstream bug component is Provisioning
Merged upstream
VERIFIED: # rpm -qa | grep foreman ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch rubygem-hammer_cli_foreman-0.1.4.14-1.el7sat.noarch ruby193-rubygem-foreman_bootdisk-4.0.2.13-1.el7sat.noarch foreman-vmware-1.7.2.40-1.el7sat.noarch rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch foreman-debug-1.7.2.40-1.el7sat.noarch foreman-proxy-1.7.2.6-1.el7sat.noarch foreman-1.7.2.40-1.el7sat.noarch foreman-gce-1.7.2.40-1.el7sat.noarch ruby193-rubygem-foreman-redhat_access-0.2.3-1.el7sat.noarch rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch hp-xw6600-02.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch hp-xw6600-02.rhts.eng.bos.redhat.com-foreman-proxy-1.0-2.noarch foreman-compute-1.7.2.40-1.el7sat.noarch ruby193-rubygem-foreman_docker-1.2.0.22-1.el7sat.noarch ruby193-rubygem-foreman-tasks-0.6.15.7-1.el7sat.noarch rubygem-hammer_cli_foreman_tasks-0.0.3.5-1.el7sat.noarch foreman-libvirt-1.7.2.40-1.el7sat.noarch foreman-postgresql-1.7.2.40-1.el7sat.noarch hp-xw6600-02.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch foreman-ovirt-1.7.2.40-1.el7sat.noarch foreman-selinux-1.7.2.13-1.el7sat.noarch ruby193-rubygem-foreman_discovery-2.0.0.19-1.el7sat.noarch rubygem-hammer_cli_foreman_docker-0.0.3.9-1.el7sat.noarch ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch steps: # curl -k -u admin:changeme "-HContent-Type: application/json" "-d{\"per_page\":9999,\"setting\":{\"value\":60}}" -XPUT https://hp-xw6600-02.rhts.eng.bos.redhat.com/api/v2/settings/52 {"created_at":"2015-10-05T03:00:20Z","default":null,"description":"Redirect your users to this url on logout (authorize_login_delegation should also be enabled)","id":52,"name":"login_delegation_logout_url","settings_type":null,"updated_at":"2015-10-06T10:41:22Z","value":"60" Unqouted integer works
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/RHBA-2015:1911