Class: DeepTest::Distributed::LandingShip
- Inherits:
-
Object
- Object
- DeepTest::Distributed::LandingShip
- Defined in:
- lib/deep_test/distributed/landing_ship.rb
Instance Method Summary collapse
- #deploy_agents ⇒ Object
- #establish_beachhead(options) ⇒ Object
-
#initialize(config) ⇒ LandingShip
constructor
A new instance of LandingShip.
- #load_files(files) ⇒ Object
- #push_code(options) ⇒ Object
- #spawn_command(options) ⇒ Object
- #ssh_command(options) ⇒ Object
Constructor Details
#initialize(config) ⇒ LandingShip
Returns a new instance of LandingShip.
4 5 6 |
# File 'lib/deep_test/distributed/landing_ship.rb', line 4 def initialize(config) @config = config end |
Instance Method Details
#deploy_agents ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/deep_test/distributed/landing_ship.rb', line 32 def deploy_agents @wire. Beachhead::DeployAgents begin = @wire. :timeout => 1 raise "Unexpected message from Beachhead: #{.inspect}" unless .body == Beachhead::Done rescue Telegraph::NoMessageAvailable retry end end |
#establish_beachhead(options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/deep_test/distributed/landing_ship.rb', line 12 def establish_beachhead() command = "#{ssh_command()} '#{spawn_command()}' 2>&1" DeepTest.logger.debug { "Establishing Beachhead: #{command}" } output = `#{command}` output.each do |line| if DeepTest.logger.level == Logger::DEBUG puts output end if line =~ /Beachhead port: (.+)/ @wire = Telegraph::Wire.connect(@config[:address], $1.to_i) end end raise "LandingShip unable to establish Beachhead. Output from #{@config[:address]} was:\n#{output}" unless @wire end |
#load_files(files) ⇒ Object
28 29 30 |
# File 'lib/deep_test/distributed/landing_ship.rb', line 28 def load_files(files) @wire. Beachhead::LoadFiles.new(files) end |
#push_code(options) ⇒ Object
8 9 10 |
# File 'lib/deep_test/distributed/landing_ship.rb', line 8 def push_code() RSync.push(@config[:address], ., .mirror_path) end |
#spawn_command(options) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/deep_test/distributed/landing_ship.rb', line 52 def spawn_command() "#{ShellEnvironment.like_login} && " + "cd #{.mirror_path} && " + "OPTIONS=#{.to_command_line} " + "ruby lib/deep_test/distributed/establish_beachhead.rb" end |
#ssh_command(options) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/deep_test/distributed/landing_ship.rb', line 42 def ssh_command() username_option = if .[:username] " -l #{.[:username]}" else "" end "ssh -4 #{@config[:address]}#{username_option}" end |