vagrant-newdisk 0.0.2 → 0.0.3

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: fbc682c842f72a814d445e2a1c28471568de57df
4
- data.tar.gz: eae0460ddc98349171be573b54a0fb0f729060b2
3
+ metadata.gz: 24db431da64a7b49c2c21da44bb3916496e3385e
4
+ data.tar.gz: 473fa5eccd34118fb13127d7de09fc7d6b9ae335
5
5
  SHA512:
6
- metadata.gz: 488e58928d2ba91758f3dfa425362c946cdfdc57472a0907be23bf519c5625c3812ea47f3bbcf8ad730ba880d4146b8b4e8460a6b5e4b2248327bdc2370355b1
7
- data.tar.gz: 3a28617cf0af81ae8bfead6a2d83ffd287426f895402313f8c4313f9315a6cba69251a2e6b22d8ba22aab9323e2cca384997d96e528a6a9a74e1cc75bd7edfcb
6
+ metadata.gz: 285c8e252c4a01dfe25d739f4c51d7d21763d4aeaedb8e06f8d7c421a33b570a95c8fcc39d807f823c374f9e1a1d9104ada53a4acb2440d0ab4b05b6ad623b92
7
+ data.tar.gz: 1625c7941861abafb8b09cc8491fb208487d10192d0c9e110bd46b230f912129d713836391fd36d19990f985a1ee5171f9e2c92f7e8c82fc079f9b571e5ec9f4
@@ -6,6 +6,7 @@ module Vagrant
6
6
  def initialize(app, env)
7
7
  @app = app
8
8
  @machine = env[:machine]
9
+ @config = @machine.config.newdisk
9
10
  @enabled = true
10
11
  @ui = env[:ui]
11
12
  if @machine.provider.to_s !~ /VirtualBox/
@@ -16,12 +17,17 @@ module Vagrant
16
17
 
17
18
  def call(env)
18
19
  # Create the disk before boot
19
- if @enabled
20
- size = @machine.config.newdisk.size
21
- path = @machine.config.newdisk.path
22
- env[:ui].info "start newdisk: size = #{size}, path = #{path}"
23
- new_disk(env, path, size)
24
- env[:ui].success "done newdisk: size = #{size}, path = #{path}"
20
+ if @enabled and @config.is_set?
21
+ path = @config.path
22
+ size = @config.size
23
+ env[:ui].info "call newdisk: size = #{size}, path = #{path}"
24
+
25
+ if File.exist? path
26
+ env[:ui].info "skip newdisk - already exists: #{path}"
27
+ else
28
+ new_disk(env, path, size)
29
+ env[:ui].success "done newdisk: size = #{size}, path = #{path}"
30
+ end
25
31
  end
26
32
 
27
33
  # Allow middleware chain to continue so VM is booted
@@ -9,13 +9,8 @@ module Vagrant
9
9
  @path = UNSET_VALUE
10
10
  end
11
11
 
12
- def finalize!
13
- return if @size == UNSET_VALUE
14
- end
15
-
16
- def validate(machine)
17
- errors = []
18
- return { 'Newdisk configuration' => errors }
12
+ def is_set?
13
+ @size != UNSET_VALUE and @path != UNSET_VALUE
19
14
  end
20
15
  end
21
16
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Newdisk
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-newdisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yavor Nikolov