vagrant-lxd 0.5.2 → 0.5.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: c5d2a6ff5340ba242bdcc464893541745d00f1ad92dd947e87097c14335a4704
4
- data.tar.gz: b52fc2232901b1c49c95b71d28d60b514cafa19dc0ff3698b80710ca55e16aed
3
+ metadata.gz: 638a9115de670addce22a9c175abada7c8af4e12df41ac0b0390376d30bf10f7
4
+ data.tar.gz: e98147a0c8fff8307c8a12f07be02f9cc5982ea63572efdc444e28ba416fbef1
5
5
  SHA512:
6
- metadata.gz: 3a8269778bebfd757d6511668a6de1a30f19adaadffc124f0efc889bbea18eac796397857cdf67cbe72fe6cc733a6a94e4b6edbd568b5820861dba22b5466abd
7
- data.tar.gz: 137bf5106e33b466b58a85484079efe7214116f4698c11acbc1c5c08292197e51dafd0b51fb2d63431369a4d923394b4461241afa43dc5c767dccf05ab81ec3c
6
+ metadata.gz: 0d72dd7f7286cdf87c497a1ac126ccafc43af84d0504c7b52dc267d73575eac62ccde4b78837f707c84fd35ffc2ea1b8c7ea9231bf1382aba1827030e4810a4b
7
+ data.tar.gz: 6811ad8d4c3d7bcb6e6c517fd93e40619bca6990edb3364e3271da2a729b1a2d45c3aa1afc4e76312a1e4f269394092c84759d6186defa1ab3bb57547fcbfb32
data/.gitlab-ci.yml CHANGED
@@ -4,7 +4,8 @@ before_script:
4
4
  - apt-get -y update
5
5
  - apt-get -y upgrade
6
6
  - gem install bundler
7
- - bundle install -j $(nproc) --path vendor/bundle
7
+ - bundle config set --local path vendor/bundle
8
+ - bundle install --jobs $(nproc)
8
9
 
9
10
  spec:
10
11
  script:
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ group :development do
7
7
  gem 'rspec'
8
8
  gem 'rspec-its'
9
9
  gem 'rspec-mocks'
10
- gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
10
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v2.2.15'
11
11
  end
12
12
 
13
13
  group :plugins do
data/Gemfile.lock CHANGED
@@ -1,25 +1,24 @@
1
1
  GIT
2
2
  remote: https://github.com/mitchellh/vagrant.git
3
- revision: 2063111ab5cfcce0f6b2dbcecd9d24d47b512a96
3
+ revision: 9247e07fc8ffe2fdb91c6422bbb133a25983fe15
4
+ tag: v2.2.15
4
5
  specs:
5
- vagrant (2.2.10.dev)
6
- bcrypt_pbkdf (~> 1.0.0)
6
+ vagrant (2.2.15)
7
+ bcrypt_pbkdf (~> 1.1)
7
8
  childprocess (~> 4.0.0)
8
9
  ed25519 (~> 1.2.4)
9
- erubis (~> 2.7.0)
10
+ erubi
10
11
  hashicorp-checkpoint (~> 0.1.5)
11
12
  i18n (~> 1.8)
12
- listen (~> 3.1)
13
+ listen (~> 3.4)
13
14
  log4r (~> 1.1.9, < 1.1.11)
14
- mime (~> 0.4.4)
15
+ mime-types (~> 3.3)
15
16
  net-scp (~> 1.2.0)
16
17
  net-sftp (~> 3.0)
17
- net-ssh (~> 6.0)
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 (~> 2.0.3)
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.2)
30
+ vagrant-lxd (0.5.6)
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.4.4)
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.7.0)
43
+ addressable (2.8.0)
45
44
  public_suffix (>= 2.0.2, < 5.0)
46
- bcrypt_pbkdf (1.0.1)
45
+ bcrypt_pbkdf (1.1.0)
47
46
  builder (3.2.4)
48
47
  childprocess (4.0.0)
49
- concurrent-ruby (1.1.7)
48
+ concurrent-ruby (1.1.9)
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.9.0)
55
- erubis (2.7.0)
56
- fakefs (1.2.2)
57
- faraday (0.17.3)
51
+ erubi (1.10.0)
52
+ excon (0.87.0)
53
+ fakefs (1.4.0)
54
+ faraday (0.17.4)
58
55
  multipart-post (>= 1.2, < 3)
59
- ffi (1.13.1)
60
- gssapi (1.3.0)
56
+ ffi (1.15.4)
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.5)
66
+ i18n (1.8.10)
72
67
  concurrent-ruby (~> 1.0)
73
- listen (3.2.1)
68
+ listen (3.7.0)
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.2020.0512)
85
- minitest (5.14.2)
78
+ mime-types-data (3.2021.0901)
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,45 @@ 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
88
  public_suffix (4.0.6)
96
- rake (13.0.1)
97
- rb-fsevent (0.10.4)
89
+ rake (13.0.6)
90
+ rb-fsevent (0.11.0)
98
91
  rb-inotify (0.10.1)
99
92
  ffi (~> 1.0)
100
- rb-kqueue (0.2.5)
93
+ rb-kqueue (0.2.7)
101
94
  ffi (>= 0.5.0)
102
- rest-client (2.0.2)
103
- http-cookie (>= 1.0.2, < 2.0)
104
- mime-types (>= 1.16, < 4.0)
105
- netrc (~> 0.8)
106
- rspec (3.9.0)
107
- rspec-core (~> 3.9.0)
108
- rspec-expectations (~> 3.9.0)
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
+ rexml (3.2.5)
96
+ rspec (3.10.0)
97
+ rspec-core (~> 3.10.0)
98
+ rspec-expectations (~> 3.10.0)
99
+ rspec-mocks (~> 3.10.0)
100
+ rspec-core (3.10.1)
101
+ rspec-support (~> 3.10.0)
102
+ rspec-expectations (3.10.1)
113
103
  diff-lcs (>= 1.2.0, < 2.0)
114
- rspec-support (~> 3.9.0)
104
+ rspec-support (~> 3.10.0)
115
105
  rspec-its (1.3.0)
116
106
  rspec-core (>= 3.0.0)
117
107
  rspec-expectations (>= 3.0.0)
118
- rspec-mocks (3.9.1)
108
+ rspec-mocks (3.10.2)
119
109
  diff-lcs (>= 1.2.0, < 2.0)
120
- rspec-support (~> 3.9.0)
121
- rspec-support (3.9.3)
122
- ruby_dep (1.3.1)
123
- rubyntlm (0.6.2)
124
- rubyzip (2.3.0)
110
+ rspec-support (~> 3.10.0)
111
+ rspec-support (3.10.2)
112
+ rubyntlm (0.6.3)
113
+ rubyzip (2.3.2)
125
114
  sawyer (0.8.2)
126
115
  addressable (>= 2.3.5)
127
116
  faraday (> 0.8, < 2.0)
128
117
  thread_safe (0.3.6)
129
- tzinfo (1.2.7)
118
+ tzinfo (1.2.9)
130
119
  thread_safe (~> 0.1)
131
- unf (0.1.4)
132
- unf_ext
133
- unf_ext (0.0.7.7)
134
- vagrant_cloud (2.0.3)
135
- rest-client (~> 2.0.2)
120
+ vagrant_cloud (3.0.5)
121
+ excon (~> 0.73)
122
+ log4r (~> 1.1.10)
123
+ rexml (~> 3.2.5)
136
124
  wdm (0.1.1)
137
- winrm (2.3.4)
125
+ winrm (2.3.6)
138
126
  builder (>= 2.1.2)
139
127
  erubi (~> 1.8)
140
128
  gssapi (~> 1.2)
@@ -142,12 +130,12 @@ GEM
142
130
  httpclient (~> 2.2, >= 2.2.0.2)
143
131
  logging (>= 1.6.1, < 3.0)
144
132
  nori (~> 2.0)
145
- rubyntlm (~> 0.6.0, >= 0.6.1)
146
- winrm-elevated (1.2.1)
133
+ rubyntlm (~> 0.6.0, >= 0.6.3)
134
+ winrm-elevated (1.2.3)
147
135
  erubi (~> 1.8)
148
136
  winrm (~> 2.0)
149
137
  winrm-fs (~> 1.0)
150
- winrm-fs (1.3.4)
138
+ winrm-fs (1.3.5)
151
139
  erubi (~> 1.8)
152
140
  logging (>= 1.6.1, < 3.0)
153
141
  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
@@ -22,7 +22,7 @@ sudo apt install -y lxd
22
22
  sudo lxd init --auto --network-address=127.0.0.1 --network-port=8443
23
23
 
24
24
  # add your user to the lxd group
25
- sudo usermod -a lxd -G $(whoami)
25
+ sudo usermod -a -G lxd $(whoami)
26
26
 
27
27
  # apply the new group membership
28
28
  newgrp lxd
@@ -64,7 +64,7 @@ sudo lxd init --auto --network-address=127.0.0.1 --network-port=8443
64
64
  sudo dpkg-reconfigure -p medium lxd
65
65
 
66
66
  # add your user to the lxd group
67
- sudo usermod -a lxd -G $(whoami)
67
+ sudo usermod -a -G lxd $(whoami)
68
68
  ```
69
69
 
70
70
  Once LXD is configured, you should register a client certificate for
@@ -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
- FileUtils.rm_rf(env[:machine_package])
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
@@ -60,13 +60,13 @@ module VagrantLXD
60
60
  pkey = OpenSSL::PKey::RSA.new(PKEY_BITS)
61
61
  cert = OpenSSL::X509::Certificate.new
62
62
  cert.serial = 0
63
- cert.version = 3
63
+ cert.version = 2
64
64
  cert.issuer = name
65
65
  cert.subject = name
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::SHA1.new)
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)
@@ -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"
@@ -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
- env = @machine.action('state', lock: false)
34
- state = env[:machine_state]
34
+ state = @driver.tap { |d| d.validate! }.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
- env = @machine.action('info', lock: false)
42
- env[:machine_info]
41
+ @driver.info
43
42
  end
44
43
 
45
44
  def to_s
@@ -20,7 +20,7 @@
20
20
  module VagrantLXD
21
21
  module Version
22
22
  NAME = 'vagrant-lxd'
23
- VERSION = '0.5.2'
23
+ VERSION = '0.5.6'
24
24
  DESCRIPTION = 'Vagrant LXD provider'
25
25
  end
26
26
  end
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.2
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Hanson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-14 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport