Method: Bolt::Transport::LXD::Connection#download_file

Defined in:
lib/bolt/transport/lxd/connection.rb

#download_file(source, destination, _download) ⇒ Object



90
91
92
93
94
95
96
97
98
99
# File 'lib/bolt/transport/lxd/connection.rb', line 90

def download_file(source, destination, _download)
  @logger.trace { "Downloading #{source} to #{destination}" }
  FileUtils.mkdir_p(destination)
  _out, err, stat = execute_local_command(%W[file pull --recursive #{container_id}#{source} #{destination}])
  unless stat.exitstatus.zero?
    raise "Error downloading content from container #{container_id}: #{err}"
  end
rescue StandardError => e
  raise Bolt::Node::FileError.new(e.message, 'WRITE_ERROR')
end