Skip to content
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

[WIP] Add knockout prefix for removed array elements #7656

Conversation

carbonin
Copy link
Member

@carbonin carbonin commented Apr 1, 2016

By default the config gem merges array values in the various config sources.
This means that removing elements from an array value will never take effect.

The knockout prefix tells the gem that the matching elements in other config sources should be removed.

@Fryguy please review

@carbonin
Copy link
Member Author

carbonin commented Apr 1, 2016

@miq-bot add_label wip, bug, core

@miq-bot
Copy link
Member

miq-bot commented Apr 1, 2016

@carbonin Cannot apply the following label because they are not recognized: wip bug core

@carbonin
Copy link
Member Author

carbonin commented Apr 1, 2016

@Fryguy At this point the correct final hash is visible in Settings.path.to.array.value after just removing the values in the UI yml editor, but the changes are not visible in the UI.

I suspect this is a separate issue.

@@ -19,6 +19,8 @@ def self.diff(h1, h2)
child =
if v1.kind_of?(Hash) && v2.kind_of?(Hash)
diff(v1, v2)
elsif v1.kind_of?(Array) && v2.kind_of?(Array)
v2 + (v1 - v2).map { |x| "#{KNOCKOUT_STRING}#{x}" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should live in the HashDiffer as that class should not be aware of the config gem (it's generic diffing code)...let's discuss today if you have time.

The config gem merges array values by default so we need
to specify a prefix to elements that we want to explicity
remove from the template.

NOTE: We will need a different solution for non-string values
@carbonin carbonin force-pushed the add_knockout_to_config_settings_diff branch from 0faeb68 to 643eb34 Compare April 1, 2016 18:20
@miq-bot
Copy link
Member

miq-bot commented Apr 1, 2016

Checked commit carbonin@643eb34 with ruby 2.2.3, rubocop 0.37.2, and haml-lint 0.16.1
4 files checked, 0 offenses detected
Everything looks good. 👍

@miq-bot
Copy link
Member

miq-bot commented Apr 1, 2016

<github_pr_commenter_batch />Some comments on commit carbonin@643eb34

@carbonin
Copy link
Member Author

carbonin commented Apr 1, 2016

Closing in favor of #7670

@carbonin carbonin closed this Apr 1, 2016
chessbyte pushed a commit that referenced this pull request Apr 5, 2016
The ability to override Arrays has been made into a PR upstream at
rubyconfig/config#137 and
danielsdeleo/deep_merge#21 . However, they
are not yet merged.  When they are merged and released, we can
switch back to a released version.

Supercedes #7656
Paired on this with @carbonin
alongoldboim pushed a commit to alongoldboim/manageiq that referenced this pull request Apr 10, 2016
The ability to override Arrays has been made into a PR upstream at
rubyconfig/config#137 and
danielsdeleo/deep_merge#21 . However, they
are not yet merged.  When they are merged and released, we can
switch back to a released version.

Supercedes ManageIQ#7656
Paired on this with @carbonin
@carbonin carbonin deleted the add_knockout_to_config_settings_diff branch June 10, 2016 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants