vagrant-lxd 0.4.4 → 0.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81d3c5f71aaa0fb4f5fd3128722bf0d045619f7b56f2f6056f87ab396548d18f
4
- data.tar.gz: 966e0817b7bb8fd94b7a865e2799b468a92b4522de5218a088e7502f75d218be
3
+ metadata.gz: be2300b7aa0ba5ccc8ae1d3ed7af2bbc0da4a1ded7aefe64e9896d26a672d905
4
+ data.tar.gz: c7e73c349e90e91f180e76f1a550d35852b0aa720a406361ef9f94e692eaa68a
5
5
  SHA512:
6
- metadata.gz: f222d710cf807b6cbba3a5aae4dc0fb69df34c4a6d7112ef2df727f9218fd5296d8d3ed0a17fcecd8c68e3243bc982ea82a2fcdfedeb0932257bd7f08f940a9d
7
- data.tar.gz: 9a0c720fd7130f77bf60663b5e1d7c2f8bc4da4bf74683214e3b4ec1e632334f704085053ae3e564d0cc967a6861d2b7597443fed20be33d8fad38cf13e49445
6
+ metadata.gz: 9bff61ace1311df547b7b0aa6ccb3917ec950353ac7a164e78971cf2297881e007d559fb86798913d8ae1c91b0c4d9b7d5a2e565d5fd00689ff04f9a64b71dbb
7
+ data.tar.gz: cb70de69a9de248887c1b3b116fb807f324783ce1adde52f411dc83a1f7245a3da08b687c14385ee34183a144823eec469f7a0968baafdc6455af2e3ccfd154b
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /.bundle/
2
+ /.tool-versions
2
3
  /.vagrant/
3
- /pkg/
4
4
  /Vagrantfile
5
+ /pkg/
5
6
  /vendor/
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org/'
2
2
 
3
3
  group :development do
4
+ require 'pp' # avoid superclass mismatch error
4
5
  gem 'fakefs'
5
6
  gem 'rake'
6
7
  gem 'rspec'
@@ -1,33 +1,34 @@
1
1
  GIT
2
2
  remote: https://github.com/mitchellh/vagrant.git
3
- revision: 1dda6cc14c2d221a8e2e7b5091fed2fca9ba1ecf
3
+ revision: 7df0e62aded9316485e83fd5548bebbacf702ec7
4
4
  specs:
5
- vagrant (2.2.6.dev)
5
+ vagrant (2.2.10.dev)
6
6
  bcrypt_pbkdf (~> 1.0.0)
7
- childprocess (~> 0.6.0)
7
+ childprocess (~> 3.0.0)
8
8
  ed25519 (~> 1.2.4)
9
9
  erubis (~> 2.7.0)
10
10
  hashicorp-checkpoint (~> 0.1.5)
11
- i18n (~> 1.1.1)
11
+ i18n (~> 1.8)
12
12
  listen (~> 3.1.5)
13
13
  log4r (~> 1.1.9, < 1.1.11)
14
+ mime (~> 0.4.4)
14
15
  net-scp (~> 1.2.0)
15
16
  net-sftp (~> 2.1)
16
- net-ssh (~> 5.1.0)
17
+ net-ssh (~> 5.2.0)
17
18
  rb-kqueue (~> 0.2.0)
18
19
  rest-client (>= 1.6.0, < 3.0)
19
20
  ruby_dep (<= 1.3.1)
20
- rubyzip (~> 1.2.2)
21
- vagrant_cloud (~> 2.0.2)
21
+ rubyzip (~> 2.0)
22
+ vagrant_cloud (~> 2.0.3)
22
23
  wdm (~> 0.1.0)
23
- winrm (~> 2.1)
24
- winrm-elevated (~> 1.1)
25
- winrm-fs (~> 1.0)
24
+ winrm (>= 2.3.4, < 3.0)
25
+ winrm-elevated (>= 1.2.1, < 2.0)
26
+ winrm-fs (>= 1.3.4, < 2.0)
26
27
 
27
28
  PATH
28
29
  remote: .
29
30
  specs:
30
- vagrant-lxd (0.4.4)
31
+ vagrant-lxd (0.4.5)
31
32
  activesupport (~> 5.2.3)
32
33
  faraday (~> 0.17)
33
34
  hyperkit (~> 1.2.0)
@@ -35,7 +36,7 @@ PATH
35
36
  GEM
36
37
  remote: https://rubygems.org/
37
38
  specs:
38
- activesupport (5.2.4.1)
39
+ activesupport (5.2.4.3)
39
40
  concurrent-ruby (~> 1.0, >= 1.0.2)
40
41
  i18n (>= 0.7, < 2)
41
42
  minitest (~> 5.1)
@@ -43,19 +44,19 @@ GEM
43
44
  addressable (2.7.0)
44
45
  public_suffix (>= 2.0.2, < 5.0)
45
46
  bcrypt_pbkdf (1.0.1)
46
- builder (3.2.3)
47
- childprocess (0.6.3)
48
- ffi (~> 1.0, >= 1.0.11)
49
- concurrent-ruby (1.1.5)
50
- diff-lcs (1.3)
47
+ builder (3.2.4)
48
+ childprocess (3.0.0)
49
+ concurrent-ruby (1.1.6)
50
+ diff-lcs (1.4.4)
51
51
  domain_name (0.5.20190701)
52
52
  unf (>= 0.0.5, < 1.0.0)
53
53
  ed25519 (1.2.4)
54
+ erubi (1.9.0)
54
55
  erubis (2.7.0)
55
- fakefs (0.20.1)
56
+ fakefs (1.2.2)
56
57
  faraday (0.17.3)
57
58
  multipart-post (>= 1.2, < 3)
58
- ffi (1.11.1)
59
+ ffi (1.13.1)
59
60
  gssapi (1.3.0)
60
61
  ffi (>= 1.0.1)
61
62
  gyoku (1.3.1)
@@ -67,7 +68,7 @@ GEM
67
68
  hyperkit (1.2.0)
68
69
  activesupport (>= 4.2.6)
69
70
  sawyer
70
- i18n (1.1.1)
71
+ i18n (1.8.3)
71
72
  concurrent-ruby (~> 1.0)
72
73
  listen (3.1.5)
73
74
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -75,26 +76,27 @@ GEM
75
76
  ruby_dep (~> 1.2)
76
77
  little-plugger (1.1.4)
77
78
  log4r (1.1.10)
78
- logging (2.2.2)
79
+ logging (2.3.0)
79
80
  little-plugger (~> 1.1)
80
- multi_json (~> 1.10)
81
- mime-types (3.2.2)
81
+ multi_json (~> 1.14)
82
+ mime (0.4.4)
83
+ mime-types (3.3.1)
82
84
  mime-types-data (~> 3.2015)
83
- mime-types-data (3.2019.0331)
84
- minitest (5.13.0)
85
- multi_json (1.13.1)
85
+ mime-types-data (3.2020.0512)
86
+ minitest (5.14.1)
87
+ multi_json (1.14.1)
86
88
  multipart-post (2.1.1)
87
89
  net-scp (1.2.1)
88
90
  net-ssh (>= 2.6.5)
89
91
  net-sftp (2.1.2)
90
92
  net-ssh (>= 2.6.5)
91
- net-ssh (5.1.0)
93
+ net-ssh (5.2.0)
92
94
  netrc (0.11.0)
93
95
  nori (2.6.0)
94
- public_suffix (4.0.3)
95
- rake (12.3.3)
96
- rb-fsevent (0.10.3)
97
- rb-inotify (0.10.0)
96
+ public_suffix (4.0.5)
97
+ rake (13.0.1)
98
+ rb-fsevent (0.10.4)
99
+ rb-inotify (0.10.1)
98
100
  ffi (~> 1.0)
99
101
  rb-kqueue (0.2.5)
100
102
  ffi (>= 0.5.0)
@@ -102,53 +104,54 @@ GEM
102
104
  http-cookie (>= 1.0.2, < 2.0)
103
105
  mime-types (>= 1.16, < 4.0)
104
106
  netrc (~> 0.8)
105
- rspec (3.8.0)
106
- rspec-core (~> 3.8.0)
107
- rspec-expectations (~> 3.8.0)
108
- rspec-mocks (~> 3.8.0)
109
- rspec-core (3.8.2)
110
- rspec-support (~> 3.8.0)
111
- rspec-expectations (3.8.4)
107
+ rspec (3.9.0)
108
+ rspec-core (~> 3.9.0)
109
+ rspec-expectations (~> 3.9.0)
110
+ rspec-mocks (~> 3.9.0)
111
+ rspec-core (3.9.2)
112
+ rspec-support (~> 3.9.3)
113
+ rspec-expectations (3.9.2)
112
114
  diff-lcs (>= 1.2.0, < 2.0)
113
- rspec-support (~> 3.8.0)
115
+ rspec-support (~> 3.9.0)
114
116
  rspec-its (1.3.0)
115
117
  rspec-core (>= 3.0.0)
116
118
  rspec-expectations (>= 3.0.0)
117
- rspec-mocks (3.8.1)
119
+ rspec-mocks (3.9.1)
118
120
  diff-lcs (>= 1.2.0, < 2.0)
119
- rspec-support (~> 3.8.0)
120
- rspec-support (3.8.2)
121
+ rspec-support (~> 3.9.0)
122
+ rspec-support (3.9.3)
121
123
  ruby_dep (1.3.1)
122
124
  rubyntlm (0.6.2)
123
- rubyzip (1.2.3)
125
+ rubyzip (2.3.0)
124
126
  sawyer (0.8.2)
125
127
  addressable (>= 2.3.5)
126
128
  faraday (> 0.8, < 2.0)
127
129
  thread_safe (0.3.6)
128
- tzinfo (1.2.6)
130
+ tzinfo (1.2.7)
129
131
  thread_safe (~> 0.1)
130
132
  unf (0.1.4)
131
133
  unf_ext
132
- unf_ext (0.0.7.6)
133
- vagrant_cloud (2.0.2)
134
+ unf_ext (0.0.7.7)
135
+ vagrant_cloud (2.0.3)
134
136
  rest-client (~> 2.0.2)
135
137
  wdm (0.1.1)
136
- winrm (2.3.2)
138
+ winrm (2.3.4)
137
139
  builder (>= 2.1.2)
138
- erubis (~> 2.7)
140
+ erubi (~> 1.8)
139
141
  gssapi (~> 1.2)
140
142
  gyoku (~> 1.0)
141
143
  httpclient (~> 2.2, >= 2.2.0.2)
142
144
  logging (>= 1.6.1, < 3.0)
143
145
  nori (~> 2.0)
144
146
  rubyntlm (~> 0.6.0, >= 0.6.1)
145
- winrm-elevated (1.1.1)
147
+ winrm-elevated (1.2.1)
148
+ erubi (~> 1.8)
146
149
  winrm (~> 2.0)
147
150
  winrm-fs (~> 1.0)
148
- winrm-fs (1.3.2)
149
- erubis (~> 2.7)
151
+ winrm-fs (1.3.4)
152
+ erubi (~> 1.8)
150
153
  logging (>= 1.6.1, < 3.0)
151
- rubyzip (~> 1.1)
154
+ rubyzip (~> 2.0)
152
155
  winrm (~> 2.0)
153
156
 
154
157
  PLATFORMS
@@ -164,4 +167,4 @@ DEPENDENCIES
164
167
  vagrant-lxd!
165
168
 
166
169
  BUNDLED WITH
167
- 2.0.2
170
+ 2.1.4
data/README.md CHANGED
@@ -148,7 +148,7 @@ is passed through to LXD. The hash values should all be strings:
148
148
  recursive: 'false',
149
149
  }
150
150
 
151
- [disk]: https://lxd.readthedocs.io/en/latest/containers/#type-disk
151
+ [disk]: https://lxd.readthedocs.io/en/latest/instances/#type-disk
152
152
 
153
153
  ### Shared LXD Containers
154
154
 
@@ -234,7 +234,7 @@ to run graphical applications transparently from within the guest:
234
234
  Note that disk devices should be configured as [synced
235
235
  folders](#synced-folders) rather than ad-hoc devices.
236
236
 
237
- [device-config]: https://lxd.readthedocs.io/en/latest/containers/#device-configuration
237
+ [device-config]: https://lxd.readthedocs.io/en/latest/instances/#devices-configuration
238
238
 
239
239
  ## Hacking
240
240
 
@@ -29,14 +29,33 @@ module VagrantLXD
29
29
  def Capability.synced_folders(env)
30
30
  logger = Log4r::Logger.new('vagrant::lxd::capability')
31
31
  logger.debug "Checking synced folders support for effective UID/GID #{Process.uid}/#{Process.gid}..."
32
- result = %w(uid gid).all? do |type|
32
+ %w(uid gid).all? do |type|
33
33
  begin
34
- File.readlines("/etc/sub#{type}").grep(/^root:#{Process.send(type)}:[1-9]/).any?
34
+ id = Process.send(type)
35
+ id_map = File.readlines("/etc/sub#{type}")
36
+ id_in_sub_id?(id, id_map)
35
37
  rescue StandardError => e
36
38
  logger.warn "Cannot read subordinate permissions file: #{e.message}"
37
39
  false
38
40
  end
39
41
  end
40
42
  end
43
+
44
+ # Determines whether the given numerical `id` is included in the
45
+ # subordinate map `id_map`, which should be an array of lines from
46
+ # the file /etc/subuid or /etc/subgid.
47
+ #
48
+ # Invalid lines, and any lines for a user or group other than root,
49
+ # are ignored. See subuid(5) and subgid(5) for details about these
50
+ # files, and the expected format of their entries.
51
+ def Capability.id_in_sub_id?(id, id_map)
52
+ id_map.any? do |line|
53
+ if line.match(/^(root|0):(\d+):(\d+)/)
54
+ range_min = $2.to_i
55
+ range_max = range_min + $3.to_i
56
+ id.between?(range_min, range_max)
57
+ end
58
+ end
59
+ end
41
60
  end
42
61
  end
@@ -173,8 +173,8 @@ module VagrantLXD
173
173
  raw_idmap = container[:config][:'raw.idmap']
174
174
  begin
175
175
  raw_idmap and
176
- raw_idmap =~ /^uid #{Process.uid} #{vagrant_uid}$/ and
177
- raw_idmap =~ /^gid #{Process.gid} #{vagrant_gid}$/
176
+ id_in_map?(Process.uid, 'uid', raw_idmap) and
177
+ id_in_map?(Process.gid, 'gid', raw_idmap)
178
178
  end
179
179
  rescue Vagrant::Errors::ProviderNotUsable
180
180
  false
@@ -403,7 +403,7 @@ module VagrantLXD
403
403
  end
404
404
  end
405
405
 
406
- private
406
+ private
407
407
 
408
408
  #
409
409
  # The remaining methods are just conveniences, not part of the API
@@ -550,6 +550,24 @@ module VagrantLXD
550
550
  config
551
551
  end
552
552
 
553
+ # Determines whether the numerical `id` of the specified `type` is
554
+ # included in the given idmap. These values should follow the format
555
+ # of the "raw.idmap" property specified here:
556
+ #
557
+ # https://lxd.readthedocs.io/en/latest/userns-idmap/#custom-idmaps
558
+ #
559
+ def id_in_map?(id, type, map)
560
+ range_types = ['both', type]
561
+ map.each_line.any? do |line|
562
+ range_type, range_values = line.split
563
+ range = range_values.split('-')
564
+ begin
565
+ range_types.include?(range_type) and
566
+ id.between?(range.first.to_i, range.last.to_i)
567
+ end
568
+ end
569
+ end
570
+
553
571
  def locate_or_generate_client_certificate
554
572
  vagrant_path = @machine.env.data_dir / 'lxd'
555
573
  default_path = Certificate.default_path / 'lxc'
@@ -20,7 +20,7 @@
20
20
  module VagrantLXD
21
21
  module Version
22
22
  NAME = 'vagrant-lxd'
23
- VERSION = '0.4.4'
23
+ VERSION = '0.4.5'
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.4.4
4
+ version: 0.4.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: 2020-01-06 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -99,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.7.6
102
+ rubygems_version: 3.0.3
104
103
  signing_key:
105
104
  specification_version: 4
106
105
  summary: Vagrant LXD provider