Created
February 13, 2013 21:10
-
-
Save ctgswallow/4948302 to your computer and use it in GitHub Desktop.
confusing redis stuff
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
# Retrieve all nodes' local hostnames and set the master_ip | |
# based on a match to *this* node's local hostname. | |
# | |
# I don't know why this is even necessary. | |
redis_nodes = all_provider_local_hostnames(node[:redis][:service_name]) | |
master_ip = "" | |
myhostname = node[:cloud][:local_hostname] rescue node[:fqdn] | |
found = 0 | |
redis_sorted_nodes = redis_nodes.sort | |
redis_sorted_nodes.length.times do |j| | |
if found == 1 then | |
master_ip = redis_sorted_nodes[j] | |
break | |
end | |
if redis_sorted_nodes[j] == myhostname then | |
found = 1 | |
end | |
end | |
if master_ip == "" then | |
master_ip = redis_sorted_nodes[0] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment