vagrant-lxd 0.1.4 → 0.2.0
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 +4 -4
- data/Gemfile.lock +23 -22
- data/README.md +2 -0
- data/lib/vagrant-lxd.rb +1 -1
- data/lib/vagrant-lxd/action.rb +1 -1
- data/lib/vagrant-lxd/capability.rb +1 -1
- data/lib/vagrant-lxd/command.rb +1 -1
- data/lib/vagrant-lxd/config.rb +29 -3
- data/lib/vagrant-lxd/driver.rb +33 -13
- data/lib/vagrant-lxd/plugin.rb +1 -1
- data/lib/vagrant-lxd/provider.rb +1 -1
- data/lib/vagrant-lxd/synced_folder.rb +1 -1
- data/lib/vagrant-lxd/version.rb +2 -2
- data/vagrant-lxd.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceae5ec31aecf1934e40466195849ad4f2152b7a
|
4
|
+
data.tar.gz: 6d8ba4edabdfa6bc4007c81eb6c41a12836c2b83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bfef2ee6532fd17a6ef5a0816fb5452e128866ac66b5aeced12f4e8781d4ea1f3fae859b49fdae5552362089d645c569d7b3426a68f83f0a5536a6e4d2d583c
|
7
|
+
data.tar.gz: fc765c52de52976c39215bf5fd712c258a62ba07741735b95b7eb43497809337bcf14ba80b273abc4d02bf97b8a4c76f4389406987411bf145cd320a564ff280
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/mitchellh/vagrant.git
|
3
|
-
revision:
|
3
|
+
revision: f31a340499a13868e60b2e4649c13a167a0bf387
|
4
4
|
specs:
|
5
|
-
vagrant (2.0.
|
5
|
+
vagrant (2.0.4.dev)
|
6
6
|
childprocess (~> 0.6.0)
|
7
7
|
erubis (~> 2.7.0)
|
8
8
|
hashicorp-checkpoint (~> 0.1.5)
|
@@ -23,29 +23,30 @@ GIT
|
|
23
23
|
PATH
|
24
24
|
remote: .
|
25
25
|
specs:
|
26
|
-
vagrant-lxd (0.
|
26
|
+
vagrant-lxd (0.2.0)
|
27
27
|
hyperkit (~> 1.1)
|
28
28
|
|
29
29
|
GEM
|
30
30
|
remote: https://rubygems.org/
|
31
31
|
specs:
|
32
|
-
activesupport (
|
33
|
-
|
32
|
+
activesupport (5.2.0)
|
33
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
|
+
i18n (>= 0.7, < 2)
|
34
35
|
minitest (~> 5.1)
|
35
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
36
36
|
tzinfo (~> 1.1)
|
37
37
|
addressable (2.5.2)
|
38
38
|
public_suffix (>= 2.0.2, < 4.0)
|
39
39
|
builder (3.2.3)
|
40
40
|
childprocess (0.6.3)
|
41
41
|
ffi (~> 1.0, >= 1.0.11)
|
42
|
+
concurrent-ruby (1.0.5)
|
42
43
|
diff-lcs (1.3)
|
43
44
|
domain_name (0.5.20170404)
|
44
45
|
unf (>= 0.0.5, < 1.0.0)
|
45
46
|
erubis (2.7.0)
|
46
47
|
faraday (0.14.0)
|
47
48
|
multipart-post (>= 1.2, < 3)
|
48
|
-
ffi (1.9.
|
49
|
+
ffi (1.9.23)
|
49
50
|
gssapi (1.2.0)
|
50
51
|
ffi (>= 1.0.1)
|
51
52
|
gyoku (1.3.1)
|
@@ -54,8 +55,8 @@ GEM
|
|
54
55
|
http-cookie (1.0.3)
|
55
56
|
domain_name (~> 0.5)
|
56
57
|
httpclient (2.8.3)
|
57
|
-
hyperkit (1.
|
58
|
-
activesupport (
|
58
|
+
hyperkit (1.2.0)
|
59
|
+
activesupport (>= 4.2.6)
|
59
60
|
sawyer
|
60
61
|
i18n (0.8.0)
|
61
62
|
listen (3.1.5)
|
@@ -81,8 +82,8 @@ GEM
|
|
81
82
|
netrc (0.11.0)
|
82
83
|
nori (2.6.0)
|
83
84
|
public_suffix (3.0.2)
|
84
|
-
rake (12.
|
85
|
-
rb-fsevent (0.10.
|
85
|
+
rake (12.3.1)
|
86
|
+
rb-fsevent (0.10.3)
|
86
87
|
rb-inotify (0.9.10)
|
87
88
|
ffi (>= 0.5.0, < 2)
|
88
89
|
rb-kqueue (0.2.5)
|
@@ -91,22 +92,22 @@ GEM
|
|
91
92
|
http-cookie (>= 1.0.2, < 2.0)
|
92
93
|
mime-types (>= 1.16, < 4.0)
|
93
94
|
netrc (~> 0.8)
|
94
|
-
rspec (3.
|
95
|
-
rspec-core (~> 3.
|
96
|
-
rspec-expectations (~> 3.
|
97
|
-
rspec-mocks (~> 3.
|
98
|
-
rspec-core (3.
|
99
|
-
rspec-support (~> 3.
|
100
|
-
rspec-expectations (3.
|
95
|
+
rspec (3.7.0)
|
96
|
+
rspec-core (~> 3.7.0)
|
97
|
+
rspec-expectations (~> 3.7.0)
|
98
|
+
rspec-mocks (~> 3.7.0)
|
99
|
+
rspec-core (3.7.1)
|
100
|
+
rspec-support (~> 3.7.0)
|
101
|
+
rspec-expectations (3.7.0)
|
101
102
|
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
-
rspec-support (~> 3.
|
103
|
+
rspec-support (~> 3.7.0)
|
103
104
|
rspec-its (1.2.0)
|
104
105
|
rspec-core (>= 3.0.0)
|
105
106
|
rspec-expectations (>= 3.0.0)
|
106
|
-
rspec-mocks (3.
|
107
|
+
rspec-mocks (3.7.0)
|
107
108
|
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
-
rspec-support (~> 3.
|
109
|
-
rspec-support (3.
|
109
|
+
rspec-support (~> 3.7.0)
|
110
|
+
rspec-support (3.7.1)
|
110
111
|
ruby_dep (1.3.1)
|
111
112
|
rubyntlm (0.6.2)
|
112
113
|
rubyzip (1.2.1)
|
data/README.md
CHANGED
data/lib/vagrant-lxd.rb
CHANGED
data/lib/vagrant-lxd/action.rb
CHANGED
data/lib/vagrant-lxd/command.rb
CHANGED
data/lib/vagrant-lxd/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2017 Catalyst.net Ltd
|
2
|
+
# Copyright (c) 2017-2018 Catalyst.net Ltd
|
3
3
|
#
|
4
4
|
# This file is part of vagrant-lxd.
|
5
5
|
#
|
@@ -23,15 +23,19 @@ module VagrantLXD
|
|
23
23
|
class Config < Vagrant.plugin('2', :config)
|
24
24
|
attr_accessor :api_endpoint
|
25
25
|
attr_accessor :name
|
26
|
+
attr_accessor :timeout
|
27
|
+
attr_accessor :config
|
28
|
+
attr_accessor :environment
|
29
|
+
attr_accessor :ephemeral
|
26
30
|
attr_accessor :nesting
|
27
31
|
attr_accessor :privileged
|
28
|
-
attr_accessor :ephemeral
|
29
32
|
attr_accessor :profiles
|
30
|
-
attr_accessor :timeout
|
31
33
|
|
32
34
|
def initialize
|
33
35
|
@name = UNSET_VALUE
|
34
36
|
@timeout = UNSET_VALUE
|
37
|
+
@config = UNSET_VALUE
|
38
|
+
@environment = UNSET_VALUE
|
35
39
|
@nesting = UNSET_VALUE
|
36
40
|
@privileged = UNSET_VALUE
|
37
41
|
@ephemeral = UNSET_VALUE
|
@@ -58,6 +62,20 @@ module VagrantLXD
|
|
58
62
|
errors << "Invalid `timeout' (value must be positive): #{timeout.inspect}"
|
59
63
|
end
|
60
64
|
|
65
|
+
if not config.is_a? Hash
|
66
|
+
errors << "Invalid `config' (value must be a hash): #{config.inspect}"
|
67
|
+
elsif not config.keys.all? { |x| x.is_a? Symbol }
|
68
|
+
errors << "Invalid `config' (hash keys must be symbols): #{config.inspect}"
|
69
|
+
end
|
70
|
+
|
71
|
+
if not environment.is_a? Hash
|
72
|
+
errors << "Invalid `environment' (value must be a hash): #{environment.inspect}"
|
73
|
+
elsif not environment.keys.all? { |x| x.is_a? String or x.is_a? Symbol }
|
74
|
+
errors << "Invalid `environment' (hash keys must be strings or symbols): #{environment.inspect}"
|
75
|
+
elsif not environment.values.all? { |x| x.is_a? String }
|
76
|
+
errors << "Invalid `environment' (hash values must be strings): #{environment.inspect}"
|
77
|
+
end
|
78
|
+
|
61
79
|
begin
|
62
80
|
URI(api_endpoint).scheme == 'https' or raise URI::InvalidURIError
|
63
81
|
rescue URI::InvalidURIError
|
@@ -88,6 +106,14 @@ module VagrantLXD
|
|
88
106
|
@name = nil
|
89
107
|
end
|
90
108
|
|
109
|
+
if config == UNSET_VALUE
|
110
|
+
@config = {}
|
111
|
+
end
|
112
|
+
|
113
|
+
if environment == UNSET_VALUE
|
114
|
+
@environment = {}
|
115
|
+
end
|
116
|
+
|
91
117
|
if nesting == UNSET_VALUE
|
92
118
|
@nesting = nil
|
93
119
|
end
|
data/lib/vagrant-lxd/driver.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2017 Catalyst.net Ltd
|
2
|
+
# Copyright (c) 2017-2018 Catalyst.net Ltd
|
3
3
|
#
|
4
4
|
# This file is part of vagrant-lxd.
|
5
5
|
#
|
@@ -17,6 +17,7 @@
|
|
17
17
|
# along with vagrant-lxd. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
|
+
require 'active_support/core_ext/object/deep_dup'
|
20
21
|
require 'hyperkit'
|
21
22
|
require 'securerandom'
|
22
23
|
require 'tempfile'
|
@@ -88,17 +89,20 @@ module VagrantLXD
|
|
88
89
|
NOT_CREATED = Vagrant::MachineState::NOT_CREATED_ID
|
89
90
|
|
90
91
|
attr_reader :api_endpoint
|
91
|
-
attr_reader :nesting
|
92
|
-
attr_reader :privileged
|
93
|
-
attr_reader :ephemeral
|
94
92
|
attr_reader :name
|
95
93
|
attr_reader :timeout
|
94
|
+
attr_reader :environment
|
95
|
+
attr_reader :ephemeral
|
96
|
+
attr_reader :nesting
|
97
|
+
attr_reader :privileged
|
96
98
|
attr_reader :profiles
|
97
99
|
|
98
100
|
def initialize(machine)
|
99
101
|
@machine = machine
|
100
102
|
@timeout = machine.provider_config.timeout
|
101
103
|
@api_endpoint = machine.provider_config.api_endpoint
|
104
|
+
@config = @machine.provider_config.config
|
105
|
+
@environment = machine.provider_config.environment
|
102
106
|
@nesting = machine.provider_config.nesting
|
103
107
|
@privileged = machine.provider_config.privileged
|
104
108
|
@ephemeral = machine.provider_config.ephemeral
|
@@ -289,6 +293,11 @@ module VagrantLXD
|
|
289
293
|
|
290
294
|
private
|
291
295
|
|
296
|
+
#
|
297
|
+
# The remaining methods are just conveniences, not part of the API
|
298
|
+
# used by the rest of the plugin.
|
299
|
+
#
|
300
|
+
|
292
301
|
def machine_id
|
293
302
|
@machine.id
|
294
303
|
end
|
@@ -371,25 +380,35 @@ module VagrantLXD
|
|
371
380
|
end
|
372
381
|
|
373
382
|
def config
|
374
|
-
|
383
|
+
# NOTE We reuse ActiveSupport for `#deep_dup` here, but if the Hyperkit
|
384
|
+
# dependency ever goes away, drop ActiveSupport and use some other
|
385
|
+
# method to get a deep copy of the config.
|
386
|
+
config = @config.deep_dup
|
375
387
|
|
376
388
|
# Add security settings, if specified. If not, we omit them so
|
377
389
|
# they can be configured by one of the container's profiles instead.
|
378
390
|
config[:'security.nesting'] = nesting unless nesting.nil?
|
379
391
|
config[:'security.privileged'] = privileged unless privileged.nil?
|
380
392
|
|
393
|
+
# Include user-specified environment variables.
|
394
|
+
config.merge! Hash[environment.map { |k, v| [:"environment.#{k}", v] }]
|
395
|
+
|
381
396
|
# Set "raw.idmap" if the host's sub{u,g}id configuration allows it.
|
382
397
|
# This allows sharing folders via LXD (see synced_folder.rb).
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
398
|
+
# If the user has already specified a 'raw.idmap', leave it alone.
|
399
|
+
unless config.include?(:'raw.idmap')
|
400
|
+
begin
|
401
|
+
# Check for root mappings in /etc/sub{uid,gid}.
|
402
|
+
%w(uid gid).each do |type|
|
403
|
+
id = Process.send(type)
|
404
|
+
if File.readlines("/etc/sub#{type}").grep(/^root:#{id}:[1-9]/).any?
|
405
|
+
config[:'raw.idmap'] ||= ''
|
406
|
+
config[:'raw.idmap'] << "#{type} #{id} #{VAGRANT_UID}\n"
|
407
|
+
end
|
389
408
|
end
|
409
|
+
rescue StandardError => e
|
410
|
+
@logger.warn "Cannot read subordinate permissions file: #{e.message}"
|
390
411
|
end
|
391
|
-
rescue StandardError => e
|
392
|
-
@logger.warn "Cannot read subordinate permissions file: #{e.message}"
|
393
412
|
end
|
394
413
|
|
395
414
|
@logger.debug 'Resulting configuration: ' << config.inspect
|
@@ -397,6 +416,7 @@ module VagrantLXD
|
|
397
416
|
config
|
398
417
|
end
|
399
418
|
|
419
|
+
# TODO Image handling should be moved into its own class.
|
400
420
|
def prepare_image_file
|
401
421
|
tmpdir = Dir.mktmpdir
|
402
422
|
|
data/lib/vagrant-lxd/plugin.rb
CHANGED
data/lib/vagrant-lxd/provider.rb
CHANGED
data/lib/vagrant-lxd/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2017 Catalyst.net Ltd
|
2
|
+
# Copyright (c) 2017-2018 Catalyst.net Ltd
|
3
3
|
#
|
4
4
|
# This file is part of vagrant-lxd.
|
5
5
|
#
|
@@ -20,7 +20,7 @@
|
|
20
20
|
module VagrantLXD
|
21
21
|
module Version
|
22
22
|
NAME = 'vagrant-lxd'
|
23
|
-
VERSION = '0.
|
23
|
+
VERSION = '0.2.0'
|
24
24
|
DESCRIPTION = 'Vagrant LXD provider'
|
25
25
|
end
|
26
26
|
end
|
data/vagrant-lxd.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-lxd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Hanson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hyperkit
|