class SSHKit::Backend::NetsshGlobal
Public Class Methods
config()
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 16 def config @config ||= Configuration.new end
Public Instance Methods
upload!(local, remote, options = {})
click to toggle source
Calls superclass method
# File lib/sshkit/backends/netssh_global.rb, line 23 def upload!(local, remote, options = {}) execute :setfacl, "-m u:#{ssh_user}:rwx #{File.dirname(remote)}; true" execute :setfacl, "-m u:#{ssh_user}:rw #{remote}; true" super as :root do # Required as uploaded file is owned by SSH user, not owner execute :chown, property(:owner), remote end end
Private Instance Methods
command(args, options)
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 69 def command(args, options) options.merge!( in: pwd, env: @env, host: configure_host, user: user, group: @group, ssh_commands: property(:ssh_commands), shell: property(:shell) ) SSHKit::CommandSudoSshForward.new(*args.concat([options])) end
configure_host()
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 63 def configure_host host.tap do |h| h.ssh_options = self.class.config.ssh_options.merge(host.ssh_options || {}) end end
property(name)
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 47 def property(name) host.properties.public_send(name) || self.class.config.public_send(name) end
pwd()
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 43 def pwd @pwd.nil? ? property(:directory) : File.join(@pwd) end
ssh_user()
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 39 def ssh_user host.user || configure_host.ssh_options.fetch(:user) end
user()
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 35 def user @user || property(:owner) end
with_ssh() { |connection| ... }
click to toggle source
# File lib/sshkit/backends/netssh_global.rb, line 51 def with_ssh configure_host self.class.pool.with( Net::SSH.method(:start), String(host.hostname), host.username, host.netssh_options ) do |connection| yield connection end end