vagrant-export 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aebbfe47b8cb61c914617b5093dd3eff5cc6685c
4
- data.tar.gz: e1a2327a50b858faa052da044c0931a217a6e179
3
+ metadata.gz: b75fdb202a785f439de0c9f88c6835cc0a02d8c6
4
+ data.tar.gz: 7367e4fd0cf82a55eb934a7401fc9d545657d33a
5
5
  SHA512:
6
- metadata.gz: 051a3a01cd6caca98e9142798c9ed20e967e6094953beb2a6a97bc44ea48de850ec543bbea17a7eddce97c7e4f78f6dc643bba7a2587cca34f531ecb49ff8f8f
7
- data.tar.gz: 98335fc927b5ef5915220465eae6df1b7af93bb34fe42b885033dbe885c7c618491ec8657976232b2482f7249d7522c61fe95d6f2e360004c502977b6870cf58
6
+ metadata.gz: 0e50541e5aa70b45e388403810262cad1eacde69c0dc890d028f5f7d0909afcd9d2dbbe6b7bbe7907a019b68da2a556b918ea089b994ddec01e24a8492bb7578
7
+ data.tar.gz: 0a3c6ac3856d22934398127933511e61f70ecc9e6753cc1f563758aa89c115d401bb0ac29b4adb4717ef99b1ebc454b5896dc595f3b990193ce676178af966bc
@@ -28,7 +28,7 @@ module VagrantPlugins
28
28
  if can_compress
29
29
  compress
30
30
  else
31
- @env.uid.error('Cannot compress this type of machine')
31
+ @vm.ui.error('Cannot compress this type of machine')
32
32
  return 1
33
33
  end
34
34
  end
@@ -48,7 +48,7 @@ module VagrantPlugins
48
48
  if @vm.state.short_description == 'running'
49
49
  @did_run = true
50
50
  else
51
- @env.ui.info('Machine not running, bringing it up')
51
+ @vm.ui.info('Machine not running, bringing it up')
52
52
  @vm.action(:up)
53
53
  end
54
54
 
@@ -125,7 +125,7 @@ module VagrantPlugins
125
125
  def export
126
126
  # Halt the machine
127
127
  if @vm.state.short_description == 'running'
128
- @env.ui.info('Halting VM for export')
128
+ @vm.ui.info('Halting VM for export')
129
129
  @vm.action(:halt)
130
130
  end
131
131
 
@@ -134,20 +134,33 @@ module VagrantPlugins
134
134
  @tmp_path = exported_path
135
135
  FileUtils.mkdir_p(exported_path)
136
136
 
137
- @env.ui.info('Exporting machine')
137
+ @vm.ui.info('Exporting machine')
138
138
 
139
139
  provider_name = @vm.provider_name.to_s
140
140
 
141
141
  if /vmware/i =~ provider_name
142
142
  current_dir = File.dirname(@vm.id)
143
- files = Dir.glob(File.join(current_dir, '**', '*')).select {|f|
144
- !File.directory?(f)
145
- }
143
+ files = Dir.glob(File.join(current_dir, '**', '*'))
144
+
145
+ files.select! {|f| !File.directory?(f) }
146
+ files.select!{ |f| f !~ /\.log$/ }
147
+ files.select!{ |f| f !~ /core$/ }
148
+ files.select!{ |f| f !~ /\.gz$/ }
149
+ files.select!{ |f| f !~ /.lck$/ }
150
+
146
151
  FileUtils.cp_r(files, exported_path)
152
+
153
+ @vm.ui.info('Compacting Vmware virtual disks')
154
+
155
+ Dir.glob(File.join(exported_path, '**', '*.vmdk')) { |f|
156
+ Vagrant::Util::Subprocess.execute('vmware-vdiskmanager', '-d', f)
157
+ Vagrant::Util::Subprocess.execute('vmware-vdiskmanager', '-k', f)
158
+ }
159
+
147
160
  else
148
161
  @vm.provider.driver.export File.join(exported_path, 'box.ovf' + ext) do |progress|
149
- @env.ui.clear_line
150
- @env.ui.report_progress(progress.percent, 100, false)
162
+ @vm.ui.clear_line
163
+ @vm.ui.report_progress(progress.percent, 100, false)
151
164
  end
152
165
  end
153
166
 
@@ -158,6 +171,13 @@ module VagrantPlugins
158
171
 
159
172
  provider_name = @vm.provider_name.to_s
160
173
 
174
+ # For Vmware, the remote provider is generic _desktop
175
+ # the local is a specific _fusion or _workstation
176
+ # Always use vmware_desktop to avoid problems with different provider plugins
177
+ if provider_name =~ /vmware/
178
+ provider_name = 'vmware_desktop'
179
+ end
180
+
161
181
  # Add metadata json
162
182
  begin
163
183
  metadata = File.open(File.join(@tmp_path, 'metadata.json'), 'wb')
@@ -196,7 +216,7 @@ module VagrantPlugins
196
216
  # and includes the original
197
217
  # The new Vagrantfile will include the old one, which
198
218
  # is put into the includeds directory
199
- else
219
+ elsif vagrantfile_needs_mac
200
220
  File.open(File.join(@tmp_path, 'Vagrantfile'), 'wb') do |file|
201
221
  file.write(Vagrant::Util::TemplateRenderer.render('package_Vagrantfile', {
202
222
  base_mac: @vm.provider.driver.read_mac_address
@@ -217,6 +237,8 @@ module VagrantPlugins
217
237
  # Make a box file out of it
218
238
  @box_file_name = @tmp_path + '.box'
219
239
 
240
+ @vm.ui.info('Packaging box file')
241
+
220
242
  Vagrant::Util::SafeChdir.safe_chdir(@tmp_path) do
221
243
  files = Dir.glob(File.join('.', '**', '*'))
222
244
  Vagrant::Util::Subprocess.execute('bsdtar', '-czf', @box_file_name, *files)
@@ -231,7 +253,7 @@ module VagrantPlugins
231
253
  box_name = @vm.box.name.gsub('/', '_')
232
254
  @target_box = File.join(@env.cwd, box_name + '.box')
233
255
  FileUtils.mv(@box_file_name, @target_box)
234
- @env.ui.info('Created ' + @target_box)
256
+ @vm.ui.info('Created ' + @target_box)
235
257
  end
236
258
 
237
259
  # Remove the tmp files
@@ -239,7 +261,7 @@ module VagrantPlugins
239
261
 
240
262
  # Resume the machine
241
263
  if @did_run
242
- @env.ui.info('Bringing the machine back up')
264
+ @vm.ui.info('Bringing the machine back up')
243
265
  @vm.action(:up)
244
266
  end
245
267
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module VagrantPlugins
7
7
  module Export
8
- VERSION = '0.3.1'
8
+ VERSION = '0.3.2'
9
9
  end
10
10
  end
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.1
4
+ version: 0.3.2
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-03-11 00:00:00.000000000 Z
11
+ date: 2015-03-12 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