Class: SeleniumGrid::AWS::Server
- Inherits:
-
Object
- Object
- SeleniumGrid::AWS::Server
show all
- Extended by:
- Ec2Client
- Defined in:
- lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb
Direct Known Subclasses
Hub
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Ec2Client
authorize_port, describe, ec2_shell, launch, tracing?, version
Constructor Details
#initialize(instance_id) ⇒ Server
Returns a new instance of Server.
9
10
11
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 9
def initialize(instance_id)
self.instance_id = instance_id
end
|
Instance Attribute Details
#instance_id ⇒ Object
Returns the value of attribute instance_id.
7
8
9
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 7
def instance_id
@instance_id
end
|
#private_dns ⇒ Object
Returns the value of attribute private_dns.
7
8
9
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 7
def private_dns
@private_dns
end
|
#public_dns ⇒ Object
Returns the value of attribute public_dns.
7
8
9
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 7
def public_dns
@public_dns
end
|
Class Method Details
.boot(ami, options = {}) ⇒ Object
13
14
15
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 13
def self.boot(ami, options = {})
new launch(ami, options)
end
|
.boot_and_acquire_dns(ami, options) ⇒ Object
17
18
19
20
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 17
def self.boot_and_acquire_dns(ami, options)
server = boot(ami, options)
server.wait_for_dns
end
|
Instance Method Details
#dns_allocated? ⇒ Boolean
33
34
35
36
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 33
def dns_allocated?
public_dns != nil && public_dns != "" &&
private_dns != nil && private_dns != ""
end
|
#refresh_status ⇒ Object
38
39
40
41
42
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 38
def refresh_status
info = self.class.describe instance_id
@public_dns = info[:public_dns]
@private_dns = info[:private_dns]
end
|
#run(command, options) ⇒ Object
48
49
50
51
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 48
def run(command, options)
command = RemoteCommand.new command, options.merge(:host => public_dns)
command.execute
end
|
#shutdown ⇒ Object
44
45
46
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 44
def shutdown
self.class.shutdown instance_id
end
|
#wait_for_dns ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb', line 22
def wait_for_dns
puts "Fetching DNS Info..."
until dns_allocated?
sleep 2
putc "."
refresh_status
end
puts
self
end
|