-
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] Fix remote node maintenance (bsc#983617) #187
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,17 @@ module CrowbarPacemaker | |
# A mixin for Chef::Pacemaker::Handler subclasses, and also for the | ||
# Chef::Provider::PacemakerService LWRP. | ||
module MaintenanceModeHelpers | ||
def maintenance_mode? | ||
pacemaker_node = if !node[:pacemaker].nil? && node[:pacemaker][:is_remote] | ||
def pacemaker_node_name | ||
if !node[:pacemaker].nil? && node[:pacemaker][:is_remote] | ||
"remote-#{node.hostname}" | ||
else | ||
node.hostname | ||
end | ||
end | ||
|
||
def maintenance_mode? | ||
# See https://bugzilla.suse.com/show_bug.cgi?id=870696 | ||
!! (`crm_attribute -G -N #{pacemaker_node} -n maintenance -d off -q` =~ /^on$/) | ||
!! (`crm_attribute -G -N #{pacemaker_node_name} -n maintenance -d off -q` =~ /^on$/) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/DoubleNegation: Avoid the use of double negation (!!). (https://github.com/bbatsov/ruby-style-guide#no-bang-bang) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here. |
||
end | ||
|
||
def record_maintenance_mode_before_this_chef_run | ||
|
@@ -65,7 +68,7 @@ def set_maintenance_mode | |
elsif maintenance_mode? | ||
Chef::Log.info("Something else already placed this node in Pacemaker maintenance mode") | ||
else | ||
execute "crm --wait node maintenance" do | ||
execute "crm --wait node maintenance #{pacemaker_node_name}" do | ||
action :nothing | ||
end.run_action(:run) | ||
set_maintenance_mode_via_this_chef_run | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
default[:pacemaker][:platform][:packages] = | ||
%w(pacemaker crmsh fence-agents) | ||
default[:pacemaker][:platform][:remote_packages] = | ||
%w(pacemaker-remote fence-agents) | ||
%w(pacemaker-remote pacemaker-cli crmsh fence-agents) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/WordArray: Use [] for an array of words. (https://github.com/SUSE/style-guides/blob/master/Ruby.md#stylewordarray) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree with the dog here. |
||
default[:pacemaker][:platform][:sbd_packages] = | ||
%w(sbd) | ||
else | ||
|
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.
What about just
if node[:pacemaker] && node[:pacemaker][:is_remote]
?