crowbar: Self-heal if node is missing its node role in the run list#1565
Open
vuntz wants to merge 3 commits intocrowbar:masterfrom
Open
crowbar: Self-heal if node is missing its node role in the run list#1565vuntz wants to merge 3 commits intocrowbar:masterfrom
vuntz wants to merge 3 commits intocrowbar:masterfrom
Conversation
While this should never happen, it did happen for a user who was manipulating chef data. And when this happens, this basically blocks all of Crowbar. It's trivial enough to self-heal to justify that it's worth it.
houndci-bot
reviewed
Apr 26, 2018
|
|
||
| def ensure_node_role(node, role_name = nil) | ||
| role_name = make_role_name(node.name) if role_name.nil? | ||
| unless node.run_list.run_list_items.include?("role[#{role_name}]") |
There was a problem hiding this comment.
Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression. (https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals)
Member
|
Was there a bugreport? This sound familiar. Also travis is failing. |
Member
Author
Nothing in bugzilla, something I got from a customer during a discussion. |
Instead of looking at the run list items directly, use the proper methods from Chef::RunList.
rsalevsky
approved these changes
May 24, 2018
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.
While this should never happen, it did happen for a user who was
manipulating chef data. And when this happens, this basically blocks all
of Crowbar.
It's trivial enough to self-heal to justify that it's worth it.