Sha256: 9ed29967495de63906e9e675b333640467001a996ac27e6a9219e0eee5ddac34

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

module SeleniumGrid
  module AWS
  
    class Server
      extend Ec2Client
      
      attr_accessor :instance_id, :public_dns, :private_dns
    
      def initialize(instance_id)
        self.instance_id = instance_id
      end       

      def self.boot(ami, options = {})
        new launch(ami, options)
      end

      def self.boot_and_acquire_dns(ami, options)
        server = boot(ami, options)
        server.wait_for_dns
      end

      def wait_for_dns
        puts "Fetching DNS Info..."
        until dns_allocated?
          sleep 2
          putc "."
          refresh_status
        end
        puts
        self
      end
      
      def dns_allocated?
        public_dns != nil && public_dns != "" &&
        private_dns != nil && private_dns != ""
      end
      
      def refresh_status
        info = self.class.describe instance_id
        @public_dns = info[:public_dns]
        @private_dns = info[:private_dns]
      end

      def shutdown
        self.class.shutdown instance_id
      end
            
      def run(command, options)
        command = RemoteCommand.new command, options.merge(:host => public_dns)
        command.execute
      end         
    end

  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
selenium-rspec-dsl-1.0.2 vendor/selenium-grid-1.0.4/examples/ec2/lib/selenium_grid/aws/server.rb
davidtrogers-selenium-grid-0.0.1 examples/ec2/lib/selenium_grid/aws/server.rb
statt-0.0.1 lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb