-
Notifications
You must be signed in to change notification settings - Fork 38
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
[UNTESTED] immediately abort chef-client if maintenance mode is set #13
base: master
Are you sure you want to change the base?
Conversation
if maintenance_mode? | ||
raise \ | ||
"Pacemaker maintenance mode was already set on " + | ||
"#{node.hostname}; aborting! Please diagnose why this was the " + |
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/MultilineOperationIndentation: Use 2 (not 0) spaces for indenting an expression spanning multiple lines.
2cc0c35
to
4352717
Compare
"not by Chef::Provider::PacemakerService; leaving as is") | ||
# This shouldn't happen, and suggests that something is | ||
# interfering in a way it shouldn't. | ||
raise "Something put node into maintenance mode during run!" |
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.
Not sure I would raise something here; if the admin did put the node in maintenance while chef-client was running, then, well, that's the way it is and why should chef fail because of that?
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.
Yeah OK, I guess a Chef::Log.warn
is more appropriate here.
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.
Fixed.
4352717
to
d4eb66f
Compare
+1 |
The reasoning is explained in the comments. I'm not sure why I ever thought it was a good idea to allow a chef-client run to proceed if maintenance mode is set. It's not even as if that approach could ever restore an ill node to full health, because we were deliberately checking whether the maintenance mode was set prior to the chef-client run, and if so, leaving it set. This way, if a node is left in maintenance mode, it will be discovered sooner, resulting in the cloud operator being alerted to a degraded cluster sooner.
d4eb66f
to
8661acd
Compare
end | ||
|
||
Chef::Log.debug("Cluster is up") | ||
return true |
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/RedundantReturn: Redundant return
detected.
Crap, raising an exception in the start handler doesn't abort the run :-(
Need to find a way to do this. |
Make #maintenance_mode? return a sensible value even when Pacemaker is down or uninstalled. This is especially helpful when it is invoked by Chef's start_handler. Cherry-picked from crowbar/barclamp-pacemaker@7dff6c1.
8661acd
to
43590c4
Compare
@aspiers still relevant? if so, can you rebase? |
Changes Unknown when pulling 43590c4 on aspiers:abort-on-maintenance-mode into ** on crowbar:master**. |
@aspiers is this still alive or should we close it? |
The reasoning is explained in the comments. I'm not sure why I ever thought it was a good idea to allow a chef-client run to proceed if maintenance mode is set. It's not even as if that approach could ever restore an ill node to full health, because we were deliberately checking whether the maintenance mode was set prior to the chef-client run, and if so, leaving it set. This way, if a node is left in maintenance mode, it will be discovered sooner, resulting in the cloud operator being alerted to a degraded cluster sooner.
Also ported crowbar/barclamp-pacemaker#149 on top of this.