-
Notifications
You must be signed in to change notification settings - Fork 59
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
crowbar: Self-heal if node is missing its node role in the run list #1565
base: master
Are you sure you want to change the base?
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.
crowbar_framework/app/models/node.rb
Outdated
|
||
role | ||
end | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
Was there a bugreport? This sound familiar. Also travis is failing. |
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.
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.