vagrant-export 0.3.2 → 0.3.3

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: b75fdb202a785f439de0c9f88c6835cc0a02d8c6
4
- data.tar.gz: 7367e4fd0cf82a55eb934a7401fc9d545657d33a
3
+ metadata.gz: 48931115e8fd25527afc676c98ce1104281ab66d
4
+ data.tar.gz: befa92a53e1fa97fc036d6d0f428c2c581f87c65
5
5
  SHA512:
6
- metadata.gz: 0e50541e5aa70b45e388403810262cad1eacde69c0dc890d028f5f7d0909afcd9d2dbbe6b7bbe7907a019b68da2a556b918ea089b994ddec01e24a8492bb7578
7
- data.tar.gz: 0a3c6ac3856d22934398127933511e61f70ecc9e6753cc1f563758aa89c115d401bb0ac29b4adb4717ef99b1ebc454b5896dc595f3b990193ce676178af966bc
6
+ metadata.gz: dbb99ff418f44bd31f96c80f058a31ea62813118ba207f72c838a82d73d23383ac112d4cb276e25b3884e0df79176806e17c2c7c94b075cfb64ac1c64083b6ba
7
+ data.tar.gz: 80d2fd744aa98f518d9cda978ed84f5942af921fb7ebdaed1872ed8a0b8f9197201bdecbaad228de0bd39867dba3f1b5638a0370680c85f805fa7fef3bc5674a
@@ -106,12 +106,35 @@ module VagrantPlugins
106
106
 
107
107
  # Copy it into our box directory
108
108
  new_path = File.join(@tmp_path, 'vagrant_private_key')
109
+ @logger.debug("Copy private key from #{path} to #{new_path}")
109
110
  FileUtils.cp(path, new_path)
110
111
 
111
112
  # Append it to the Vagrantfile (or create a Vagrantfile)
112
113
  vf_path = File.join(@tmp_path, 'Vagrantfile')
113
114
  mode = 'w+'
114
- mode = 'a' if File.file?(vf_path)
115
+
116
+ @logger.debug("Check and add private_key_path setting to #{vf_path}")
117
+
118
+ if File.file?(vf_path)
119
+ mode = 'a'
120
+ has_private_key_path = false
121
+
122
+ @logger.debug('Vagrantfile exists, check for private_key_path')
123
+
124
+ File.readlines(vf_path).each { |line|
125
+ if line.to_s =~ /ssh\.private_key_path/i
126
+ has_private_key_path = true
127
+ end
128
+ }
129
+
130
+ if has_private_key_path
131
+ @logger.debug('Existing Vagrantfile already has a private_key_path setting')
132
+ return
133
+ end
134
+ else
135
+ @logger.debug('No Vagrantfile found, create one')
136
+ end
137
+
115
138
 
116
139
  File.open(vf_path, mode) do |f|
117
140
  f.binmode
@@ -139,26 +162,37 @@ module VagrantPlugins
139
162
  provider_name = @vm.provider_name.to_s
140
163
 
141
164
  if /vmware/i =~ provider_name
165
+
166
+ @logger.debug("Using vmware method for provider #{provider_name}")
167
+
142
168
  current_dir = File.dirname(@vm.id)
143
169
  files = Dir.glob(File.join(current_dir, '**', '*'))
144
170
 
171
+ @logger.debug("Files found in #{current_dir}: #{files}")
172
+
145
173
  files.select! {|f| !File.directory?(f) }
146
174
  files.select!{ |f| f !~ /\.log$/ }
147
175
  files.select!{ |f| f !~ /core$/ }
148
176
  files.select!{ |f| f !~ /\.gz$/ }
149
177
  files.select!{ |f| f !~ /.lck$/ }
150
178
 
179
+ @logger.debug("Copying #{files} to #{exported_path}")
180
+
151
181
  FileUtils.cp_r(files, exported_path)
152
182
 
153
183
  @vm.ui.info('Compacting Vmware virtual disks')
154
184
 
155
185
  Dir.glob(File.join(exported_path, '**', '*.vmdk')) { |f|
186
+
187
+ @logger.debug("Running 'vmware-vdiskmanager -d #{f}'")
156
188
  Vagrant::Util::Subprocess.execute('vmware-vdiskmanager', '-d', f)
189
+
190
+ @logger.debug("Running 'vmware-vdiskmanager -k #{f}'")
157
191
  Vagrant::Util::Subprocess.execute('vmware-vdiskmanager', '-k', f)
158
192
  }
159
193
 
160
194
  else
161
- @vm.provider.driver.export File.join(exported_path, 'box.ovf' + ext) do |progress|
195
+ @vm.provider.driver.export File.join(exported_path, 'box.ovf') do |progress|
162
196
  @vm.ui.clear_line
163
197
  @vm.ui.report_progress(progress.percent, 100, false)
164
198
  end
@@ -171,11 +205,14 @@ module VagrantPlugins
171
205
 
172
206
  provider_name = @vm.provider_name.to_s
173
207
 
208
+ @logger.debug("Provider identified as #{provider_name}")
209
+
174
210
  # For Vmware, the remote provider is generic _desktop
175
211
  # the local is a specific _fusion or _workstation
176
212
  # Always use vmware_desktop to avoid problems with different provider plugins
177
213
  if provider_name =~ /vmware/
178
214
  provider_name = 'vmware_desktop'
215
+ @logger.debug("Forcing provider name #{provider_name}")
179
216
  end
180
217
 
181
218
  # Add metadata json
@@ -191,6 +228,7 @@ module VagrantPlugins
191
228
 
192
229
  # Copy includes
193
230
  if Dir.exist?(source_include_path) && !bare
231
+ @logger.debug("Copy includes from #{source_include_path} to #{target_include_path}")
194
232
  FileUtils.cp_r(source_include_path, @tmp_path)
195
233
  end
196
234
 
@@ -201,6 +239,7 @@ module VagrantPlugins
201
239
 
202
240
  # Check the original vagrant file for a mac settings
203
241
  if vagrantfile_exists && vagrantfile_needs_mac
242
+ @logger.debug('Provider needs a hmac setting in the Vagrantfile')
204
243
  File.readlines(original_vagrantfile).each { |line|
205
244
  if line.to_s =~ /base_mac\s*=\s*("|')/i
206
245
  vagrantfile_has_mac = true
@@ -210,6 +249,7 @@ module VagrantPlugins
210
249
 
211
250
  # If it has one, just copy it
212
251
  if vagrantfile_has_mac || (!vagrantfile_needs_mac && vagrantfile_exists)
252
+ @logger.debug('Box has already a hmac in its Vagrantfile, copy existing')
213
253
  FileUtils.cp(original_vagrantfile, File.join(@tmp_path, 'Vagrantfile'))
214
254
 
215
255
  # If none, create a new one that has the mac setting,
@@ -217,6 +257,7 @@ module VagrantPlugins
217
257
  # The new Vagrantfile will include the old one, which
218
258
  # is put into the includeds directory
219
259
  elsif vagrantfile_needs_mac
260
+ @logger.debug('Vagrantfile has no hmac, set one ourselves')
220
261
  File.open(File.join(@tmp_path, 'Vagrantfile'), 'wb') do |file|
221
262
  file.write(Vagrant::Util::TemplateRenderer.render('package_Vagrantfile', {
222
263
  base_mac: @vm.provider.driver.read_mac_address
@@ -226,8 +267,10 @@ module VagrantPlugins
226
267
  # If there is a Vagrantfile, but without a mac
227
268
  # ensure it is included
228
269
  if vagrantfile_exists
270
+ included_vagrantfile = File.join(target_include_path, '_Vagrantfile')
271
+ @logger.debug("Box already has a Vagrantfile, copy it from #{original_vagrantfile} to #{included_vagrantfile}")
229
272
  FileUtils.mkdir_p(target_include_path) unless Dir.exist?(target_include_path)
230
- FileUtils.cp(original_vagrantfile, File.join(target_include_path, '_Vagrantfile'))
273
+ FileUtils.cp(original_vagrantfile, included_vagrantfile)
231
274
  end
232
275
  end
233
276
 
@@ -241,6 +284,7 @@ module VagrantPlugins
241
284
 
242
285
  Vagrant::Util::SafeChdir.safe_chdir(@tmp_path) do
243
286
  files = Dir.glob(File.join('.', '**', '*'))
287
+ @logger.debug("Create box file #{@box_file_name} containing #{files}")
244
288
  Vagrant::Util::Subprocess.execute('bsdtar', '-czf', @box_file_name, *files)
245
289
  end
246
290
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module VagrantPlugins
7
7
  module Export
8
- VERSION = '0.3.2'
8
+ VERSION = '0.3.3'
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.2
4
+ version: 0.3.3
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-12 00:00:00.000000000 Z
11
+ date: 2015-03-30 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