network: Ensure data returned by allocate_ip is correct#1563
Open
vuntz wants to merge 2 commits intocrowbar:masterfrom
Open
network: Ensure data returned by allocate_ip is correct#1563vuntz wants to merge 2 commits intocrowbar:masterfrom
vuntz wants to merge 2 commits intocrowbar:masterfrom
Conversation
When allocate_ip is called, it returns some data representing the related network information. However, as network attributes can be overridden by having attributes on a node (to override the conduit for a specific network on that node, for instance), which is something that was not reflected here, resulting in incorrect data.
52e2c25 to
9cad67d
Compare
houndci-bot
reviewed
Apr 26, 2018
| net_info[k] = v unless v.nil? | ||
| def build_net_info(role, network, node) | ||
| net_info = role.default_attributes["network"]["networks"][network].to_hash | ||
| unless node.nil? || node.crowbar.nil? |
There was a problem hiding this comment.
Style/IfUnlessModifier: Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||. (https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier)
Member
Author
There was a problem hiding this comment.
This makes the line too long... so no thanks
e6cb56b to
65acda8
Compare
We were looking for attributes overriding the network proposal only on the node role, but this is not consistent with what the cookbook does (it looks at attributes on the node itself), and customer using this feature are more likely to edit the node directly. So reflect that by looking at the node attributes also. This is slightly tricky, as the merge of node attributes and node role attributes occur on a chef run, and in the rails app, this can be out of sync. So we do our own merge to always see the real values.
65acda8 to
d5bb352
Compare
rhafer
reviewed
May 4, 2018
|
|
||
| Rails.logger.info("Network enable_interface: Assigned: #{name} #{network}") | ||
| [200, build_net_info(role, network)] | ||
| [200, build_net_info(role, network, nil)] |
Contributor
There was a problem hiding this comment.
@vuntz I might be missing something obvious by why is enable_interface passing nil here instead of the node?
Contributor
|
@vuntz are you still interessted in workin on this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When allocate_ip is called, it returns some data representing the
related network information. However, as network attributes can be
overridden by having attributes on a node (to override the conduit for a
specific network on that node, for instance), which is something that
was not reflected here, resulting in incorrect data.