lib/poolparty/net/remoter_base.rb in auser-poolparty-0.2.60 vs lib/poolparty/net/remoter_base.rb in auser-poolparty-0.2.61

- old
+ new

@@ -69,19 +69,21 @@ def get_instance_by_number(i=0, list = remote_instances_list) name = (i.zero? ? "master" : "node#{i}") list.select {|i| i.name == name }.first end def remote_instances_list - list_of_instances.map {|i| PoolParty::Remote::RemoteInstance.new(i, self) } + # puts "> #{@containing_cloud.name} - #{@containing_cloud.class}" + @containing_cloud = self + @remote_instances_list ||= list_of_instances(keypair).collect {|h| PoolParty::Remote::RemoteInstance.new(h, @containing_cloud) } end # List the instances for the current key pair, regardless of their states # If no keypair is passed, select them all def list_of_instances(keyp=nil) key = keyp ? keyp : keypair unless @describe_instances tmpInstanceList = describe_instances.select {|a| key ? a[:keypair] == key : true } - has_master = !tmpInstanceList.select {|a| a[:name] == "master" }.empty? + has_master = !tmpInstanceList.select {|a| a[:name] == "master" }.empty? if has_master @describe_instances = tmpInstanceList else @id = 0 running = select_from_instances_on_status(/running/, tmpInstanceList) @@ -100,16 +102,9 @@ @describe_instances end # Select the instances based on their status def select_from_instances_on_status(status=/running/, list=[]) list.select {|a| a[:status] =~ status} - end - # Instances - # Get the master from the cloud - def master - # remote_instances_list.select {|a| a.master }.first - @list = list_from_remote - @list.reject {|a| a unless a.name =~ /master/ }.first if @list.class != String end # Helpers def create_keypair end # Reset the cache of descriptions \ No newline at end of file