vagrant-lxd 0.5.1 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +2 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +46 -60
- data/README.md +18 -0
- data/doc/setting-up-lxd.md +42 -2
- data/lib/vagrant-lxd/action.rb +22 -1
- data/lib/vagrant-lxd/driver/certificate.rb +1 -1
- data/lib/vagrant-lxd/driver.rb +3 -1
- data/lib/vagrant-lxd/provider.rb +3 -4
- data/lib/vagrant-lxd/synced_folder.rb +1 -0
- data/lib/vagrant-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: cd60f149780cbd686b6c80a7965f0944c8688e07dbd5b252412454dab747e312
|
4
|
+
data.tar.gz: 8a4b5af65190a50e31efeacb05a422a0300ed3a11b2503f1928a06ad8965162f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d455eb956c50cd82c2f72628c8b8407a381c9c2c17f1d70ceff5e6a3bab268f073345e7aaa60d886839ec5aa2f69b185e69afb7b0cec56724b1f41e7e5721487
|
7
|
+
data.tar.gz: eb66d5515c922eff8716e2fabdb6d92cc47ee7470151afc3b0a38cb25491c90a620ff2318c16616fa6c22908ffc6ff460aca22018bc50ea3ca5e01944af50164
|
data/.gitlab-ci.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/mitchellh/vagrant.git
|
3
|
-
revision:
|
3
|
+
revision: 9247e07fc8ffe2fdb91c6422bbb133a25983fe15
|
4
|
+
tag: v2.2.15
|
4
5
|
specs:
|
5
|
-
vagrant (2.2.
|
6
|
-
bcrypt_pbkdf (~> 1.
|
6
|
+
vagrant (2.2.15)
|
7
|
+
bcrypt_pbkdf (~> 1.1)
|
7
8
|
childprocess (~> 4.0.0)
|
8
9
|
ed25519 (~> 1.2.4)
|
9
|
-
|
10
|
+
erubi
|
10
11
|
hashicorp-checkpoint (~> 0.1.5)
|
11
12
|
i18n (~> 1.8)
|
12
|
-
listen (~> 3.
|
13
|
+
listen (~> 3.4)
|
13
14
|
log4r (~> 1.1.9, < 1.1.11)
|
14
|
-
mime (~>
|
15
|
+
mime-types (~> 3.3)
|
15
16
|
net-scp (~> 1.2.0)
|
16
17
|
net-sftp (~> 3.0)
|
17
|
-
net-ssh (
|
18
|
+
net-ssh (>= 6.1.0, < 7)
|
18
19
|
rb-kqueue (~> 0.2.0)
|
19
|
-
rest-client (>= 1.6.0, < 3.0)
|
20
|
-
ruby_dep (<= 1.3.1)
|
21
20
|
rubyzip (~> 2.0)
|
22
|
-
vagrant_cloud (~>
|
21
|
+
vagrant_cloud (~> 3.0.4)
|
23
22
|
wdm (~> 0.1.0)
|
24
23
|
winrm (>= 2.3.4, < 3.0)
|
25
24
|
winrm-elevated (>= 1.2.1, < 2.0)
|
@@ -28,7 +27,7 @@ GIT
|
|
28
27
|
PATH
|
29
28
|
remote: .
|
30
29
|
specs:
|
31
|
-
vagrant-lxd (0.5.
|
30
|
+
vagrant-lxd (0.5.5)
|
32
31
|
activesupport (~> 5.2.3)
|
33
32
|
faraday (~> 0.17)
|
34
33
|
hyperkit (~> 1.3.0)
|
@@ -36,41 +35,37 @@ PATH
|
|
36
35
|
GEM
|
37
36
|
remote: https://rubygems.org/
|
38
37
|
specs:
|
39
|
-
activesupport (5.2.
|
38
|
+
activesupport (5.2.6)
|
40
39
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
41
40
|
i18n (>= 0.7, < 2)
|
42
41
|
minitest (~> 5.1)
|
43
42
|
tzinfo (~> 1.1)
|
44
|
-
addressable (2.
|
43
|
+
addressable (2.8.0)
|
45
44
|
public_suffix (>= 2.0.2, < 5.0)
|
46
|
-
bcrypt_pbkdf (1.0
|
45
|
+
bcrypt_pbkdf (1.1.0)
|
47
46
|
builder (3.2.4)
|
48
47
|
childprocess (4.0.0)
|
49
|
-
concurrent-ruby (1.1.
|
48
|
+
concurrent-ruby (1.1.8)
|
50
49
|
diff-lcs (1.4.4)
|
51
|
-
domain_name (0.5.20190701)
|
52
|
-
unf (>= 0.0.5, < 1.0.0)
|
53
50
|
ed25519 (1.2.4)
|
54
|
-
erubi (1.
|
55
|
-
|
56
|
-
fakefs (1.
|
57
|
-
faraday (0.17.
|
51
|
+
erubi (1.10.0)
|
52
|
+
excon (0.79.0)
|
53
|
+
fakefs (1.3.2)
|
54
|
+
faraday (0.17.4)
|
58
55
|
multipart-post (>= 1.2, < 3)
|
59
|
-
ffi (1.
|
60
|
-
gssapi (1.3.
|
56
|
+
ffi (1.15.0)
|
57
|
+
gssapi (1.3.1)
|
61
58
|
ffi (>= 1.0.1)
|
62
59
|
gyoku (1.3.1)
|
63
60
|
builder (>= 2.1.2)
|
64
61
|
hashicorp-checkpoint (0.1.5)
|
65
|
-
http-cookie (1.0.3)
|
66
|
-
domain_name (~> 0.5)
|
67
62
|
httpclient (2.8.3)
|
68
63
|
hyperkit (1.3.0)
|
69
64
|
activesupport (>= 4.2.6)
|
70
65
|
sawyer
|
71
|
-
i18n (1.8.
|
66
|
+
i18n (1.8.10)
|
72
67
|
concurrent-ruby (~> 1.0)
|
73
|
-
listen (3.
|
68
|
+
listen (3.5.1)
|
74
69
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
75
70
|
rb-inotify (~> 0.9, >= 0.9.10)
|
76
71
|
little-plugger (1.1.4)
|
@@ -78,11 +73,10 @@ GEM
|
|
78
73
|
logging (2.3.0)
|
79
74
|
little-plugger (~> 1.1)
|
80
75
|
multi_json (~> 1.14)
|
81
|
-
mime (0.4.4)
|
82
76
|
mime-types (3.3.1)
|
83
77
|
mime-types-data (~> 3.2015)
|
84
|
-
mime-types-data (3.
|
85
|
-
minitest (5.14.
|
78
|
+
mime-types-data (3.2021.0225)
|
79
|
+
minitest (5.14.4)
|
86
80
|
multi_json (1.15.0)
|
87
81
|
multipart-post (2.1.1)
|
88
82
|
net-scp (1.2.1)
|
@@ -90,51 +84,43 @@ GEM
|
|
90
84
|
net-sftp (3.0.0)
|
91
85
|
net-ssh (>= 5.0.0, < 7.0.0)
|
92
86
|
net-ssh (6.1.0)
|
93
|
-
netrc (0.11.0)
|
94
87
|
nori (2.6.0)
|
95
|
-
public_suffix (4.0.
|
96
|
-
rake (13.0.
|
88
|
+
public_suffix (4.0.6)
|
89
|
+
rake (13.0.3)
|
97
90
|
rb-fsevent (0.10.4)
|
98
91
|
rb-inotify (0.10.1)
|
99
92
|
ffi (~> 1.0)
|
100
93
|
rb-kqueue (0.2.5)
|
101
94
|
ffi (>= 0.5.0)
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
rspec (3.
|
107
|
-
rspec-
|
108
|
-
|
109
|
-
rspec-mocks (~> 3.9.0)
|
110
|
-
rspec-core (3.9.2)
|
111
|
-
rspec-support (~> 3.9.3)
|
112
|
-
rspec-expectations (3.9.2)
|
95
|
+
rspec (3.10.0)
|
96
|
+
rspec-core (~> 3.10.0)
|
97
|
+
rspec-expectations (~> 3.10.0)
|
98
|
+
rspec-mocks (~> 3.10.0)
|
99
|
+
rspec-core (3.10.1)
|
100
|
+
rspec-support (~> 3.10.0)
|
101
|
+
rspec-expectations (3.10.1)
|
113
102
|
diff-lcs (>= 1.2.0, < 2.0)
|
114
|
-
rspec-support (~> 3.
|
103
|
+
rspec-support (~> 3.10.0)
|
115
104
|
rspec-its (1.3.0)
|
116
105
|
rspec-core (>= 3.0.0)
|
117
106
|
rspec-expectations (>= 3.0.0)
|
118
|
-
rspec-mocks (3.
|
107
|
+
rspec-mocks (3.10.2)
|
119
108
|
diff-lcs (>= 1.2.0, < 2.0)
|
120
|
-
rspec-support (~> 3.
|
121
|
-
rspec-support (3.
|
122
|
-
|
123
|
-
rubyntlm (0.6.2)
|
109
|
+
rspec-support (~> 3.10.0)
|
110
|
+
rspec-support (3.10.2)
|
111
|
+
rubyntlm (0.6.3)
|
124
112
|
rubyzip (2.3.0)
|
125
113
|
sawyer (0.8.2)
|
126
114
|
addressable (>= 2.3.5)
|
127
115
|
faraday (> 0.8, < 2.0)
|
128
116
|
thread_safe (0.3.6)
|
129
|
-
tzinfo (1.2.
|
117
|
+
tzinfo (1.2.9)
|
130
118
|
thread_safe (~> 0.1)
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
vagrant_cloud (2.0.3)
|
135
|
-
rest-client (~> 2.0.2)
|
119
|
+
vagrant_cloud (3.0.4)
|
120
|
+
excon (~> 0.73)
|
121
|
+
log4r (~> 1.1.10)
|
136
122
|
wdm (0.1.1)
|
137
|
-
winrm (2.3.
|
123
|
+
winrm (2.3.6)
|
138
124
|
builder (>= 2.1.2)
|
139
125
|
erubi (~> 1.8)
|
140
126
|
gssapi (~> 1.2)
|
@@ -142,12 +128,12 @@ GEM
|
|
142
128
|
httpclient (~> 2.2, >= 2.2.0.2)
|
143
129
|
logging (>= 1.6.1, < 3.0)
|
144
130
|
nori (~> 2.0)
|
145
|
-
rubyntlm (~> 0.6.0, >= 0.6.
|
146
|
-
winrm-elevated (1.2.
|
131
|
+
rubyntlm (~> 0.6.0, >= 0.6.3)
|
132
|
+
winrm-elevated (1.2.3)
|
147
133
|
erubi (~> 1.8)
|
148
134
|
winrm (~> 2.0)
|
149
135
|
winrm-fs (~> 1.0)
|
150
|
-
winrm-fs (1.3.
|
136
|
+
winrm-fs (1.3.5)
|
151
137
|
erubi (~> 1.8)
|
152
138
|
logging (>= 1.6.1, < 3.0)
|
153
139
|
rubyzip (~> 2.0)
|
data/README.md
CHANGED
@@ -236,6 +236,24 @@ folders](#synced-folders) rather than ad-hoc devices.
|
|
236
236
|
|
237
237
|
[device-config]: https://lxd.readthedocs.io/en/latest/instances/#devices-configuration
|
238
238
|
|
239
|
+
### Container Configuration
|
240
|
+
|
241
|
+
You can pass custom key/value configuration using the `config` setting. This
|
242
|
+
should be a map of [instance settings][instance-config], which will be wired
|
243
|
+
directly through to the container:
|
244
|
+
|
245
|
+
config.vm.provider 'lxd' do |lxd|
|
246
|
+
lxd.config = {
|
247
|
+
'linux.kernel_modules': 'ip_tables,ip6_tables,netlink_diag,nf_nat,overlay',
|
248
|
+
}
|
249
|
+
end
|
250
|
+
|
251
|
+
Not all instance settings make sense in the Vagrant context, and some will or
|
252
|
+
won't work based on your LXD host's configuration, so making sure the config is
|
253
|
+
valid is up to you.
|
254
|
+
|
255
|
+
[instance-config]: https://lxd.readthedocs.io/en/latest/instances/#keyvalue-configuration
|
256
|
+
|
239
257
|
## Hacking
|
240
258
|
|
241
259
|
To run Vagrant with the plugin automatically loaded, you can use the
|
data/doc/setting-up-lxd.md
CHANGED
@@ -9,7 +9,46 @@ Specifically, the following settings need to be applied:
|
|
9
9
|
3. Your user must be in the "lxd" group.
|
10
10
|
4. Your user must have a client certificate registered with LXD.
|
11
11
|
|
12
|
-
##
|
12
|
+
## Ubuntu Focal and Later
|
13
|
+
|
14
|
+
On Ubuntu 20.04 and later, LXD is installed as a [Snap][]. To install
|
15
|
+
and configure it as described above, you can use the following commands:
|
16
|
+
|
17
|
+
```sh
|
18
|
+
# install lxd
|
19
|
+
sudo apt install -y lxd
|
20
|
+
|
21
|
+
# enable https api access
|
22
|
+
sudo lxd init --auto --network-address=127.0.0.1 --network-port=8443
|
23
|
+
|
24
|
+
# add your user to the lxd group
|
25
|
+
sudo usermod -a -G lxd $(whoami)
|
26
|
+
|
27
|
+
# apply the new group membership
|
28
|
+
newgrp lxd
|
29
|
+
```
|
30
|
+
|
31
|
+
Then, the first time you run Vagrant in a project that uses the LXD
|
32
|
+
provider, it will generate a client certificate for the plugin to use
|
33
|
+
and instruct you to add it to LXD with the following message:
|
34
|
+
|
35
|
+
```
|
36
|
+
You may need configure LXD to allow requests from this machine. The
|
37
|
+
easiest way to do this is to add your LXC client certificate to LXD's
|
38
|
+
list of trusted certificates. This can typically be done with the
|
39
|
+
following command:
|
40
|
+
|
41
|
+
$ lxc config trust add ~/.vagrant.d/data/lxd/client.crt
|
42
|
+
|
43
|
+
You can find more information about configuring LXD at:
|
44
|
+
|
45
|
+
https://linuxcontainers.org/lxd/getting-started-cli/#initial-configuration
|
46
|
+
```
|
47
|
+
|
48
|
+
Once you run that command as instructed, everything should be set up for
|
49
|
+
the plugin to work correctly.
|
50
|
+
|
51
|
+
## Ubuntu Xenial
|
13
52
|
|
14
53
|
To install LXD and configure it as described above on Ubuntu 16.04, you
|
15
54
|
can use the following commands:
|
@@ -25,7 +64,7 @@ sudo lxd init --auto --network-address=127.0.0.1 --network-port=8443
|
|
25
64
|
sudo dpkg-reconfigure -p medium lxd
|
26
65
|
|
27
66
|
# add your user to the lxd group
|
28
|
-
sudo usermod -a
|
67
|
+
sudo usermod -a -G lxd $(whoami)
|
29
68
|
```
|
30
69
|
|
31
70
|
Once LXD is configured, you should register a client certificate for
|
@@ -53,5 +92,6 @@ If you're using the plugin on another platform, please feel free to
|
|
53
92
|
propose an addition to this document or add instructions to the
|
54
93
|
project's [wiki][] for others to follow.
|
55
94
|
|
95
|
+
[Snap]: https://snapcraft.io/
|
56
96
|
[getting-started-cli]: https://linuxcontainers.org/lxd/getting-started-cli/
|
57
97
|
[wiki]: https://gitlab.com/catalyst-it/vagrant-lxd/wikis
|
data/lib/vagrant-lxd/action.rb
CHANGED
@@ -95,6 +95,24 @@ module VagrantLXD
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
+
#
|
99
|
+
# Remove all files from the provider's data directory.
|
100
|
+
#
|
101
|
+
class RemoveData
|
102
|
+
include FileUtils
|
103
|
+
|
104
|
+
def initialize(app, env)
|
105
|
+
@app = app
|
106
|
+
end
|
107
|
+
|
108
|
+
def call(env)
|
109
|
+
@app.call(env)
|
110
|
+
ensure
|
111
|
+
rm_rf(env[:machine].data_dir)
|
112
|
+
mkdir_p(env[:machine].data_dir)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
98
116
|
#
|
99
117
|
# Issue a warning when the machine wants synced folders but the host
|
100
118
|
# doesn't support it (according to the relevant shadow files).
|
@@ -125,6 +143,8 @@ module VagrantLXD
|
|
125
143
|
end
|
126
144
|
|
127
145
|
class Package
|
146
|
+
include FileUtils
|
147
|
+
|
128
148
|
def initialize(app, env)
|
129
149
|
@app = app
|
130
150
|
@env = env
|
@@ -134,7 +154,7 @@ module VagrantLXD
|
|
134
154
|
env['package.directory'] = env[:machine_package]
|
135
155
|
@app.call(env)
|
136
156
|
ensure
|
137
|
-
|
157
|
+
rm_rf(env[:machine_package])
|
138
158
|
end
|
139
159
|
end
|
140
160
|
|
@@ -180,6 +200,7 @@ module VagrantLXD
|
|
180
200
|
d.use halt
|
181
201
|
d.use Message, :info, 'Destroying machine and associated data...'
|
182
202
|
d.use LXD.action(:destroy)
|
203
|
+
d.use RemoveData
|
183
204
|
else
|
184
205
|
d.use Message, :info, 'Machine will not be destroyed.'
|
185
206
|
end
|
@@ -66,7 +66,7 @@ module VagrantLXD
|
|
66
66
|
cert.public_key = pkey.public_key
|
67
67
|
cert.not_before = Time.now
|
68
68
|
cert.not_after = Time.now + (365 * 24 * 60 * 60 * CERT_EXPIRY_YEARS)
|
69
|
-
cert.sign(pkey, OpenSSL::Digest::
|
69
|
+
cert.sign(pkey, OpenSSL::Digest::SHA256.new)
|
70
70
|
@logger.debug "Saving new certificate to disk under #{path}..."
|
71
71
|
FileUtils.mkdir_p(path, mode: 0o700)
|
72
72
|
File.write(path / 'client.crt', cert.to_s, 0, perm: 0o600)
|
data/lib/vagrant-lxd/driver.rb
CHANGED
@@ -161,7 +161,7 @@ module VagrantLXD
|
|
161
161
|
|
162
162
|
def synced_folders_usable?
|
163
163
|
# Check whether we've registered an idmap for the current user.
|
164
|
-
raw_idmap =
|
164
|
+
raw_idmap = config[:'raw.idmap']
|
165
165
|
begin
|
166
166
|
raw_idmap and
|
167
167
|
id_in_map?(Process.uid, 'uid', raw_idmap) and
|
@@ -530,6 +530,8 @@ module VagrantLXD
|
|
530
530
|
# If the user has already specified a 'raw.idmap', leave it alone.
|
531
531
|
if config.include?(:'raw.idmap')
|
532
532
|
# Manually specified, carry on.
|
533
|
+
elsif @machine.config.vm.synced_folders.reject { |_, f| f[:disabled] }.empty?
|
534
|
+
# No synced folders configured, carry on.
|
533
535
|
elsif @machine.env.host.capability(:synced_folders)
|
534
536
|
config[:'raw.idmap'] = ''
|
535
537
|
config[:'raw.idmap'] << "uid #{Process.uid} #{vagrant_uid}\n"
|
data/lib/vagrant-lxd/provider.rb
CHANGED
@@ -23,6 +23,7 @@ module VagrantLXD
|
|
23
23
|
class Provider < Vagrant.plugin('2', :provider)
|
24
24
|
def initialize(machine)
|
25
25
|
@machine = machine
|
26
|
+
@driver = Driver.new(machine)
|
26
27
|
end
|
27
28
|
|
28
29
|
def action(name)
|
@@ -30,16 +31,14 @@ module VagrantLXD
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def state
|
33
|
-
|
34
|
-
state = env[:machine_state]
|
34
|
+
state = @driver.state
|
35
35
|
short = state.to_s.gsub('_', ' ')
|
36
36
|
long = I18n.t("vagrant.commands.status.#{state}")
|
37
37
|
Vagrant::MachineState.new(state, short, long)
|
38
38
|
end
|
39
39
|
|
40
40
|
def ssh_info
|
41
|
-
|
42
|
-
env[:machine_info]
|
41
|
+
@driver.info
|
43
42
|
end
|
44
43
|
|
45
44
|
def to_s
|
data/lib/vagrant-lxd/version.rb
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.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Hanson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|