Skip to content

Commit

Permalink
fix hardcoded --ram node type for cluster join, fixes #326
Browse files Browse the repository at this point in the history
  • Loading branch information
scalp42 committed Dec 16, 2015
1 parent a5ec2a6 commit feb82f9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions providers/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def joined_cluster?(node_name, cluster_status)
end

# Join cluster.
def join_cluster(cluster_name)
cmd = "rabbitmqctl join_cluster --ram #{cluster_name}"
def join_cluster(cluster_name, type)
cmd = "rabbitmqctl join_cluster #{type == 'ram' ? '--ram' : ''} #{cluster_name}"
Chef::Log.debug("[rabbitmq_cluster] Executing #{cmd}")
cmd = get_shellout(cmd)
cmd.run_command
Expand Down Expand Up @@ -195,16 +195,17 @@ def change_cluster_node_type(cluster_node_type)
var_cluster_status = cluster_status
var_node_name = node_name
var_node_name_to_join = parse_cluster_nodes_string(new_resource.cluster_nodes).first['name']
var_node_type = parse_cluster_nodes_string(new_resource.cluster_nodes).first['type']

if var_node_name == var_node_name_to_join
Chef::Log.warn('[rabbitmq_cluster] Trying to join cluster node itself. Joining cluster will be skipped.')
elsif joined_cluster?(var_node_name_to_join, var_cluster_status)
Chef::Log.warn("[rabbitmq_cluster] Node is already member of #{current_cluster_name(var_cluster_status)}. Joining cluster will be skipped.")
else
run_rabbitmqctl('stop_app')
join_cluster(var_node_name_to_join)
join_cluster(var_node_name_to_join, var_node_type)
run_rabbitmqctl('start_app')
Chef::Log.info("[rabbitmq_cluster] Node #{var_node_name} joined in #{var_node_name_to_join}")
Chef::Log.info("[rabbitmq_cluster] Node #{var_node_name} joined in #{var_node_name_to_join} with type #{var_node_type}")
Chef::Log.info(cluster_status)
end
end
Expand Down

0 comments on commit feb82f9

Please sign in to comment.