lib/nexussw/lxd/transport/mixins/helpers/folder_txfr.rb in lxd-common-0.9.4 vs lib/nexussw/lxd/transport/mixins/helpers/folder_txfr.rb in lxd-common-0.9.5

- old
+ new

@@ -61,11 +61,13 @@ def upload_using_tarball(local_path, path, options = {}) return false unless can_archive? begin tfile = Tempfile.new(container_name) tfile.close - Dir.chdir File.dirname(local_path) do - Archive::Tar::Minitar.pack File.basename(local_path), Zlib::GzipWriter.new(File.open(tfile.path, 'wb')) + Transport.chdir_mutex.synchronize do + Dir.chdir File.dirname(local_path) do + Archive::Tar::Minitar.pack File.basename(local_path), Zlib::GzipWriter.new(File.open(tfile.path, 'wb')) + end end # `tar -c#{flag}f #{tfile.path} -C #{File.dirname local_path} ./#{File.basename local_path}` fname = '/tmp/' + File.basename(tfile.path) + '.tgz' upload_file tfile.path, fname, options