-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing things via the server/region/zone settings endpoint might break the format of the settings #979
Comments
@kbrock and I looked at config/settings.yml. As an experiment, we did the following: orig=YAML.load_file("./config/settings.yml")
File.write("./config/settings2.yml", YAML.dump(orig))
s2=YAML.load_file("./config/settings2.yml")
s3=JSON.parse(s2.to_json, :symbolize_names => true)
File.write("./config/settings3.yml", YAML.dump(s3)) (git:kasparov) ~/work/ibm/manageiq$ diff -wb config/settings{,2}.yml
55c55
< :reindex_schedule: "1 * * * *"
---
> :reindex_schedule: 1 * * * *
59c59
< :vacuum_schedule: "0 2 * * 6"
---
> :vacuum_schedule: 0 2 * * 6
98d97
<
104,107d102
< # provider specific settings are nested here, but they are in the provider repos
< # e.g.:
< # :ems_<provider_name>:
< # :use_feature: false
1052c1047
< :retry_interval: 15 # in seconds
---
> :retry_interval: 15
1173c1168
< :chargeback_generation_time_utc: 01:00:00
---
> :chargeback_generation_time_utc: 3600 Without ignoring whitespace, there were about 30 other differences. diff config/settings{2,3}.yml
985c985
< :name: :used_swap_percent_gt_value
---
> :name: used_swap_percent_gt_value
991c991
< :name: :used_swap_percent_lt_value
---
> :name: used_swap_percent_lt_value
1086c1086
< :poll_method: :normal
---
> :poll_method: normal
1116,1117c1116,1117
< :dequeue_method: :drb
< :poll_method: :normal
---
> :dequeue_method: drb
> :poll_method: normal
1123c1123
< :poll_method: :escalate
---
> :poll_method: escalate
1129c1129
< :poll_method: :escalate
---
> :poll_method: escalate
1136c1136
< :poll_method: :normal
---
> :poll_method: normal
1138c1138
< :dequeue_method: :sql
---
> :dequeue_method: SQL Note: Here the main differences are due to values that were originally symbols are now strings and whitespaces. |
ProcessOur settings is stored in yaml and edited in json:
yaml and yaml2 are not the same, even when no edits are made. Where changes occurredWe looked at the 2 serialization processes:
I ran GT's script on I feel the original note conflated the two issues. from ruby to json back to ruby objectsChanges introduced:
These are both native ruby types, so it makes sense that javascript centric json would not know how to handle them. from yaml to ruby back to yamlChanges introduced:
Of note, if I ran the serialization and deserialization process on the output file to another output file, it ended up with the same file. so at least it is deterministic. All hashes and arrays were in the same order. These changes do not loose data but do alter it. Most of these changes are fixing errors in the original yaml files. ProposalWe have a few ways to solve this:
I propose the second option:
verbose: Modify all settings files so the yaml deserialization and serialization process produces the same output as the original input. This is basically done by running the yaml only portion of the script above and replacing the original scripts. I am not happy about loosing the comments but our current yaml process does loose them, and all the other changes are fixing indentation and escaping issues. Modify manageiq in a few spots to handle string or symbolic values. It is possible that the code will work unchanged. Modifying plugins to convert strings to regular expressions where they are used (i.e.: We need to ensure there are no other settings files are also used. @gtanzillo I did not see the |
Notes from @gtanzillo and @kbrock:
|
update:
|
Moving forward, I wonder if we should change our settings.yml to settings.json... This way we can't introduce non-JSON stuff. |
@kbrock any update on this? |
This issue has been automatically marked as stale because it has not been updated for at least 3 months. If you can still reproduce this issue on the current release or on Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
Basically a format conversion problem, the settings are coming from YAML but presented as JSON are bringing in some conversion artifacts that are described here.
@miq-bot assign @gtanzillo
We should probably discuss this on our next UI/API meeting...
See also ManageIQ/manageiq#17201
The text was updated successfully, but these errors were encountered: