Skip to content

Commit

Permalink
Adding patterns to catch instances where the node name is surrounded …
Browse files Browse the repository at this point in the history
…by single-quotes
  • Loading branch information
Khaled Janania committed May 12, 2015
1 parent 3277655 commit c83cb6d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions providers/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,23 @@ def current_cluster_name(cluster_status)

# Get running nodes
def running_nodes(cluster_status)
pattern = '({running_nodes,\[)(.*?)(\]})'
pattern = '({running_nodes,\[\'*)(.*?)(\'*\]})'
result = match_pattern_cluster_status(cluster_status, pattern)
Chef::Log.debug("[rabbitmq_cluster] running_nodes : #{result}")
result.split(',')
end

# Get disc nodes
def disc_nodes(cluster_status)
pattern = '({disc,\[)(.*?)(\]})'
pattern = '({disc,\[\'*)(.*?)(\'*\]})'
result = match_pattern_cluster_status(cluster_status, pattern)
Chef::Log.debug("[rabbitmq_cluster] disc_nodes : #{result}")
result.split(',')
end

# Get ram nodes
def ram_nodes(cluster_status)
pattern = '({ram,\[)(.*?)(\]})'
pattern = '({ram,\[\'*)(.*?)(\'*\]})'
result = match_pattern_cluster_status(cluster_status, pattern)
Chef::Log.debug("[rabbitmq_cluster] ram_nodes : #{result}")
result.split(',')
Expand All @@ -109,6 +109,7 @@ def node_name
cmd.run_command
cmd.error!
result = cmd.stdout.chomp
result.gsub!(/'/, '')
Chef::Log.debug("[rabbitmq_cluster] node name : #{result}")
result
end
Expand Down

0 comments on commit c83cb6d

Please sign in to comment.