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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 207168d0b580adc1cbba2bfb17dc584e062fca8bf6d761d1cbf740280a3bcc32
4
- data.tar.gz: f42c295d6c2160db9f5a86bff3c124cca335036366d5c9e94e5a21e862beb323
3
+ metadata.gz: afe4071adead96b866c51c5bd13c52c9bad4723a81e7f3742485d5b827e63362
4
+ data.tar.gz: bb3c0d1b883bb758d0167cd035c0af204c388777798c6c8c08ccc41d7472f532
5
5
  SHA512:
6
- metadata.gz: 118d3c3463d6db8c3546957b2d7e023e1280533fea23a5f3892bba8d101c2ce7ffa9d18c920d95c3b2b9036e4e9e7b3efd06783d314f92d54c4a1329ae4c4403
7
- data.tar.gz: 66f906f901831fcf66cee1de6eb97c6035395dae65662cf54b4b282a3365bf0a43fd5671f0c1aaff234c4ecd135dafed3558062b5c958f5ee2dde0b21a8ccd04
6
+ metadata.gz: 86522829ce42054bd4f9e49009e7adaf42e45b41e5796c2fdff81904a55220deea19da22ebb5de4e8775a1ee31e9ca37ff4bd12c8a7b5c99fbca4520fcdab131
7
+ data.tar.gz: 9f1795bac5731f609e9fa670885736f7f1dc8fa3a0824f47447c45e582bccbf7e6ce10b883ffb9c4f99dcfa50cdd3b70a45fe59d2820709bd595735f007da490
@@ -21,6 +21,8 @@ module NexusSW
21
21
  loop do
22
22
  retval = nil
23
23
  case what
24
+ when :cloud_init
25
+ retval = !transport_for(container_name).execute('test -f /run/cloud-init/result.json').error?
24
26
  when :ip
25
27
  retval = check_for_ip(self, container_name)
26
28
  else
@@ -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, options = {})
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: "file push", capture: false).error!
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, options = {})
11
- upload_using_tarball(local_path, path, options) || upload_files_individually(local_path, path, options)
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, options = {})
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, options if File.directory? f
23
- upload_file f, File.join(dest, File.basename(f)), options if File.file? 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, options = {})
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, options
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
@@ -1,5 +1,5 @@
1
1
  module NexusSW
2
2
  module LXD
3
- VERSION = '0.9.5'.freeze
3
+ VERSION = '0.9.6'.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.5
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-09 00:00:00.000000000 Z
11
+ date: 2018-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday