vagrant-lxd 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 6f520f19dbe7785aae63572ae288e858e8cb1752
4
- data.tar.gz: 36579c91dc77ca0b0cd969af53e2fc7e25586add
3
+ metadata.gz: 654ad77a94d17f40d4f528b4e3b3c9240e6da694
4
+ data.tar.gz: f61890ef2aaa6f42d2df0c50c17d8d3e4aa6a976
5
5
  SHA512:
6
- metadata.gz: 0e4bd0c5fa78d6d87efd722b2486852290367d41f60c706b2cba4d242cff1d0432dc3fd7383d1da600dd2f923191fa8ec4cac14e3acc3eca4925643badbd9356
7
- data.tar.gz: c5a7e42a14dd8b1610d2c82c9227c2bc05cbbbc5f4489c6776d62f95d383824083cfea7ef928424d4d84b47ed42b9941fa670e1c8dfc832443de2d456f022e38
6
+ metadata.gz: 88d1f8cf94ebbdc2f06746ea8125339cad299de715b757fa8204ebebe1f72606d2e7ad9860f24a5e12f96a2a97a43696c77fa1594e0f05ec7804f746b0e784d7
7
+ data.tar.gz: 53ffb9cb0d78df23a42d2f5a10915f7a919609dc75ec39569b69b71f62f05e69739a5abca8049ee9ebe101f4612edc58e85a40494f57dfa0eb43fb1427f903bb
data/Gemfile.lock CHANGED
@@ -1,20 +1,24 @@
1
1
  GIT
2
2
  remote: https://github.com/mitchellh/vagrant.git
3
- revision: 04f7215b5e3f594368696262920deaf631315e37
3
+ revision: 45766ad00e5567fe6706a84fe07ba922b442dc34
4
4
  specs:
5
- vagrant (2.1.3.dev)
5
+ vagrant (2.2.2.dev)
6
+ bcrypt_pbkdf (~> 1.0.0)
6
7
  childprocess (~> 0.6.0)
8
+ ed25519 (~> 1.2.4)
7
9
  erubis (~> 2.7.0)
8
10
  hashicorp-checkpoint (~> 0.1.5)
9
- i18n (>= 0.6.0, <= 0.8.0)
11
+ i18n (~> 1.1.1)
10
12
  listen (~> 3.1.5)
11
13
  log4r (~> 1.1.9, < 1.1.11)
12
14
  net-scp (~> 1.2.0)
13
15
  net-sftp (~> 2.1)
14
- net-ssh (~> 4.2.0)
16
+ net-ssh (~> 5.0.0)
15
17
  rb-kqueue (~> 0.2.0)
16
18
  rest-client (>= 1.6.0, < 3.0)
17
19
  ruby_dep (<= 1.3.1)
20
+ rubyzip (~> 1.2.2)
21
+ vagrant_cloud (~> 2.0.0)
18
22
  wdm (~> 0.1.0)
19
23
  winrm (~> 2.1)
20
24
  winrm-elevated (~> 1.1)
@@ -23,28 +27,31 @@ GIT
23
27
  PATH
24
28
  remote: .
25
29
  specs:
26
- vagrant-lxd (0.3.0)
27
- hyperkit (~> 1.1.0)
30
+ vagrant-lxd (0.3.1)
31
+ hyperkit (~> 1.2.0)
28
32
 
29
33
  GEM
30
34
  remote: https://rubygems.org/
31
35
  specs:
32
- activesupport (4.2.10)
33
- i18n (~> 0.7)
36
+ activesupport (5.2.1)
37
+ concurrent-ruby (~> 1.0, >= 1.0.2)
38
+ i18n (>= 0.7, < 2)
34
39
  minitest (~> 5.1)
35
- thread_safe (~> 0.3, >= 0.3.4)
36
40
  tzinfo (~> 1.1)
37
41
  addressable (2.5.2)
38
42
  public_suffix (>= 2.0.2, < 4.0)
43
+ bcrypt_pbkdf (1.0.0)
39
44
  builder (3.2.3)
40
45
  childprocess (0.6.3)
41
46
  ffi (~> 1.0, >= 1.0.11)
47
+ concurrent-ruby (1.1.3)
42
48
  diff-lcs (1.3)
43
49
  domain_name (0.5.20180417)
44
50
  unf (>= 0.0.5, < 1.0.0)
51
+ ed25519 (1.2.4)
45
52
  erubis (2.7.0)
46
- fakefs (0.14.2)
47
- faraday (0.15.2)
53
+ fakefs (0.18.0)
54
+ faraday (0.15.3)
48
55
  multipart-post (>= 1.2, < 3)
49
56
  ffi (1.9.25)
50
57
  gssapi (1.2.0)
@@ -55,10 +62,11 @@ GEM
55
62
  http-cookie (1.0.3)
56
63
  domain_name (~> 0.5)
57
64
  httpclient (2.8.3)
58
- hyperkit (1.1.0)
59
- activesupport (~> 4.2.6)
65
+ hyperkit (1.2.0)
66
+ activesupport (>= 4.2.6)
60
67
  sawyer
61
- i18n (0.8.0)
68
+ i18n (1.1.1)
69
+ concurrent-ruby (~> 1.0)
62
70
  listen (3.1.5)
63
71
  rb-fsevent (~> 0.9, >= 0.9.4)
64
72
  rb-inotify (~> 0.9, >= 0.9.7)
@@ -68,9 +76,9 @@ GEM
68
76
  logging (2.2.2)
69
77
  little-plugger (~> 1.1)
70
78
  multi_json (~> 1.10)
71
- mime-types (3.1)
79
+ mime-types (3.2.2)
72
80
  mime-types-data (~> 3.2015)
73
- mime-types-data (3.2016.0521)
81
+ mime-types-data (3.2018.0812)
74
82
  minitest (5.11.3)
75
83
  multi_json (1.13.1)
76
84
  multipart-post (2.0.0)
@@ -78,10 +86,10 @@ GEM
78
86
  net-ssh (>= 2.6.5)
79
87
  net-sftp (2.1.2)
80
88
  net-ssh (>= 2.6.5)
81
- net-ssh (4.2.0)
89
+ net-ssh (5.0.2)
82
90
  netrc (0.11.0)
83
91
  nori (2.6.0)
84
- public_suffix (3.0.2)
92
+ public_suffix (3.0.3)
85
93
  rake (12.3.1)
86
94
  rb-fsevent (0.10.3)
87
95
  rb-inotify (0.9.10)
@@ -92,25 +100,25 @@ GEM
92
100
  http-cookie (>= 1.0.2, < 2.0)
93
101
  mime-types (>= 1.16, < 4.0)
94
102
  netrc (~> 0.8)
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)
103
+ rspec (3.8.0)
104
+ rspec-core (~> 3.8.0)
105
+ rspec-expectations (~> 3.8.0)
106
+ rspec-mocks (~> 3.8.0)
107
+ rspec-core (3.8.0)
108
+ rspec-support (~> 3.8.0)
109
+ rspec-expectations (3.8.2)
102
110
  diff-lcs (>= 1.2.0, < 2.0)
103
- rspec-support (~> 3.7.0)
111
+ rspec-support (~> 3.8.0)
104
112
  rspec-its (1.2.0)
105
113
  rspec-core (>= 3.0.0)
106
114
  rspec-expectations (>= 3.0.0)
107
- rspec-mocks (3.7.0)
115
+ rspec-mocks (3.8.0)
108
116
  diff-lcs (>= 1.2.0, < 2.0)
109
- rspec-support (~> 3.7.0)
110
- rspec-support (3.7.1)
117
+ rspec-support (~> 3.8.0)
118
+ rspec-support (3.8.0)
111
119
  ruby_dep (1.3.1)
112
120
  rubyntlm (0.6.2)
113
- rubyzip (1.2.1)
121
+ rubyzip (1.2.2)
114
122
  sawyer (0.8.1)
115
123
  addressable (>= 2.3.5, < 2.6)
116
124
  faraday (~> 0.8, < 1.0)
@@ -120,8 +128,10 @@ GEM
120
128
  unf (0.1.4)
121
129
  unf_ext
122
130
  unf_ext (0.0.7.5)
131
+ vagrant_cloud (2.0.1)
132
+ rest-client (~> 2.0.2)
123
133
  wdm (0.1.1)
124
- winrm (2.2.3)
134
+ winrm (2.3.0)
125
135
  builder (>= 2.1.2)
126
136
  erubis (~> 2.7)
127
137
  gssapi (~> 1.2)
@@ -133,7 +143,7 @@ GEM
133
143
  winrm-elevated (1.1.0)
134
144
  winrm (~> 2.0)
135
145
  winrm-fs (~> 1.0)
136
- winrm-fs (1.2.0)
146
+ winrm-fs (1.3.1)
137
147
  erubis (~> 2.7)
138
148
  logging (>= 1.6.1, < 3.0)
139
149
  rubyzip (~> 1.1)
@@ -152,4 +162,4 @@ DEPENDENCIES
152
162
  vagrant-lxd!
153
163
 
154
164
  BUNDLED WITH
155
- 1.16.1
165
+ 1.16.4
data/README.md CHANGED
@@ -99,9 +99,21 @@ host machine's subuid(5) and subgid(5) files:
99
99
  $ echo root:$(id -g):1 | sudo tee -a /etc/subgid
100
100
 
101
101
  For more information about these commands, and user/group ID mapping in
102
- general, we recommend [this article][1].
102
+ general, we recommend [this article][custom-user-mappings].
103
103
 
104
- [1]: https://insights.ubuntu.com/2017/06/15/custom-user-mappings-in-lxd-containers/
104
+ [custom-user-mappings]: https://insights.ubuntu.com/2017/06/15/custom-user-mappings-in-lxd-containers/
105
+
106
+ #### Changing the Guest User ID
107
+
108
+ When setting up shared folders, this plugin assumes that the UID and GID
109
+ of the vagrant user in the guest machine are both `1000`. If you're
110
+ using a non-standard box where these are different, you can override
111
+ the default with the `vagrant_uid` and `vagrant_gid` settings.
112
+
113
+ config.vm.provider 'lxd' do |lxd|
114
+ lxd.vagrant_uid = 500
115
+ lxd.vagrand_gid = 1000 # defaults to vagrant_uid
116
+ end
105
117
 
106
118
  ### Shared LXD Containers
107
119
 
@@ -134,10 +146,10 @@ following setting in your Vagrantfile:
134
146
  config.vm.insert_key = false
135
147
  ```
136
148
 
137
- Refer to Vagrant's [documentation][1] for more information about this
138
- setting.
149
+ Refer to Vagrant's [documentation][ssh_settings] for more information
150
+ about this setting.
139
151
 
140
- [1]: https://www.vagrantup.com/docs/vagrantfile/ssh_settings.html
152
+ [ssh_settings]: https://www.vagrantup.com/docs/vagrantfile/ssh_settings.html#config-ssh-insert_key
141
153
 
142
154
  ### Nested Containers
143
155
 
@@ -139,11 +139,11 @@ module VagrantLXD
139
139
  c.use HandleBox
140
140
  c.use CheckForSyncedFolderSupport
141
141
  c.use LXD.action(:create)
142
+ c.use Provision
142
143
  c.use LXD.action(:resume)
143
144
  c.use SetHostname
144
145
  c.use SyncedFolders
145
146
  c.use WaitForCommunicator
146
- c.use Provision
147
147
  when :running
148
148
  c.use Message, :info, 'Machine is already running.'
149
149
  when :frozen, :stopped
@@ -223,11 +223,11 @@ module VagrantLXD
223
223
  c.use Message, :info, 'Resuming machine...'
224
224
  c.use CheckForSyncedFolderSupport
225
225
  c.use LXD.action(:configure)
226
+ c.use Provision
226
227
  c.use LXD.action(:resume)
227
228
  c.use SetHostname
228
229
  c.use SyncedFolders
229
230
  c.use WaitForCommunicator
230
- c.use Provision
231
231
  else
232
232
  c.use Message, :error, "Machine cannot be resumed while #{env[:machine_state]}."
233
233
  end
@@ -30,8 +30,8 @@ module VagrantLXD
30
30
  attr_accessor :nesting
31
31
  attr_accessor :privileged
32
32
  attr_accessor :profiles
33
-
34
- VAGRANT_UID = 1000 # TODO Make this configurable.
33
+ attr_accessor :vagrant_uid
34
+ attr_accessor :vagrant_gid
35
35
 
36
36
  def initialize
37
37
  @name = UNSET_VALUE
@@ -43,6 +43,8 @@ module VagrantLXD
43
43
  @ephemeral = UNSET_VALUE
44
44
  @profiles = UNSET_VALUE
45
45
  @api_endpoint = UNSET_VALUE
46
+ @vagrant_uid = UNSET_VALUE
47
+ @vagrant_gid = UNSET_VALUE
46
48
  end
47
49
 
48
50
  def validate(machine)
@@ -100,6 +102,14 @@ module VagrantLXD
100
102
  errors << "Invalid `profiles' (value must be an array of strings): #{profiles.inspect}"
101
103
  end
102
104
 
105
+ unless vagrant_uid.is_a? Integer and vagrant_uid >= 0
106
+ errors << "Invalid `vagrant_uid' (value must be a non-negative integer): #{vagrant_uid.inspect}"
107
+ end
108
+
109
+ unless vagrant_gid.is_a? Integer and vagrant_gid >= 0
110
+ errors << "Invalid `vagrant_gid' (value must be a non-negative integer): #{vagrant_gid.inspect}"
111
+ end
112
+
103
113
  { Version::NAME => errors }
104
114
  end
105
115
 
@@ -141,6 +151,14 @@ module VagrantLXD
141
151
  else
142
152
  @api_endpoint = URI(api_endpoint)
143
153
  end
154
+
155
+ if vagrant_uid == UNSET_VALUE
156
+ @vagrant_uid = 1000
157
+ end
158
+
159
+ if vagrant_gid == UNSET_VALUE
160
+ @vagrant_gid = vagrant_uid
161
+ end
144
162
  end
145
163
  end
146
164
  end
@@ -31,6 +31,8 @@ module VagrantLXD
31
31
 
32
32
  USER_AGENT = "#{Version::DESCRIPTION} #{Version::VERSION} (#{Hyperkit::Default.user_agent})"
33
33
 
34
+ IMAGE_PROPERTIES = { description: "#{Version::DESCRIPTION} #{Version::VERSION}" }
35
+
34
36
  class OperationTimeout < Vagrant::Errors::VagrantError
35
37
  error_key 'lxd_operation_timeout'
36
38
  end
@@ -101,6 +103,8 @@ module VagrantLXD
101
103
  attr_reader :nesting
102
104
  attr_reader :privileged
103
105
  attr_reader :profiles
106
+ attr_reader :vagrant_uid
107
+ attr_reader :vagrant_gid
104
108
 
105
109
  def initialize(machine)
106
110
  @machine = machine
@@ -113,6 +117,8 @@ module VagrantLXD
113
117
  @ephemeral = machine.provider_config.ephemeral
114
118
  @profiles = machine.provider_config.profiles
115
119
  @name = machine.provider_config.name
120
+ @vagrant_uid = machine.provider_config.vagrant_uid
121
+ @vagrant_gid = machine.provider_config.vagrant_gid
116
122
  @logger = Log4r::Logger.new('vagrant::lxd::driver')
117
123
  @lxd = Hyperkit::Client.new(api_endpoint: api_endpoint.to_s, verify_ssl: false, user_agent: USER_AGENT)
118
124
  end
@@ -127,8 +133,8 @@ module VagrantLXD
127
133
  raw_idmap = container[:config][:'raw.idmap']
128
134
  begin
129
135
  raw_idmap and
130
- raw_idmap =~ /^uid #{Process.uid} #{Config::VAGRANT_UID}$/ and
131
- raw_idmap =~ /^gid #{Process.gid} #{Config::VAGRANT_UID}$/
136
+ raw_idmap =~ /^uid #{Process.uid} #{vagrant_uid}$/ and
137
+ raw_idmap =~ /^gid #{Process.gid} #{vagrant_gid}$/
132
138
  end
133
139
  rescue Vagrant::Errors::ProviderNotUsable
134
140
  false
@@ -225,9 +231,13 @@ module VagrantLXD
225
231
  @logger.debug 'Using image: ' << image.inspect
226
232
  rescue Hyperkit::NotFound
227
233
  image = @lxd.create_image_from_file(file)
228
- image_alias = @lxd.create_image_alias(fingerprint, machine_id)
229
234
  @logger.debug 'Created image: ' << image.inspect
230
- @logger.debug 'Created image alias: ' << image_alias.inspect
235
+ begin
236
+ @lxd.update_image(fingerprint, properties: IMAGE_PROPERTIES)
237
+ @lxd.create_image_alias(fingerprint, machine_id, IMAGE_PROPERTIES)
238
+ rescue Hyperkit::Error
239
+ @logger.error 'Failed to set description for image: ' << e.reason
240
+ end
231
241
  end
232
242
 
233
243
  container = @lxd.create_container(machine_id, ephemeral: ephemeral, fingerprint: fingerprint, config: config, profiles: profiles)
@@ -417,8 +427,8 @@ module VagrantLXD
417
427
  # Manually specified, carry on.
418
428
  elsif @machine.env.host.capability(:synced_folders)
419
429
  config[:'raw.idmap'] = ''
420
- config[:'raw.idmap'] << "uid #{Process.uid} #{Config::VAGRANT_UID}\n"
421
- config[:'raw.idmap'] << "gid #{Process.gid} #{Config::VAGRANT_UID}\n"
430
+ config[:'raw.idmap'] << "uid #{Process.uid} #{vagrant_uid}\n"
431
+ config[:'raw.idmap'] << "gid #{Process.gid} #{vagrant_gid}\n"
422
432
  end
423
433
 
424
434
  @logger.debug 'Resulting configuration: ' << config.inspect
@@ -20,7 +20,7 @@
20
20
  module VagrantLXD
21
21
  module Version
22
22
  NAME = 'vagrant-lxd'
23
- VERSION = '0.3.0'
23
+ VERSION = '0.3.1'
24
24
  DESCRIPTION = 'Vagrant LXD provider'
25
25
  end
26
26
  end
data/vagrant-lxd.gemspec CHANGED
@@ -35,5 +35,5 @@ Gem::Specification.new do |spec|
35
35
  f.match(%r{^(test|spec|features)/})
36
36
  end
37
37
 
38
- spec.add_runtime_dependency 'hyperkit', '~> 1.1.0'
38
+ spec.add_runtime_dependency 'hyperkit', '~> 1.2.0'
39
39
  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.3.0
4
+ version: 0.3.1
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-07-08 00:00:00.000000000 Z
11
+ date: 2018-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hyperkit
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 1.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.0
26
+ version: 1.2.0
27
27
  description: A Vagrant plugin that allows management of containers using LXD.
28
28
  email:
29
29
  - evanh@catalyst.net.nz