Permalink
Browse files

Split datacenter and area field for EC2 snitch

  • Loading branch information...
b committed Mar 17, 2010
1 parent 3348a7f commit 3505aa4fcc901e68c2089479c2b3670305892699
Showing with 3 additions and 3 deletions.
  1. +3 −3 cassandra/recipes/ec2snitch.rb
@@ -1,13 +1,13 @@
@topo_map = search(:node, "cassandra_cluster_name:#{node[:cassandra][:cluster_name]} AND ec2:placement_availability_zone").map do |n|
az_parts = n[:ec2][:placement_availability_zone].split('-')
@topo_map[n['ipaddress']] = {:port => n[:cassandra][:storage_port],
- :rack => az_parts.last,
- :dc => az_parts[0..1].join('-')}
+ :rack => az_parts.last[1],
+ :dc => az_parts[0..1].join('-') + "-#{az_parts.last[0]}"}
end
node.set_unless[:cassandra][:ec2_snitch_default_az] = "us-east-1a"
default_az_parts = node[:cassandra][:ec2_snitch_default_az].split('-')
-@default_az = {:rack => default_az_parts.last, :dc => default_az_parts[0..1].join('-')}
+@default_az = {:rack => default_az_parts.last[1], :dc => default_az_parts[0..1].join('-') + "-#{default_az_parts.last[0]}"}
template "/etc/cassandra/rack.properties" do
variables(:topo_map => @topo_map, :default_az => @default_az)

0 comments on commit 3505aa4

Please sign in to comment.