vagrant-vmware-esxi 2.3.2 → 2.4.0

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: 9add93afbe2c65281e14113183ceb33f3d01a51e
4
- data.tar.gz: a6a0236f43cc722e4bc656770456ba96b3009b10
3
+ metadata.gz: 1dcbc0face9e5a7ebbfcfd749b15d83b1f42b2ea
4
+ data.tar.gz: dddf553b0781d7f60907b6d5c474d8b22778907f
5
5
  SHA512:
6
- metadata.gz: 0ab75906ccd65e6e791bf52e5368c7fa824a18e02291a1137ccdc5a71e780cbbc196e9dbedd43be7871f5dd7f030cb81c8fb7232784110852fbff4e9a1d86384
7
- data.tar.gz: 94187df006a5956a4c4db7bc87742d36461f33c59eee418d42d68de278a14a2f6c1a57787cf42c848549f9bd18a5e6405872362ad071d822f9c9c540bef6308b
6
+ metadata.gz: 1bd9c80da6a1f44c3cfb70bdca1f35c05d0c5f0caa81d4fbcbbacb55913c087027203b3f6c29f4a282b4a73bb225de467b8a724d4f64c89075873102a8eac3fd
7
+ data.tar.gz: f9c74b17cc5d35fb3be15c03039a56d793fe611ce477d4f457ba88a659aabf013ff3b2845e30ae5b68b03e0900417c95599584e363088e65bf5669c5f5268de1
data/README.md CHANGED
@@ -33,7 +33,7 @@ Features and Compatibility
33
33
  * Create additional network interfaces, set nic type, MAC addresses, static IPs.
34
34
  * Use Vagrants private_network, public_network options to set a static IP addresses on additional network interfaces. (not the primary interface)
35
35
  * Disks can be provisioned using thin, thick or eagerzeroedthick.
36
- * Create additional guest storage (upto 14 virtual disks).
36
+ * Create additional guest storage (up to 14 virtual disks).
37
37
  * Specify GuestOS types, virtual HW version.
38
38
  * Any custom vmx settings can be added or modified.
39
39
 
@@ -213,7 +213,7 @@ Vagrant.configure('2') do |config|
213
213
  #esxi.guest_guestos = 'centos-64'
214
214
 
215
215
  # OPTIONAL. guest_virtualhw_version
216
- # ESXi 6.5 supports these versions. 4,7,8,9,10,11,12 & 13.
216
+ # ESXi 6.5 supports these versions. 4,7,8,9,10,11,12,13 & 14.
217
217
  #esxi.guest_virtualhw_version = '9'
218
218
 
219
219
  # RISKY. guest_custom_vmx_settings
@@ -235,7 +235,7 @@ Vagrant.configure('2') do |config|
235
235
  #esxi.local_failonwarning = 'True'
236
236
 
237
237
  # Plugin debug output.
238
- # Please send any bug reports with debug this output...
238
+ # Please send any bug reports with this debug output...
239
239
  #esxi.debug = 'true'
240
240
 
241
241
  end
@@ -255,10 +255,11 @@ Basic usage
255
255
  * `vagrant ssh-config`
256
256
  * `vagrant snapshot push`
257
257
  * `vagrant snapshot list`
258
- * `vagrant snapshot-info`
258
+ * `vagrant snapshot-info` # esxi provided plugin. Output snapshot information/tree.
259
259
  * `vagrant snapshot pop`
260
260
  * `vagrant halt`
261
261
  * `vagrant provision`
262
+ * `vagrant address` # esxi provided plugin. Output IP address of guest.
262
263
 
263
264
 
264
265
 
@@ -272,17 +273,21 @@ Known issues with vmware_esxi
272
273
  -----------------------------
273
274
  * The boxes must have open-vm-tools or vmware-tools installed to properly transition to the 'running' state.
274
275
  * Invalid settings (bad IP address, netmask, MAC address, guest_custom_vmx_settings) could cause 'vagrant up' to fail. Review vSphere console and/or ESXi logs to help debug why it failed.
275
- * Cleanup doesn't always destroy a VM that has been partially built. To resolve this. Use the local_allow_overwrite = 'True' option if you want to force a rebuild, or you can delete the vm using the VSphere client.
276
+ * If you break an install ([CTRL]-C), the cleanup task doesn't always destroy the VM that has been partially built. To resolve this, use the local_allow_overwrite = 'True' Vagrantfile option if you want to force a rebuild, or you can delete the vm using the VSphere client.
276
277
  * ovftool installer for windows doesn't put ovftool.exe in your path. You can manually set your path, or install ovftool in the \HashiCorp\Vagrant\bin directory.
277
- * Vagrant NFS synced folders is not reliable on multi-homed clients (your vagrant pc/laptop/host). There is no 100% reliable way to know which IP is the correct, most reliable, most desirable, etc...
278
+ * Vagrant NFS synced folders cannot not 100% reliable on multi-homed clients (your vagrant pc/laptop/host). There is no 100% reliable way to know which IP is the correct, most reliable, most desirable, way to reach the vm guest.
278
279
  * Plugin V2.0.1 - 2.0.5 is not compatible with Windows (to support ed25519 ssh keys, net-ssh requires libsodium but it's not compatible with Windows). ed25519 support has been removed for now. It will be added back when net-ssh 5.x goes out of beta.
279
280
  * Vagrant 2.1.0 is not compatible with this plugin. Avoid Vagrant 2.1.0.
280
281
  * Cygwin & gitbash have console issues. Ruby module io/console does not have support. https://github.com/ruby/io-console/issues/2
281
- * Setting the hostname on some boxes can cause 'vagrant up' to fail (generic/centos7 for example). Avoid buggy boxes like generic/centos7, fix the box networking and repackage, or do not set the hostname via Vagrant.
282
+ * Setting the hostname on some boxes can cause 'vagrant up' to fail if the network configuration wasn't previously cleaned up. Avoid buggy boxes, fix the box networking and repackage, or do not set the hostname via Vagrant.
282
283
 
283
284
 
284
285
  Version History
285
286
  ---------------
287
+ * 2.4.0 Add support for 'vagrant address', output ip address of guest.
288
+ Fix, exit 1 on vagrant up if unable to reach "running" state.
289
+ Some code cleanup.
290
+
286
291
  * 2.3.2 Fix, vagrant ssh -c now works.
287
292
 
288
293
  * 2.3.1 Fix, Disk stores can now contain spaces.
@@ -216,7 +216,7 @@ Vagrant.configure('2') do |config|
216
216
  # If unspecified, the default will be generated by the OVFTool. Most
217
217
  # of the time, you don't need to change this unless you are using advanced
218
218
  # custom vmx settings that require it.
219
- # ESXi 6.5 supports these versions. 4,7,8,9,10,11,12 & 13.
219
+ # ESXi 6.5 supports these versions. 4,7,8,9,10,11,12,13 & 14.
220
220
  #esxi.guest_virtualhw_version = '9'
221
221
 
222
222
  # RISKY. guest_custom_vmx_settings
@@ -258,7 +258,7 @@ Vagrant.configure('2') do |config|
258
258
  #esxi.local_failonwarning = 'True'
259
259
 
260
260
  # Plugin debug output.
261
- # Send bug reports with debug output...
261
+ # Send bug reports with this debug output...
262
262
  #esxi.debug = 'true'
263
263
 
264
264
  end
@@ -78,6 +78,13 @@ module VagrantPlugins
78
78
  end
79
79
  end
80
80
 
81
+ def self.action_address
82
+ Vagrant::Action::Builder.new.tap do |b|
83
+ b.use SetESXiPassword
84
+ b.use Address
85
+ end
86
+ end
87
+
81
88
  def self.action_snapshot_info
82
89
  Vagrant::Action::Builder.new.tap do |b|
83
90
  b.use SetESXiPassword
@@ -201,6 +208,7 @@ module VagrantPlugins
201
208
  autoload :SnapshotDelete, action_root.join('snapshot_delete')
202
209
  autoload :SnapshotRestore, action_root.join('snapshot_restore')
203
210
  autoload :WaitForState, action_root.join('wait_for_state')
211
+ autoload :Address, action_root.join('address')
204
212
  end
205
213
  end
206
214
  end
@@ -0,0 +1,38 @@
1
+ require 'log4r'
2
+ require 'net/ssh'
3
+
4
+ module VagrantPlugins
5
+ module ESXi
6
+ module Action
7
+ # This action will print the IP address
8
+ class Address
9
+ def initialize(app, _env)
10
+ @app = app
11
+ @logger = Log4r::Logger.new('vagrant_vmware_esxi::action::address')
12
+ end
13
+
14
+ def call(env)
15
+ address(env)
16
+ @app.call(env)
17
+ end
18
+
19
+ def address(env)
20
+ @logger.info('vagrant-vmware-esxi, address: start...')
21
+
22
+ # Get config.
23
+ machine = env[:machine]
24
+ config = env[:machine].provider_config
25
+
26
+ # return IP if it's known.
27
+ return nil if machine.state.id != :running
28
+
29
+ ssh_info = machine.ssh_info
30
+ return nil if !ssh_info
31
+
32
+ env[:ui].info ssh_info[:host]
33
+
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -14,11 +14,11 @@ module VagrantPlugins
14
14
  end
15
15
 
16
16
  def call(env)
17
- suspend(env)
17
+ package(env)
18
18
  @app.call(env)
19
19
  end
20
20
 
21
- def suspend(env)
21
+ def package(env)
22
22
  @logger.info('vagrant-vmware-esxi, package: start...')
23
23
 
24
24
  # Get config.
@@ -58,7 +58,7 @@ module VagrantPlugins
58
58
  # when you have multiple network interfaces
59
59
  ssh_execute_cmd = "vim-cmd vmsvc/get.guest #{machine.id} 2>/dev/null |"
60
60
  ssh_execute_cmd << 'grep -A 5 "deviceConfigId = 4000" |tail -1|'
61
- ssh_execute_cmd << 'grep -oE "((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])"'
61
+ ssh_execute_cmd << 'grep -oE "((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])"'
62
62
  r = ssh.exec!(ssh_execute_cmd)
63
63
  ipaddress = r.strip
64
64
 
@@ -12,11 +12,11 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- suspend(env)
15
+ snapshotdelete(env)
16
16
  @app.call(env)
17
17
  end
18
18
 
19
- def suspend(env)
19
+ def snapshotdelete(env)
20
20
  @logger.info('vagrant-vmware-esxi, snapshot_delete: start...')
21
21
 
22
22
  # Get config.
@@ -12,11 +12,11 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- suspend(env)
15
+ snapshotinfo(env)
16
16
  @app.call(env)
17
17
  end
18
18
 
19
- def suspend(env)
19
+ def snapshotinfo(env)
20
20
  @logger.info('vagrant-vmware-esxi, snapshot_info: start...')
21
21
 
22
22
  # Get config.
@@ -26,9 +26,9 @@ module VagrantPlugins
26
26
  @logger.info("vagrant-vmware-esxi, snapshot_info: machine id: #{machine.id}")
27
27
  @logger.info("vagrant-vmware-esxi, snapshot_info: current state: #{env[:machine_state]}")
28
28
 
29
- if env[:machine_state].to_s == 'not_created'
29
+ if machine.id == ''
30
30
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
31
- message: 'Cannot snapshot_info in this state')
31
+ message: 'Cannot snapshot-info in this state')
32
32
  else
33
33
 
34
34
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
@@ -43,9 +43,9 @@ module VagrantPlugins
43
43
  r = ssh.exec!(
44
44
  "vim-cmd vmsvc/snapshot.get #{machine.id} 2>&1 | "\
45
45
  "sed 's/Get Snapshot:/ /g' | "\
46
- "grep -v "\
46
+ "grep -v -e '^ $' "\
47
47
  "-e 'Snapshot Id ' "\
48
- "-e 'Snapshot Desciption ' "\
48
+ "-e 'Snapshot Created On ' "\
49
49
  "-e 'Snapshot State '")
50
50
 
51
51
  snapshotinfo = r
@@ -12,11 +12,11 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- suspend(env)
15
+ snapshotlist(env)
16
16
  @app.call(env)
17
17
  end
18
18
 
19
- def suspend(env)
19
+ def snapshotlist(env)
20
20
  @logger.info('vagrant-vmware-esxi, snapshot_list: start...')
21
21
 
22
22
  # Get config.
@@ -12,11 +12,11 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- suspend(env)
15
+ snapshotrestore(env)
16
16
  @app.call(env)
17
17
  end
18
18
 
19
- def suspend(env)
19
+ def snapshotrestore(env)
20
20
  @logger.info('vagrant-vmware-esxi, snapshot_restore: start...')
21
21
 
22
22
  # Get config.
@@ -12,11 +12,11 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- suspend(env)
15
+ snapshotsave(env)
16
16
  @app.call(env)
17
17
  end
18
18
 
19
- def suspend(env)
19
+ def snapshotsave(env)
20
20
  @logger.info('vagrant-vmware-esxi, snapshot_save: start...')
21
21
 
22
22
  # Get config.
@@ -30,10 +30,16 @@ module VagrantPlugins
30
30
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
31
31
  message: "Success, state is now \"#{@state}\"")
32
32
  end
33
+
33
34
  rescue Timeout::Error
34
- env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
35
- message: "Failed, timeout waiting for \"#{@state}\"")
36
- env[:result] = 'False' # couldn't reach state in time
35
+ if @state.to_s == 'running'
36
+ raise Errors::GeneralError,
37
+ message: 'Failed, timeout waiting for "running".'
38
+ else
39
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
40
+ message: "Timeout waiting for \"#{@state}\"")
41
+ env[:result] = 'False' # couldn't reach state in time
42
+ end
37
43
  end
38
44
  end
39
45
  env[:machine].provider_config.saved_ipaddress = nil
@@ -1,14 +1,28 @@
1
1
  module VagrantPlugins
2
2
  module ESXi
3
+
3
4
  class SnapshotInfo < Vagrant.plugin(2, :command)
4
5
  def self.synopsis
5
6
  "Snapshot additional information."
6
- end
7
+ end
7
8
  def execute
8
9
  with_target_vms(nil, :provider => "vmware_esxi") do |vm|
9
10
  vm.action(:snapshot_info)
10
11
  end
11
12
  end
12
13
  end
14
+
15
+ class CapAddress < Vagrant.plugin(2, :command)
16
+ def self.synopsis
17
+ "outputs the IP address of a guest."
18
+ end
19
+ def execute
20
+ with_target_vms(nil, :provider => "vmware_esxi") do |vm|
21
+ vm.action(:address)
22
+ end
23
+ end
24
+ end
25
+
26
+
13
27
  end
14
28
  end
@@ -93,7 +93,7 @@ module VagrantPlugins
93
93
  @debug = 'False'
94
94
  @saved_ipaddress = nil
95
95
  @supported_guest_virtualhw_versions = [
96
- 4,7,8,9,10,11,12,13
96
+ 4,7,8,9,10,11,12,13,14
97
97
  ]
98
98
  @supported_guest_disk_types = [
99
99
  'thin',
@@ -22,6 +22,12 @@ module VagrantPlugins
22
22
  Provider
23
23
  end
24
24
 
25
+ # Prints the IP address of the guest
26
+ command('address') do
27
+ require_relative 'command'
28
+ CapAddress
29
+ end
30
+
25
31
  provider_capability('vmware_esxi', 'snapshot_list') do
26
32
  require_relative 'cap/snapshot_list'
27
33
  Cap::SnapshotList
@@ -1,7 +1,7 @@
1
1
  # VERSION
2
2
  module VagrantPlugins
3
3
  module ESXi
4
- VERSION = '2.3.2'
4
+ VERSION = '2.4.0'
5
5
  $vagrant_vmware_esxi_version = VERSION
6
6
  end
7
7
  end
@@ -3,7 +3,7 @@ require File.expand_path('../lib/vagrant-vmware-esxi/version', __FILE__)
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'vagrant-vmware-esxi'
5
5
  s.version = VagrantPlugins::ESXi::VERSION
6
- s.date = '2018-07-03'
6
+ s.date = '2018-07-23'
7
7
  s.summary = 'Vagrant ESXi provider plugin'
8
8
  s.description = 'A Vagrant plugin that adds a VMware ESXi provider support'
9
9
  s.authors = ['Jonathan Senkerik']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vmware-esxi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Senkerik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-03 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -82,6 +82,7 @@ files:
82
82
  - example_box/metadata.json
83
83
  - lib/vagrant-vmware-esxi.rb
84
84
  - lib/vagrant-vmware-esxi/action.rb
85
+ - lib/vagrant-vmware-esxi/action/address.rb
85
86
  - lib/vagrant-vmware-esxi/action/boot.rb
86
87
  - lib/vagrant-vmware-esxi/action/createvm.rb
87
88
  - lib/vagrant-vmware-esxi/action/destroy.rb