72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/bolt/transport/lxd/connection.rb', line 72
def upload_file(source, destination)
@logger.trace { "Uploading #{source} to #{destination}" }
args = %w[--create-dirs]
if File.directory?(source)
args << '--recursive'
destination = Pathname.new(destination).dirname.to_s
end
cmd = %w[file push] + args + %W[#{source} #{container_id}#{destination}]
_out, err, stat = execute_local_command(cmd)
unless stat.exitstatus.zero?
raise "Error writing to #{container_id}: #{err}"
end
rescue StandardError => e
raise Bolt::Node::FileError.new(e.message, 'WRITE_ERROR')
end
|