Bug 1241077
Summary: | API settings unquoted integer provided gives error | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> |
Component: | Provisioning | Assignee: | Ivan Necas <inecas> |
Status: | CLOSED ERRATA | QA Contact: | Tazim Kolhar <tkolhar> |
Severity: | medium | Docs Contact: | Russell Dickenson <rdickens> |
Priority: | unspecified | ||
Version: | 6.1.0 | CC: | bbuckingham, bkearney, chpeters, cwelton, inecas, rdickens, tkolhar |
Target Milestone: | Unspecified | Keywords: | ReleaseNotes, Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
URL: | http://projects.theforeman.org/issues/11673 | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: |
Issue:
If you provide a numeric value to an API element which requires a numeric value, you may see the following error message.
---
"Value is invalid: must be integer"
---
The cause of this issue is that the value is tested with a regular expression and the numeric value fails the test.
Workaround:
Enclose the numeric value in quote characters (").
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2015-10-15 18:20:17 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1122832, 1190823 |
Description
Peter Vreman
2015-07-08 11:53:50 UTC
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 |