lxd-common 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 032aa7f8a09b027c6254b6e42c5c36328a0325804780ed7a6db13ec4f905d197
4
- data.tar.gz: b52cf26ede270ceb806dfd552d97a6ef0b5693e10a98943d2d6f4e708ed0ca2f
3
+ metadata.gz: 64fff3620f0df985c5890a234085cb238ac72a4592bed8a0880f727d09154c19
4
+ data.tar.gz: cab1676fb2a6779f0333c4f92215d7dd967455073b48ca78dd449f6ec4606db3
5
5
  SHA512:
6
- metadata.gz: ae77de9d2025c2cdba5cd71740fec1766486520844b29f4dc11ebb786f69da90310033c2c722bdfb0db0234c19737b4c7c868cc3000b05a824caf12500ba9f15
7
- data.tar.gz: 99dbeed1e5731e1050197a244c16c91215ba41b11c78d555d2ed16cb368b1cde11ff4f63975b6aedb83e38bb345df66c41f0b88fdd3e58687e63effb69868097
6
+ metadata.gz: 6f38f384ae42e4355d0b04175e89c4d80d2a7267e3abf957eb394ecb73e63f810a6da0439fb6dce7bcb4730a29aa39c41514fbf62aba8f427ecdb3c74d16e1bc
7
+ data.tar.gz: 9637d609a8fcc1ec77880c0e32886c07d514d203c3ebcb4520cfa4ac571713574892ebbd214468b5166d765baa3fdd86b0dd663ff2c643c115ddb7c117e44b76
@@ -31,6 +31,10 @@ module NexusSW
31
31
  msg += "STDERR: #{stderr}" if stderr.is_a?(String) && !stderr.empty?
32
32
  raise ::NexusSW::LXD::RestAPI::Error, msg
33
33
  end
34
+
35
+ def error?
36
+ exitstatus != 0
37
+ end
34
38
  end
35
39
 
36
40
  # LocalTransport does not have the users mixin, so code the `su` command on the rest & cli transports directly
@@ -11,8 +11,8 @@ module NexusSW
11
11
  upload_using_tarball(local_path, path, options) || upload_files_individually(local_path, path, options)
12
12
  end
13
13
 
14
- def download_folder(path, local_path)
15
- download_using_tarball(path, local_path) || download_files_individually(path, local_path)
14
+ def download_folder(path, local_path, options = {})
15
+ download_using_tarball(path, local_path, options) || download_files_individually(path, local_path)
16
16
  end
17
17
 
18
18
  def upload_files_individually(local_path, path, options = {})
@@ -36,7 +36,12 @@ module NexusSW
36
36
  end
37
37
 
38
38
  # gzip(-z) or bzip2(-j) (these are the only 2 on trusty atm)
39
- def download_using_tarball(path, local_path)
39
+ def download_using_tarball(path, local_path, options = {})
40
+ if options[:auto_detect] && execute("test -d #{path}").error?
41
+ download_file(path, File.join(local_path, File.basename(path)))
42
+ return true
43
+ end
44
+
40
45
  return false unless can_archive?
41
46
  tfile = Transport.remote_tempname(container_name)
42
47
  tarball_name = File.join Transport.local_tempdir, File.basename(tfile) + '.tgz'
@@ -45,6 +50,7 @@ module NexusSW
45
50
  download_file tfile, tarball_name
46
51
 
47
52
  Archive::Tar::Minitar.unpack Zlib::GzipReader.new(File.open(tarball_name, 'rb')), local_path
53
+ return true
48
54
  ensure
49
55
  if tarball_name
50
56
  File.delete tarball_name if File.exist? tarball_name
@@ -24,7 +24,7 @@ module NexusSW
24
24
  raise "#{self.class}#download_file not implemented"
25
25
  end
26
26
 
27
- def download_folder(_path, _local_path)
27
+ def download_folder(_path, _local_path, _options = {})
28
28
  raise "#{self.class}#download_folder not implemented"
29
29
  end
30
30
 
@@ -1,5 +1,5 @@
1
1
  module NexusSW
2
2
  module LXD
3
- VERSION = '0.9.0'.freeze
3
+ VERSION = '0.9.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lxd-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Zachariasen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday