Bug 1550157
| Summary: | configure_server_settings.rb changes numeric values to strings, causing failures when other code is expecting integers | |||
|---|---|---|---|---|
| Product: | Red Hat CloudForms Management Engine | Reporter: | Joe Rafaniello <jrafanie> | |
| Component: | Appliance | Assignee: | Joe Rafaniello <jrafanie> | |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Tasos Papaioannou <tpapaioa> | |
| Severity: | high | Docs Contact: | ||
| Priority: | high | |||
| Version: | 5.9.0 | CC: | abellott, cpelland, obarenbo, tpapaioa | |
| Target Milestone: | GA | Keywords: | TestOnly, ZStream | |
| Target Release: | 5.10.0 | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | 5.10.0.0 | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1552804 (view as bug list) | Environment: | ||
| Last Closed: | 2019-02-11 14:04:45 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | Bug | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | CFME Core | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1552804 | |||
|
Description
Joe Rafaniello
2018-02-28 16:30:04 UTC
Upstream PRs have been merged: https://github.com/ManageIQ/manageiq/pull/17039 https://github.com/ManageIQ/manageiq/pull/17059 QE:
Upstream PRs are merged, the desired result is if you try to specify a number and it's treated as a string (how ruby handles anything in ARGV), we should yell at you:
$ ./tools/configure_server_settings.rb -s1 -p workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/count -v 4
{:dry_run=>false, :serverid=>1, :path=>"workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/count", :value=>"4", :force=>false, :type=>"string", :help=>false, :serverid_given=>true, :path_given=>true, :value_given=>true}
** Using session_store: ActionDispatch::Session::MemCacheStore
The new value's class String does not match the prior one's Integer. Use -t to specify the type for the provided value. Use -f to force changing this value. Note, -f may break things! See -h for examples.
You are forced to
1) use -f to force the script to store the "4" value, which is what you normally don't want to do.
2) or to specify the type.
$ ./tools/configure_server_settings.rb -s 1 -p workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/count -v 4 -t integer
{:dry_run=>false, :serverid=>1, :path=>"workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/count", :value=>"4", :force=>false, :type=>"integer", :help=>false, :serverid_given=>true, :path_given=>true, :value_given=>true, :type_given=>true}
** Using session_store: ActionDispatch::Session::MemCacheStore
Setting [workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/count], old value: [2], new value: [4]
Done
Note, --help or -h shows the possible values for the datatype:
$ ./tools/configure_server_settings.rb -h
USAGE: ./tools/configure_server_settings.rb -s <server id> -p <settings path separated by a /> -v <new value>
Example (String): ./tools/configure_server_settings.rb -s 1 -p reporting/history/keep_reports -v 3.months
Example (Integer): ./tools/configure_server_settings.rb -s 1 -p workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/count -v 1 -t integer
Example (Boolean): ./tools/configure_server_settings.rb -s 1 -p ui/mark_translated_strings -v true -t boolean
Example (Symbol): ./tools/configure_server_settings.rb -s 1 -p workers/worker_base/queue_worker_base/ems_metrics_collector_worker/defaults/poll_method -v escalate -t symbol
Example (Float): ./tools/configure_server_settings.rb -s 1 -p capacity/profile/1/vcpu_commitment_ratio -v 1.5 -t float
-d, --dry-run Dry Run
-s, --serverid=<i> Server Id
-p, --path=<s> Path within advanced settings hash
-v, --value=<s> New Value for setting
-f, --force Force change value regardless of type
-t, --type=<s> Type of value provided, ["string", "integer", "boolean", "symbol", "float"] (default: string)
-h, --help Show this message
Verified on 5.10.0.15. |