lxd-common 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nexussw/lxd/driver/mixins/helpers/wait.rb +2 -0
- data/lib/nexussw/lxd/transport/mixins/cli.rb +2 -2
- data/lib/nexussw/lxd/transport/mixins/helpers/folder_txfr.rb +7 -7
- data/lib/nexussw/lxd/transport/mixins/helpers/users.rb +2 -0
- data/lib/nexussw/lxd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afe4071adead96b866c51c5bd13c52c9bad4723a81e7f3742485d5b827e63362
|
4
|
+
data.tar.gz: bb3c0d1b883bb758d0167cd035c0af204c388777798c6c8c08ccc41d7472f532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86522829ce42054bd4f9e49009e7adaf42e45b41e5796c2fdff81904a55220deea19da22ebb5de4e8775a1ee31e9ca37ff4bd12c8a7b5c99fbca4520fcdab131
|
7
|
+
data.tar.gz: 9f1795bac5731f609e9fa670885736f7f1dc8fa3a0824f47447c45e582bccbf7e6ce10b883ffb9c4f99dcfa50cdd3b70a45fe59d2820709bd595735f007da490
|
@@ -76,10 +76,10 @@ module NexusSW
|
|
76
76
|
inner_transport.execute("rm -rf #{tfile}", capture: false) if tfile
|
77
77
|
end
|
78
78
|
|
79
|
-
def upload_folder(local_path, path
|
79
|
+
def upload_folder(local_path, path)
|
80
80
|
return super unless config[:info] && config[:info]['api_extensions'] && config[:info]['api_extensions'].include?('directory_manipulation')
|
81
81
|
|
82
|
-
execute("-r #{local_path} #{container_name}#{path}", subcommand:
|
82
|
+
execute("-r #{local_path} #{container_name}#{path}", subcommand: 'file push', capture: false).error!
|
83
83
|
end
|
84
84
|
|
85
85
|
def download_folder(path, local_path, options = {})
|
@@ -7,20 +7,20 @@ module NexusSW
|
|
7
7
|
module Mixins
|
8
8
|
module Helpers
|
9
9
|
module FolderTxfr
|
10
|
-
def upload_folder(local_path, path
|
11
|
-
upload_using_tarball(local_path, path
|
10
|
+
def upload_folder(local_path, path)
|
11
|
+
upload_using_tarball(local_path, path) || upload_files_individually(local_path, path)
|
12
12
|
end
|
13
13
|
|
14
14
|
def download_folder(path, local_path, options = {})
|
15
15
|
download_using_tarball(path, local_path, options) || download_files_individually(path, local_path)
|
16
16
|
end
|
17
17
|
|
18
|
-
def upload_files_individually(local_path, path
|
18
|
+
def upload_files_individually(local_path, path)
|
19
19
|
dest = File.join(path, File.basename(local_path))
|
20
20
|
execute('mkdir -p ' + dest).error! # for parity with tarball extract
|
21
21
|
Dir.entries(local_path).map { |f| (f == '.' || f == '..') ? nil : File.join(local_path, f) }.compact.each do |f|
|
22
|
-
upload_files_individually f, dest
|
23
|
-
upload_file f, File.join(dest, File.basename(f))
|
22
|
+
upload_files_individually f, dest if File.directory? f
|
23
|
+
upload_file f, File.join(dest, File.basename(f)) if File.file? f
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -58,7 +58,7 @@ module NexusSW
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def upload_using_tarball(local_path, path
|
61
|
+
def upload_using_tarball(local_path, path)
|
62
62
|
return false unless can_archive?
|
63
63
|
begin
|
64
64
|
tfile = Tempfile.new(container_name)
|
@@ -70,7 +70,7 @@ module NexusSW
|
|
70
70
|
end
|
71
71
|
# `tar -c#{flag}f #{tfile.path} -C #{File.dirname local_path} ./#{File.basename local_path}`
|
72
72
|
fname = '/tmp/' + File.basename(tfile.path) + '.tgz'
|
73
|
-
upload_file tfile.path, fname
|
73
|
+
upload_file tfile.path, fname
|
74
74
|
|
75
75
|
execute("bash -c 'mkdir -p #{path} && cd #{path} && tar -xf #{fname} && rm -rf #{fname}'").error!
|
76
76
|
ensure
|
@@ -7,11 +7,13 @@ module NexusSW
|
|
7
7
|
module Helpers
|
8
8
|
module UsersMixin
|
9
9
|
def user(user_nameorid, options = {})
|
10
|
+
return unless user_nameorid
|
10
11
|
passwd = read_file options[:passwd_file] || '/etc/passwd'
|
11
12
|
|
12
13
|
# rework into .split(':') if this gets more complicated
|
13
14
|
@uid = user_nameorid.is_a?(String) ? passwd[/^#{user_nameorid}:[^:]*:([^:]*):/, 1] : user_nameorid
|
14
15
|
@username = user_nameorid.is_a?(String) ? user_nameorid : passwd[/^([^:]*):[^:]*:#{user_nameorid}:/, 1]
|
16
|
+
raise "User not found (#{user_nameorid}) while attempting to set transport identity" unless @uid && @username
|
15
17
|
|
16
18
|
# gotcha: we're always setting the default group here, but it's changeable by the user, afterwards
|
17
19
|
# so if `user` gets called again, and the caller wants an alternative gid, the caller will need to re-set the gid
|
data/lib/nexussw/lxd/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.6
|
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-02-
|
11
|
+
date: 2018-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|