Skip to content

Commit 0d8c5b5

Browse files
committed
crowbar: Self-heal if node is missing its node role in the run list
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.
1 parent 64e7832 commit 0d8c5b5

File tree

1 file changed

+4
-0
lines changed
  • crowbar_framework/app/models

1 file changed

+4
-0
lines changed

crowbar_framework/app/models/node.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def initialize(node, role = nil)
3939
raise Crowbar::Error::NotFound.new
4040
end
4141
end
42+
unless node.run_list.run_list_items.include?("role[#{@role.name}]")
43+
node.run_list.run_list_items << "role[#{@role.name}]"
44+
node.save
45+
end
4246
# deep clone of @role.default_attributes, used when saving node
4347
@attrs_last_saved = @role.default_attributes.deep_dup
4448
@node = node

0 commit comments

Comments
 (0)