vagrant-export 0.3.4 → 0.3.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 +4 -4
- data/lib/vagrant-export/error.rb +3 -0
- data/lib/vagrant-export/exporter.rb +16 -11
- data/lib/vagrant-export/version.rb +1 -1
- data/res/progress_tar.sh +7 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c449b4ab728d16122ab1684cc5c2950b20bc818
|
4
|
+
data.tar.gz: adce85990ea7f430caf4f2b9e427f624f48fe8b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 449990b155f38b7f3af3fd342bbdac52b65cc361c68d78076dd2efc7c2581172ce36490b0ab607169b1fef6a30363b7145102a18628c1f64c940fe869df3e3ae
|
7
|
+
data.tar.gz: 26f494c83a132fe4d802d76fe7501755ea78d701913a9d0ba931530995be5a9eb1c456b1c286ac1713912b961f9323a3e87acb654ed50d61fde7da8150371a93
|
data/lib/vagrant-export/error.rb
CHANGED
@@ -14,5 +14,8 @@ module VagrantPlugins
|
|
14
14
|
class NotCreated < Vagrant::Errors::VagrantError
|
15
15
|
error_message('Cannot export a not created machine. Please make at least one vagrant up')
|
16
16
|
end
|
17
|
+
class TarFailed < Vagrant::Errors::VagrantError
|
18
|
+
error_message('Error during creating the box file')
|
19
|
+
end
|
17
20
|
end
|
18
21
|
end
|
@@ -33,7 +33,7 @@ module VagrantPlugins
|
|
33
33
|
end
|
34
34
|
|
35
35
|
begin
|
36
|
-
ssh_info = vm.ssh_info
|
36
|
+
ssh_info = @vm.ssh_info
|
37
37
|
unless ssh_info == nil
|
38
38
|
@private_key = ssh_info[:private_key_path]
|
39
39
|
end
|
@@ -52,14 +52,14 @@ module VagrantPlugins
|
|
52
52
|
|
53
53
|
finalize
|
54
54
|
ensure
|
55
|
-
FileUtils.rm_rf(@tmp_path) if Dir.exists?(@tmp_path)
|
56
|
-
FileUtils.rm_rf(@box_file_name) if File.file?(@box_file_name)
|
55
|
+
FileUtils.rm_rf(@tmp_path) if @tmp_path != nil && Dir.exists?(@tmp_path)
|
56
|
+
FileUtils.rm_rf(@box_file_name) if @box_file_name != nil && File.file?(@box_file_name)
|
57
57
|
end
|
58
58
|
target_box
|
59
59
|
end
|
60
60
|
|
61
61
|
def target_box
|
62
|
-
box_name = @vm.box.name.gsub(
|
62
|
+
box_name = @vm.box.name.gsub(/[^a-z0-9\-]+/, '_')
|
63
63
|
File.join(@env.cwd, box_name + '.box')
|
64
64
|
end
|
65
65
|
|
@@ -77,7 +77,7 @@ module VagrantPlugins
|
|
77
77
|
|
78
78
|
if @vm.config.vm.communicator != :winrm
|
79
79
|
|
80
|
-
ssh_info = vm.ssh_info
|
80
|
+
ssh_info = @vm.ssh_info
|
81
81
|
unless ssh_info == nil
|
82
82
|
@private_key = ssh_info[:private_key_path]
|
83
83
|
end
|
@@ -128,15 +128,15 @@ module VagrantPlugins
|
|
128
128
|
def setup_private_key
|
129
129
|
|
130
130
|
# Key generated by vagrant
|
131
|
-
path = @vm.data_dir.join('private_key')
|
131
|
+
path = @vm.data_dir.join('private_key').to_s
|
132
132
|
|
133
133
|
# Use a different generated key if configured
|
134
134
|
if @private_key != nil
|
135
|
-
path =
|
135
|
+
path = @private_key.to_s
|
136
136
|
end
|
137
137
|
|
138
138
|
# If we don't have a generated private key, we do nothing
|
139
|
-
return unless
|
139
|
+
return unless File.file?(path)
|
140
140
|
|
141
141
|
# Copy it into our box directory
|
142
142
|
new_path = File.join(@tmp_path, 'private_key')
|
@@ -341,11 +341,12 @@ module VagrantPlugins
|
|
341
341
|
|
342
342
|
files = Dir.glob(File.join('.', '**', '*'))
|
343
343
|
@logger.debug("Create box file #{@box_file_name} containing #{files}")
|
344
|
+
bash_exec = Vagrant::Util::Which.which('bash');
|
344
345
|
|
345
|
-
if Vagrant::Util::Which.which('pv') != nil && Vagrant::Util::Which.which('tar') && Vagrant::Util::Which.which('gzip')
|
346
|
+
if File.executable?(bash_exec) && Vagrant::Util::Which.which('pv') != nil && Vagrant::Util::Which.which('tar') && Vagrant::Util::Which.which('gzip')
|
346
347
|
total_size = 0
|
347
348
|
|
348
|
-
logger.debug('Using custom packaging command to create progress output')
|
349
|
+
@logger.debug('Using custom packaging command to create progress output')
|
349
350
|
@env.ui.info('Starting compression')
|
350
351
|
|
351
352
|
files.each { |f|
|
@@ -357,7 +358,9 @@ module VagrantPlugins
|
|
357
358
|
opts = {}
|
358
359
|
opts[:notify] = [:stderr, :stdout]
|
359
360
|
|
360
|
-
|
361
|
+
script_file = File.absolute_path(File.expand_path('../../../res/progress_tar.sh', __FILE__))
|
362
|
+
|
363
|
+
Vagrant::Util::Subprocess.execute(bash_exec, script_file, @tmp_path.to_s, total_size.to_s, @box_file_name, opts) { |io, data|
|
361
364
|
d = data.to_s
|
362
365
|
|
363
366
|
if io == :stderr
|
@@ -375,6 +378,8 @@ module VagrantPlugins
|
|
375
378
|
end
|
376
379
|
end
|
377
380
|
|
381
|
+
raise TarFailed unless File.file?(@box_file_name)
|
382
|
+
|
378
383
|
0
|
379
384
|
end
|
380
385
|
|
data/res/progress_tar.sh
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-export
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Grossberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Export boxes to .box files including the original Vagrantfile and some
|
14
14
|
cleanups inside the VM
|
@@ -29,6 +29,8 @@ files:
|
|
29
29
|
- lib/vagrant-export/plugin.rb
|
30
30
|
- lib/vagrant-export/version.rb
|
31
31
|
- res/cleanup.sh
|
32
|
+
- res/progress_tar.sh
|
33
|
+
- vagrant-export-0.3.4.gem
|
32
34
|
- vagrant-export.gemspec
|
33
35
|
homepage: https://github.com/trenker/vagrant-export
|
34
36
|
licenses:
|