forked from rabbitmq/chef-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds some helper functions to allow a wrapper cookbook to implement removing a node from a cluster in 2 sceneries: - removing self from cluster (helpful for normal decommission) - removing any node from cluster (helpful for abruptly terminated machines) These both should not be actually consumed in this cookbook and simply be provided for wrappers to use as they see fit. This should be implemented only after careful thought, design, testing, etc.
- Loading branch information
1 parent
e5e1543
commit 9ae91c7
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module RabbitMQCookbook | ||
module Helpers | ||
require 'mixlib/shellout' | ||
|
||
def remove_self_from_cluster | ||
# stop rmq | ||
stop_rmq = Mixlib::ShellOut.new('rabbitmqctl stop_app') | ||
stop_rmq.run_command | ||
stop_rmq.error! | ||
# remove self from cluster | ||
remove_from_cluster = Mixlib::ShellOut.new('rabbitmqctl reset') | ||
remove_from_cluster.run_command | ||
remove_from_cluster.error! | ||
end | ||
|
||
def remove_remote_node_from_cluster(rmq_node) | ||
remove_from_cluster = Mixlib::ShellOut.new("rabbitmqctl forget_cluster_node #{rmq_node}") | ||
remove_from_cluster.run_command | ||
remove_from_cluster.error! | ||
end | ||
end | ||
end |