Sha256: e3a4b2ca3173b3488827b1475ee3135f055a266090dd6b9d93e544cf068aa04e

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'veewee/provider/core/helper/ssh'
module Veewee
  module Provider
    module  Core
      module BoxCommand

        def ssh_command_string
         "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p #{ssh_options[:port]} -l #{definition.ssh_user} #{self.ip_address}"
        end

        def exec(command,options={})
          raise Veewee::Error,"Box is not running" unless self.running?
          begin
            new_options=ssh_options.merge(options)
            self.when_ssh_login_works(self.ip_address,new_options) do
              begin
                env.logger.info "About to execute remote command #{command} on box #{name} - #{self.ip_address} - #{new_options}"
                result=self.ssh_execute(self.ip_address,command,new_options)
                return result
              rescue RuntimeError => ex
                env.ui.error "Error executing command #{command} : #{ex}"
                raise Veewee::SshError, ex
              end
            end
          rescue Net::SSH::AuthenticationFailed => ex
            env.ui.error "Authentication failure"
            raise Veewee::SshError, ex
          end

        end
      end # Module
    end # Module
  end # Module
end # Module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veewee-0.3.0.alpha6 lib/veewee/provider/core/box/exec.rb
veewee-0.3.0.alpha5 lib/veewee/provider/core/box/exec.rb