Sha256: 25d48e7efe5cfa4ed5b9e5431ac3803a32cc162196d705f524e86aed88574f51
Contents?: true
Size: 726 Bytes
Versions: 6
Compression:
Stored size: 726 Bytes
Contents
require "sfn" module Sfn module Utils # Helper methods for SSH interactions module Ssher # Retrieve file from remote node # # @param address [String] # @param user [String] # @param path [String] remote file path # @param ssh_opts [Hash] # @return [String, NilClass] def remote_file_contents(address, user, path, ssh_opts = {}) if path.to_s.strip.empty? raise ArgumentError.new "No file path provided!" end require "net/ssh" content = "" ssh_session = Net::SSH.start(address, user, ssh_opts) content = ssh_session.exec!("sudo cat #{path}") content.empty? ? nil : content end end end end
Version data entries
6 entries across 6 versions & 1 rubygems