Class: SSHKit::Backend::Netssh

Inherits:
Printer show all
Includes:
CommandHelper
Defined in:
lib/sshkit/backends/netssh.rb

Defined Under Namespace

Classes: Configuration

Class Attribute Summary collapse

Attributes inherited from Abstract

#host

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommandHelper

#make, #rake

Methods inherited from Abstract

#as, #debug, #error, #fatal, #info, #initialize, #log, #make, #rake, #trace, #warn, #with, #within

Constructor Details

This class inherits a constructor from SSHKit::Backend::Abstract

Class Attribute Details

.poolObject

Returns the value of attribute pool.



92
93
94
# File 'lib/sshkit/backends/netssh.rb', line 92

def pool
  @pool
end

Class Method Details

.configObject



98
99
100
# File 'lib/sshkit/backends/netssh.rb', line 98

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



94
95
96
# File 'lib/sshkit/backends/netssh.rb', line 94

def configure
  yield config
end

Instance Method Details

#background(*args) ⇒ Object



69
70
71
72
# File 'lib/sshkit/backends/netssh.rb', line 69

def background(*args)
  options = args.extract_options!.merge(run_in_background: true)
  _execute(*[*args, options]).success?
end

#capture(*args) ⇒ Object



74
75
76
77
# File 'lib/sshkit/backends/netssh.rb', line 74

def capture(*args)
  options = args.extract_options!.merge(verbosity: Logger::DEBUG)
  _execute(*[*args, options]).full_stdout.strip
end

#download!(remote, local = nil, options = {}) ⇒ Object



84
85
86
87
# File 'lib/sshkit/backends/netssh.rb', line 84

def download!(remote, local=nil, options = {})
  summarizer = transfer_summarizer('Downloading')
  ssh.scp.download!(remote, local, options, &summarizer)
end

#execute(*args) ⇒ Object



65
66
67
# File 'lib/sshkit/backends/netssh.rb', line 65

def execute(*args)
  _execute(*args).success?
end

#runObject



53
54
55
# File 'lib/sshkit/backends/netssh.rb', line 53

def run
  instance_exec(host, &@block)
end

#test(*args) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/sshkit/backends/netssh.rb', line 57

def test(*args)
  options = args.extract_options!.merge(
    raise_on_non_zero_exit: false,
    verbosity: Logger::DEBUG
  )
  _execute(*[*args, options]).success?
end

#upload!(local, remote, options = {}) ⇒ Object



79
80
81
82
# File 'lib/sshkit/backends/netssh.rb', line 79

def upload!(local, remote, options = {})
  summarizer = transfer_summarizer('Uploading')
  ssh.scp.upload!(local, remote, options, &summarizer)
end