Module: Deltacloud::Runner

Defined in:
lib/deltacloud/runner.rb

Defined Under Namespace

Classes: InstanceSSHError, Network, Response, RunnerError, SSH

Class Method Summary collapse

Class Method Details

.execute(command, opts = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/deltacloud/runner.rb', line 34

def self.execute(command, opts={})

  if opts[:credentials] and (not opts[:credentials][:password] and not opts[:private_key])
    raise RunnerError::new("Either password or key must be specified")
  end

  # First check networking and firewalling
  network = Network::new(opts[:ip], opts[:port])

  # Then check SSH availability
  ssh = SSH::new(network, opts[:credentials], opts[:private_key])

  # Finaly execute SSH command on instance
  ssh.execute(command)
end