vagrant-lxd 0.2.1 → 0.3.0

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: abc3e26c2ce8d3408a4e4469219404dc24a08d50
4
- data.tar.gz: 720aac0252d1af7b40a0d15893fa8aeebaa08bcf
3
+ metadata.gz: 6f520f19dbe7785aae63572ae288e858e8cb1752
4
+ data.tar.gz: 36579c91dc77ca0b0cd969af53e2fc7e25586add
5
5
  SHA512:
6
- metadata.gz: 754310e162e9d5716514c9fa0a938b055c53355553433379c7bc5e484933025a22bbc10c3e1a95e4b6f7c2cc524e3178ede1461a20aebe05f572589a23c3d3b7
7
- data.tar.gz: 0dd64052ec2514532ca7d73828048674f6753317d9da5f6be0b53fb89c93ba8b9abe634d176b85a36f5935210afc8d9d0611d542aa1b2d4f51a6eecee3cf4315
6
+ metadata.gz: 0e4bd0c5fa78d6d87efd722b2486852290367d41f60c706b2cba4d242cff1d0432dc3fd7383d1da600dd2f923191fa8ec4cac14e3acc3eca4925643badbd9356
7
+ data.tar.gz: c5a7e42a14dd8b1610d2c82c9227c2bc05cbbbc5f4489c6776d62f95d383824083cfea7ef928424d4d84b47ed42b9941fa670e1c8dfc832443de2d456f022e38
@@ -1,8 +1,8 @@
1
1
  GIT
2
2
  remote: https://github.com/mitchellh/vagrant.git
3
- revision: dbba41a7ec3d87830f9b1895266d6a807c1cd2e0
3
+ revision: 04f7215b5e3f594368696262920deaf631315e37
4
4
  specs:
5
- vagrant (2.1.2.dev)
5
+ vagrant (2.1.3.dev)
6
6
  childprocess (~> 0.6.0)
7
7
  erubis (~> 2.7.0)
8
8
  hashicorp-checkpoint (~> 0.1.5)
@@ -16,8 +16,6 @@ GIT
16
16
  rest-client (>= 1.6.0, < 3.0)
17
17
  ruby_dep (<= 1.3.1)
18
18
  wdm (~> 0.1.0)
19
- win32-file (~> 0.8.1)
20
- win32-file-security (~> 1.0.10)
21
19
  winrm (~> 2.1)
22
20
  winrm-elevated (~> 1.1)
23
21
  winrm-fs (~> 1.0)
@@ -25,7 +23,7 @@ GIT
25
23
  PATH
26
24
  remote: .
27
25
  specs:
28
- vagrant-lxd (0.2.1)
26
+ vagrant-lxd (0.3.0)
29
27
  hyperkit (~> 1.1.0)
30
28
 
31
29
  GEM
@@ -45,12 +43,10 @@ GEM
45
43
  domain_name (0.5.20180417)
46
44
  unf (>= 0.0.5, < 1.0.0)
47
45
  erubis (2.7.0)
48
- fakefs (0.14.1)
46
+ fakefs (0.14.2)
49
47
  faraday (0.15.2)
50
48
  multipart-post (>= 1.2, < 3)
51
- ffi (1.9.23)
52
- ffi-win32-extensions (1.0.3)
53
- ffi
49
+ ffi (1.9.25)
54
50
  gssapi (1.2.0)
55
51
  ffi (>= 1.0.1)
56
52
  gyoku (1.3.1)
@@ -125,16 +121,6 @@ GEM
125
121
  unf_ext
126
122
  unf_ext (0.0.7.5)
127
123
  wdm (0.1.1)
128
- win32-file (0.8.1)
129
- ffi
130
- ffi-win32-extensions
131
- win32-file-stat (>= 1.4.0)
132
- win32-file-security (1.0.10)
133
- ffi
134
- ffi-win32-extensions
135
- win32-file-stat (1.5.5)
136
- ffi
137
- ffi-win32-extensions
138
124
  winrm (2.2.3)
139
125
  builder (>= 2.1.2)
140
126
  erubis (~> 2.7)
data/README.md CHANGED
@@ -124,6 +124,21 @@ container called "my-container", use the `vagrant lxd attach` command:
124
124
  $ vagrant lxd attach default my-container
125
125
  ==> default: Attaching to container 'my-container'...
126
126
 
127
+ Please note that in order for this feature to work you must ensure that
128
+ Vagrant uses the same SSH key to connect to the machine in all cases.
129
+ The easiest way to do this is to disable Vagrant's default behaviour of
130
+ automatically generating a unique key for each machine by adding the
131
+ following setting in your Vagrantfile:
132
+
133
+ ``` ruby
134
+ config.vm.insert_key = false
135
+ ```
136
+
137
+ Refer to Vagrant's [documentation][1] for more information about this
138
+ setting.
139
+
140
+ [1]: https://www.vagrantup.com/docs/vagrantfile/ssh_settings.html
141
+
127
142
  ### Nested Containers
128
143
 
129
144
  In order to run Linux containers on an LXD-backed machine, it must be
@@ -222,6 +222,7 @@ module VagrantLXD
222
222
  when :frozen, :stopped
223
223
  c.use Message, :info, 'Resuming machine...'
224
224
  c.use CheckForSyncedFolderSupport
225
+ c.use LXD.action(:configure)
225
226
  c.use LXD.action(:resume)
226
227
  c.use SetHostname
227
228
  c.use SyncedFolders
@@ -111,8 +111,10 @@ module VagrantLXD
111
111
  end
112
112
 
113
113
  def detach(args)
114
+ options = Hash[force: false]
115
+
114
116
  opts = OptionParser.new do |o|
115
- o.banner = 'Usage: vagrant lxd detach [machine ...]'
117
+ o.banner = 'Usage: vagrant lxd detach [-f] [machine ...]'
116
118
  o.separator ''
117
119
  o.separator 'Disassociates a VM from its LXD container.'
118
120
  o.separator ''
@@ -120,6 +122,8 @@ module VagrantLXD
120
122
  o.separator 'underlying container. Once detached, the machine can be recreated'
121
123
  o.separator 'from scratch with `vagrant up` or associated to a different container'
122
124
  o.separator 'by using `vagrant lxd attach`.'
125
+ o.separator ''
126
+ o.on('-f', '--force', 'Force detachment')
123
127
  end
124
128
 
125
129
  if args.include?('-h') or args.include?('--help')
@@ -127,6 +131,9 @@ module VagrantLXD
127
131
  exit 0
128
132
  end
129
133
 
134
+ args.delete('-f')
135
+ args.delete('--force')
136
+
130
137
  with_target_machines(args) do |machine|
131
138
  if machine.id.nil? or machine.state.id == Vagrant::MachineState::NOT_CREATED_ID
132
139
  machine.ui.warn "Machine is not attached to a container, skipping..."
@@ -51,6 +51,10 @@ module VagrantLXD
51
51
  error_key 'lxd_container_creation_failure'
52
52
  end
53
53
 
54
+ class ContainerConfigurationFailure < Vagrant::Errors::VagrantError
55
+ error_key 'lxd_container_configuration_failure'
56
+ end
57
+
54
58
  class ImageCreationFailure < ContainerCreationFailure
55
59
  error_key 'lxd_image_creation_failure'
56
60
  end
@@ -238,7 +242,7 @@ module VagrantLXD
238
242
  @machine.ui.error e.reason
239
243
  fail ContainerAlreadyExists, machine_name: @machine.name, container: $1
240
244
  else
241
- @machine.ui.error "Failed to create container"
245
+ @machine.ui.error 'Failed to create container'
242
246
  fail ContainerCreationFailure, machine_name: @machine.name, reason: e.reason
243
247
  end
244
248
  end
@@ -286,6 +290,15 @@ module VagrantLXD
286
290
  end
287
291
  end
288
292
 
293
+ def configure
294
+ container = @lxd.container(machine_id)
295
+ container[:config] = container[:config].to_hash.merge(config)
296
+ @lxd.update_container(machine_id, container)
297
+ rescue Hyperkit::Error => e
298
+ @machine.ui.error 'Failed to configure container'
299
+ fail ContainerConfigurationFailure, machine_name: @machine.name, reason: e.reason
300
+ end
301
+
289
302
  def info
290
303
  if in_state? :running, :frozen
291
304
  {
@@ -20,7 +20,7 @@
20
20
  module VagrantLXD
21
21
  module Version
22
22
  NAME = 'vagrant-lxd'
23
- VERSION = '0.2.1'
23
+ VERSION = '0.3.0'
24
24
  DESCRIPTION = 'Vagrant LXD provider'
25
25
  end
26
26
  end
@@ -96,6 +96,13 @@ en:
96
96
 
97
97
  The LXD logs may contain more information about the cause of this failure.
98
98
 
99
+ lxd_container_configuration_failure: |-
100
+ The provider was unable to configure the container for the '%{machine_name}' VM.
101
+
102
+ %{reason}.
103
+
104
+ The LXD logs may contain more information about the cause of this failure.
105
+
99
106
  lxd_image_creation_failure: |-
100
107
  The provider was unable to create an LXD image for the '%{machine_name}' VM.
101
108
 
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.2.1
4
+ version: 0.3.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-05-25 00:00:00.000000000 Z
11
+ date: 2018-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hyperkit