Class: PoolParty::Remote::Ec2RemoteInstance
- Inherits:
-
RemoteInstance
- Object
- RemoteInstance
- PoolParty::Remote::Ec2RemoteInstance
- Includes:
- Dslify, PoolParty::Remote
- Defined in:
- lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb
Class Method Summary collapse
-
.hash_from_s(s) ⇒ Object
Class method to disect a neighborhood line.
- .to_s(hsh) ⇒ Object
Instance Method Summary collapse
- #hosts_file_listing_for(cl) ⇒ Object
-
#initialize(opts = {}) ⇒ Ec2RemoteInstance
constructor
A new instance will be created from the passed in hash.
- #keypair(*n) ⇒ Object
-
#to_s ⇒ Object
Printing.
Methods included from PoolParty::Remote
#are_any_nodes_exceeding_minimum_runtime?, #are_too_few_instances_running?, #are_too_many_instances_running?, available, #commands, #execute!, #list_of_instances, #list_of_nodes_exceeding_minimum_runtime, #netssh, #nodes, #remote_rsync_command, #remote_ssh_array, #remote_ssh_string, #rsync, #rsync_command, #rsync_storage_files_to, #rsync_storage_files_to_command, #rsync_to, #rsync_to_command, #run_command_on, #run_command_on_command, #run_command_on_instance_number, #run_local, #run_remote, #scp_array, #scp_to_command, #simplest_run_remote, #ssh_array, #ssh_command, #ssh_into, #ssh_into_instance_number, #ssh_options, #ssh_string, #target_host
Methods included from Pinger
Methods inherited from RemoteInstance
#[], #[]=, #each, #elapsed_runtime, #has_key?, #keys, #load, #on_init, #pending?, #running?, #terminated?, #terminating?, #valid?, #values
Constructor Details
#initialize(opts = {}) ⇒ Ec2RemoteInstance
A new instance will be created from the passed in hash.
This hash of passed in values will be converted to methods on this instance. The parent clouds describe_instances list will be searched for the first one matching any of this instance’s provided unique identifiers. If an instance is found, this instance’s properties will be set to the properties provided If the found instance has properties of the same key as the provided options, the found instance’s values will override the passed in options
30 31 32 33 34 35 |
# File 'lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb', line 30 def initialize(opts={}) opts.delete(:id) # metavirt passes an id that we do not want to set (opts) if opts.is_a?(Hash) @target_host = public_ip || internal_ip || ip #set this for the netssh commands # super(opts) end |
Class Method Details
.hash_from_s(s) ⇒ Object
Class method to disect a neighborhood line
48 49 50 51 |
# File 'lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb', line 48 def self.hash_from_s(s) arr = s.split("\t") {:name => arr[0], :ip => arr[1]} end |
.to_s(hsh) ⇒ Object
53 54 55 |
# File 'lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb', line 53 def self.to_s(hsh) new(hsh).to_s end |
Instance Method Details
#hosts_file_listing_for(cl) ⇒ Object
57 58 59 60 |
# File 'lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb', line 57 def hosts_file_listing_for(cl) string = (cl.name == cloud.name) ? "#{name}.#{my_cloud.name}\t#{name}" : "#{name}.#{my_cloud.name}" "#{internal_ip}\t#{string}" end |
#keypair(*n) ⇒ Object
37 38 39 |
# File 'lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb', line 37 def keypair(*n) [:keypair] ||= Key.new(key_name) end |
#to_s ⇒ Object
Printing. This is how we extract the instances into the listing on the local side into the local listing file
43 44 45 |
# File 'lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb', line 43 def to_s "#{name}\t#{ip}\t#{instance_id rescue ""}" end |