lib/mccloud/provider/aws/provider.rb in mccloud-0.0.24 vs lib/mccloud/provider/aws/provider.rb in mccloud-0.0.25
- old
+ new
@@ -216,14 +216,19 @@
def hosts
hostentries = Hash.new
filter = self.filter
self.raw.servers.each do |s|
- name = s.tags["Name"].sub(/^#{filter}/,'')
- hostentries = Hash.new
- hostentries[name]=s.public_ip_address
- hostentries[name]=s.private_ip_address
+ name_tag = s.tags["Name"]
+ if name_tag.start_with?(filter)
+ servername = name_tag.sub(/^#{filter}/,'')
+ h = Hash.new
+ h['public_ip_address']=s.public_ip_address
+ h['private_ip_address']=s.private_ip_address
+ hostentries[servername] = h
+ end
end
+
return hostentries
end
end
end