Class: SSHKit::Backend::Netssh

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

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary

Attributes inherited from Abstract

#host

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommandHelper

#make, #rake

Methods inherited from Abstract

#as, #initialize, #make, #rake, #with, #within

Constructor Details

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

Class Method Details

.configObject



45
46
47
# File 'lib/sshkit/backends/netssh.rb', line 45

def config
  @config ||= Configuration.new
end

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

Yields:



41
42
43
# File 'lib/sshkit/backends/netssh.rb', line 41

def configure
  yield config
end

Instance Method Details

#background(*args) ⇒ Object



30
31
32
33
# File 'lib/sshkit/backends/netssh.rb', line 30

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

#capture(*args) ⇒ Object



35
36
37
38
# File 'lib/sshkit/backends/netssh.rb', line 35

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

#execute(*args) ⇒ Object



26
27
28
# File 'lib/sshkit/backends/netssh.rb', line 26

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

#runObject



14
15
16
# File 'lib/sshkit/backends/netssh.rb', line 14

def run
  instance_exec(host, &@block)
end

#test(*args) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/sshkit/backends/netssh.rb', line 18

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