vagrant-export 0.3.4 → 0.3.5

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: 3ddbe360fa54bea73f25c2241a25154f40740a4a
4
- data.tar.gz: 46c28c9124e22569ae174c8a90b1de86dfa57103
3
+ metadata.gz: 1c449b4ab728d16122ab1684cc5c2950b20bc818
4
+ data.tar.gz: adce85990ea7f430caf4f2b9e427f624f48fe8b0
5
5
  SHA512:
6
- metadata.gz: cdf99b3412fbb5680e3b6c499c70c7af87f4590c1661f7609540954468cd3dfa36cacf4d2c9136c4d69daeda14661aebc5e38f780e76c693fafa551ba96b9b4d
7
- data.tar.gz: 535bc6e78a326bc85e06d513e125c6a53f3b75abe94fd2c29931017e0a3a076e6613775207654d1e00618349756f4b9332c25699b9a5b5be8855afb046b5fbad
6
+ metadata.gz: 449990b155f38b7f3af3fd342bbdac52b65cc361c68d78076dd2efc7c2581172ce36490b0ab607169b1fef6a30363b7145102a18628c1f64c940fe869df3e3ae
7
+ data.tar.gz: 26f494c83a132fe4d802d76fe7501755ea78d701913a9d0ba931530995be5a9eb1c456b1c286ac1713912b961f9323a3e87acb654ed50d61fde7da8150371a93
@@ -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 = File.new(@private_key.to_s, 'r') unless @private_key == Vagrant.source_root.join('keys', 'vagrant')
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 path.file?
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
- Vagrant::Util::Subprocess.execute('tar', ' -cf - ', *files, ' | pv -n -s ', total_size, ' | gzip -c > ', @box_file_name) { |io, data|
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
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module VagrantPlugins
7
7
  module Export
8
- VERSION = '0.3.4'
8
+ VERSION = '0.3.5'
9
9
  end
10
10
  end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash -eu
2
+
3
+ DIRECTORY=$1
4
+ TOTAL_SIZE=$2
5
+ TARGET_TAR=$3
6
+
7
+ tar -c ${DIRECTORY}/* | pv -n -s ${TOTAL_SIZE} | gzip -c > ${TARGET_TAR}
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
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-13 00:00:00.000000000 Z
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: