vagrant-vmware-esxi 2.2.0 → 2.2.1

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: 5335d542dafabd92713684c827886ac3c203f856
4
- data.tar.gz: 4d13033de5ad8d8295e6e0f733d3d1523fe89d22
3
+ metadata.gz: 60c2145e05970afe201403ae42692fd057e282d5
4
+ data.tar.gz: 5eb2e6c0f233ebd61e73c2208c0635b641f520b5
5
5
  SHA512:
6
- metadata.gz: 36030dddf5555de12bf60b7fd2b8af9bae47b4cfca5616af885db87b1f07e2256c01e112fc98fe6e6086feecfbed5c9dcc2923f15b64f7a929a2991e7d47097b
7
- data.tar.gz: b148ae7cb8066bddd881bb053cf869510961dd6aa54e5b57f9e867697ee74101712efbbfbf57773a18166739196244ccee028ee6dae5f07d731ae4f77b51df42
6
+ metadata.gz: 3eb8c8b5d115abedc55d518b42f11a85eba4614b5df7d5b524e21037b4f8ac0fb95887a9ac9b62ac3974ae43d6ccfad380462f831fb6e62b2b391e834995b22c
7
+ data.tar.gz: cf88a86b99ff57ec19d70f686a2b9b529f474d18c42ac971b46d4bff99b4875783cb54eab273e2de5e6852b89e4cb506c7011f7670fa34e6d414a6a8ccc8a745
data/README.md CHANGED
@@ -271,13 +271,18 @@ Known issues with vmware_esxi
271
271
  * 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...
272
272
  * 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.
273
273
  * Cygwin & gitbash have console issues. Ruby module io/console does not have support. https://github.com/ruby/io-console/issues/2
274
+ * Setting the hostname might fail on some boxes. Use most recent version of Vagrant for best results.
274
275
 
275
276
 
276
277
  Version History
277
278
  ---------------
279
+ * 2.2.1 Fix, clone_from_vm not working on MAC.
280
+ Fix, enabled SetHostname.
281
+ Fix, Multimachine not working with multiple esxi hosts and different passwords.
282
+
278
283
  * 2.2.0 Add support to extend boot disk size.
279
284
  Fix, add many more special characters to encode in esxi passwords.
280
-
285
+
281
286
  * 2.1.0 Add support for clone_from_vm.
282
287
  Fix, use esxcli to get storage information.
283
288
 
@@ -35,7 +35,7 @@ module VagrantPlugins
35
35
  message: 'Cannot boot in this state')
36
36
  else
37
37
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
38
- password: $esxi_password,
38
+ password: config.esxi_password,
39
39
  port: config.esxi_hostport,
40
40
  keys: config.local_private_keys,
41
41
  timeout: 20,
@@ -42,10 +42,7 @@ module VagrantPlugins
42
42
  end
43
43
 
44
44
  # Set desired_guest_name
45
- if !env[:machine].config.vm.hostname.nil?
46
- # A hostname has been set, so use it.
47
- desired_guest_name = env[:machine].config.vm.hostname.dup
48
- elsif config.guest_name.nil?
45
+ if env[:machine].config.vm.hostname.nil? && config.guest_name.nil?
49
46
  # Nothing set, so generate our own
50
47
  desired_guest_name = config.guest_name_prefix.strip
51
48
  desired_guest_name << `hostname`.partition('.').first.strip
@@ -54,9 +51,10 @@ module VagrantPlugins
54
51
  desired_guest_name << '-'
55
52
  base = File.basename machine.env.cwd.to_s
56
53
  desired_guest_name << base
57
- config.guest_name = desired_guest_name
54
+ elsif !env[:machine].config.vm.hostname.nil? && config.guest_name.nil?
55
+ desired_guest_name = env[:machine].config.vm.hostname.dup
58
56
  else
59
- # A guest_name has been set, so use it.
57
+ # Both are set, or only guest_name. So, we'll choose guest_name.
60
58
  desired_guest_name = config.guest_name.strip
61
59
  end
62
60
  desired_guest_name = desired_guest_name[0..252].gsub(/_/,'-').gsub(/[^0-9A-Za-z\-\.]/i, '').strip
@@ -77,11 +75,26 @@ module VagrantPlugins
77
75
  raise Errors::GeneralError,
78
76
  message: "Unable to create tmp dir #{tmpdir}"
79
77
  end
78
+
79
+ ovf_debug = '--X:logLevel=info --X:logToConsole' if config.debug =~ %r{ovftool}i
80
80
  #
81
81
  # Source from Clone
82
- clone_from_vm_path = "vi://#{config.esxi_username}:#{$encoded_esxi_password}@#{config.esxi_hostname}/#{config.clone_from_vm}"
83
- ovf_cmd = "ovftool --noSSLVerify --overwrite --powerOffTarget --noDisks --targetType=vmx "\
84
- "#{clone_from_vm_path} #{tmpdir}"
82
+ clone_from_vm_path = "vi://#{config.esxi_username}:#{config.encoded_esxi_password}@#{config.esxi_hostname}/#{config.clone_from_vm}"
83
+ ovf_cmd = "ovftool --noSSLVerify --overwrite --X:useMacNaming=false "\
84
+ "--powerOffTarget --noDisks --targetType=vmx #{ovf_debug} "\
85
+ "#{clone_from_vm_path} #{tmpdir}"
86
+ if config.debug =~ %r{password}i
87
+ @logger.info("vagrant-vmware-esxi, createvm: ovf_cmd #{ovf_cmd}")
88
+ puts "ovftool command: #{ovf_cmd}"
89
+ elsif config.debug =~ %r{true}i
90
+ if config.encoded_esxi_password == ''
91
+ ovf_cmd_nopw = ovf_cmd
92
+ else
93
+ ovf_cmd_nopw = ovf_cmd.gsub(/#{config.encoded_esxi_password}/, '******')
94
+ end
95
+ puts "ovftool command: #{ovf_cmd_nopw}"
96
+ end
97
+
85
98
  unless system "#{ovf_cmd}"
86
99
  raise Errors::OVFToolError,
87
100
  message: "Unable to access #{config.clone_from_vm}"
@@ -99,7 +112,7 @@ module VagrantPlugins
99
112
  # Open the network connection
100
113
  #
101
114
  Net::SSH.start( config.esxi_hostname, config.esxi_username,
102
- password: $esxi_password,
115
+ password: config.esxi_password,
103
116
  port: config.esxi_hostport,
104
117
  keys: config.local_private_keys,
105
118
  timeout: 20,
@@ -491,11 +504,11 @@ module VagrantPlugins
491
504
  else
492
505
  src_path = clone_from_vm_path
493
506
  end
494
- ovf_cmd = "ovftool --noSSLVerify #{overwrite_opts} "\
507
+ ovf_cmd = "ovftool --noSSLVerify #{overwrite_opts} #{ovf_debug} "\
495
508
  "-dm=#{guest_disk_type} #{local_laxoption} "\
496
509
  "-ds=\"#{@guestvm_dsname}\" --name=\"#{desired_guest_name}\" "\
497
510
  "\"#{src_path}\" vi://#{config.esxi_username}:"\
498
- "#{$encoded_esxi_password}@#{config.esxi_hostname}"\
511
+ "#{config.encoded_esxi_password}@#{config.esxi_hostname}"\
499
512
  "#{esxi_resource_pool}"
500
513
 
501
514
  #
@@ -505,10 +518,10 @@ module VagrantPlugins
505
518
  @logger.info("vagrant-vmware-esxi, createvm: ovf_cmd #{ovf_cmd}")
506
519
  puts "ovftool command: #{ovf_cmd}"
507
520
  elsif config.debug =~ %r{true}i
508
- if $encoded_esxi_password == ''
521
+ if config.encoded_esxi_password == ''
509
522
  ovf_cmd_nopw = ovf_cmd
510
523
  else
511
- ovf_cmd_nopw = ovf_cmd.gsub(/#{$encoded_esxi_password}/, '******')
524
+ ovf_cmd_nopw = ovf_cmd.gsub(/#{config.encoded_esxi_password}/, '******')
512
525
  end
513
526
  puts "ovftool command: #{ovf_cmd_nopw}"
514
527
  end
@@ -530,7 +543,7 @@ module VagrantPlugins
530
543
  # to vmx file.
531
544
  #
532
545
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
533
- password: $esxi_password,
546
+ password: config.esxi_password,
534
547
  port: config.esxi_hostport,
535
548
  keys: config.local_private_keys,
536
549
  timeout: 20,
@@ -34,7 +34,7 @@ module VagrantPlugins
34
34
  message: 'Guest VM should have been powered off...'
35
35
  else
36
36
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
37
- password: $esxi_password,
37
+ password: config.esxi_password,
38
38
  port: config.esxi_hostport,
39
39
  keys: config.local_private_keys,
40
40
  timeout: 20,
@@ -25,16 +25,16 @@ module VagrantPlugins
25
25
  config = env[:machine].provider_config
26
26
 
27
27
  #
28
- # Set global variable $esxi_password
28
+ # Set global variable config.esxi_password
29
29
  #
30
- if $esxi_password.nil?
30
+ if config.encoded_esxi_password.nil?
31
31
  if config.esxi_password =~ %r{^prompt:}i
32
32
  #
33
33
  # Prompt for password
34
34
  #
35
35
  begin
36
36
  print "#{config.esxi_username}@#{config.esxi_hostname} password:"
37
- $esxi_password = STDIN.noecho(&:gets).chomp
37
+ config.esxi_password = STDIN.noecho(&:gets).chomp
38
38
  puts ''
39
39
  rescue
40
40
  begin
@@ -46,7 +46,7 @@ module VagrantPlugins
46
46
  puts 'is a problem for you, ctrl-C / [ENTER] to exit and fix your stdin.'
47
47
  puts ''
48
48
  print "#{config.esxi_username}@#{config.esxi_hostname} password:"
49
- $esxi_password = $stdin.readline().chomp
49
+ config.esxi_password = $stdin.readline().chomp
50
50
  puts ''
51
51
  rescue
52
52
  raise Errors::ESXiError,
@@ -63,7 +63,7 @@ module VagrantPlugins
63
63
  end
64
64
  begin
65
65
  stdin_pw = ENV[esxi_password_env]
66
- $esxi_password = stdin_pw.chomp
66
+ config.esxi_password = stdin_pw.chomp
67
67
  rescue
68
68
  raise Errors::ESXiError,
69
69
  message: "Unable to read environment variable: #{esxi_password_env}"
@@ -84,7 +84,7 @@ module VagrantPlugins
84
84
  fh = File.open(File.expand_path(esxi_password_file))
85
85
  file_pw = fh.readline
86
86
  fh.close
87
- $esxi_password = file_pw.chomp
87
+ config.esxi_password = file_pw.chomp
88
88
  else
89
89
  raise Errors::ESXiError, message: "Unable to open #{esxi_password_file}"
90
90
  end
@@ -95,20 +95,19 @@ module VagrantPlugins
95
95
  #
96
96
  # use ssh keys
97
97
  #
98
- $esxi_password = ''
99
98
  esxi_password_key = config.esxi_password.gsub(/key:/i, '').chomp
99
+ config.esxi_password = ''
100
100
  unless esxi_password_key.empty?
101
101
  config.local_private_keys = esxi_password_key
102
102
  end
103
103
  else
104
104
  # Use plain text password from config
105
- $esxi_password = config.esxi_password
106
105
  end
107
106
 
108
107
  #
109
108
  # Encode special characters in PW
110
109
  #
111
- $encoded_esxi_password = $esxi_password.gsub('%', '%25').\
110
+ config.encoded_esxi_password = config.esxi_password.gsub('%', '%25').\
112
111
  gsub(' ', '%20').\
113
112
  gsub('!', '%21').\
114
113
  gsub('"', '%22').\
@@ -140,7 +139,7 @@ module VagrantPlugins
140
139
  gsub('{', '%7b').\
141
140
  gsub('|', '%7c').\
142
141
  gsub('}', '%7d').\
143
- gsub('~', '%7e')
142
+ gsub('~', '%7e')
144
143
 
145
144
  @logger.info('vagrant-vmware-esxi, connect_esxi: local_private_keys: '\
146
145
  "#{config.local_private_keys}")
@@ -151,9 +150,9 @@ module VagrantPlugins
151
150
  begin
152
151
  puts "RUBY_PLATFORM: #{RUBY_PLATFORM}" if config.debug =~ %r{true}i
153
152
  puts "Testing esxi connectivity" if config.debug =~ %r{ip}i
154
- puts "esxi_ssh_keys: #{config.local_private_keys}" if config.debug =~ %r{ip}i
153
+ puts "esxi_ssh_keys: #{config.local_private_keys}" if config.debug =~ %r{password}i
155
154
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
156
- password: $esxi_password,
155
+ password: config.esxi_password,
157
156
  port: config.esxi_hostport,
158
157
  keys: config.local_private_keys,
159
158
  timeout: 20,
@@ -29,7 +29,7 @@ module VagrantPlugins
29
29
  env[:ui].info I18n.t('vagrant_vmware_esxi.already_destroyed')
30
30
  else
31
31
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
32
- password: $esxi_password,
32
+ password: config.esxi_password,
33
33
  port: config.esxi_hostport,
34
34
  keys: config.local_private_keys,
35
35
  timeout: 20,
@@ -94,7 +94,7 @@ module VagrantPlugins
94
94
 
95
95
  ovf_cmd = "ovftool --noSSLVerify -tt=VMX --name=\"#{boxname}\" "\
96
96
  "#{overwrite_opts} vi://#{config.esxi_username}:"\
97
- "#{$encoded_esxi_password}@#{config.esxi_hostname}"\
97
+ "#{config.encoded_esxi_password}@#{config.esxi_hostname}"\
98
98
  "?moref=vim.VirtualMachine:#{machine.id} #{tmpdir}"
99
99
 
100
100
  unless system "#{ovf_cmd}"
@@ -42,7 +42,7 @@ module VagrantPlugins
42
42
 
43
43
  # Figure out vm_ipaddress
44
44
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
45
- password: $esxi_password,
45
+ password: config.esxi_password,
46
46
  port: config.esxi_hostport,
47
47
  keys: config.local_private_keys,
48
48
  timeout: 20,
@@ -77,7 +77,7 @@ module VagrantPlugins
77
77
  @logger.info("vagrant-vmware-esxi, read_state: current state: #{env[:machine_state]}")
78
78
 
79
79
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
80
- password: $esxi_password,
80
+ password: config.esxi_password,
81
81
  port: config.esxi_hostport,
82
82
  keys: config.local_private_keys,
83
83
  timeout: 20,
@@ -39,7 +39,7 @@ module VagrantPlugins
39
39
 
40
40
  #
41
41
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
42
- password: $esxi_password,
42
+ password: config.esxi_password,
43
43
  port: config.esxi_hostport,
44
44
  keys: config.local_private_keys,
45
45
  timeout: 20,
@@ -31,7 +31,7 @@ module VagrantPlugins
31
31
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
32
32
  message: "Starting graceful shutdown...")
33
33
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
34
- password: $esxi_password,
34
+ password: config.esxi_password,
35
35
  port: config.esxi_hostport,
36
36
  keys: config.local_private_keys,
37
37
  timeout: 20,
@@ -35,7 +35,7 @@ module VagrantPlugins
35
35
 
36
36
  #
37
37
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
38
- password: $esxi_password,
38
+ password: config.esxi_password,
39
39
  port: config.esxi_hostport,
40
40
  keys: config.local_private_keys,
41
41
  timeout: 20,
@@ -32,7 +32,7 @@ module VagrantPlugins
32
32
  else
33
33
 
34
34
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
35
- password: $esxi_password,
35
+ password: config.esxi_password,
36
36
  port: config.esxi_hostport,
37
37
  keys: config.local_private_keys,
38
38
  timeout: 20,
@@ -32,7 +32,7 @@ module VagrantPlugins
32
32
  else
33
33
 
34
34
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
35
- password: $esxi_password,
35
+ password: config.esxi_password,
36
36
  port: config.esxi_hostport,
37
37
  keys: config.local_private_keys,
38
38
  timeout: 20,
@@ -35,7 +35,7 @@ module VagrantPlugins
35
35
 
36
36
  #
37
37
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
38
- password: $esxi_password,
38
+ password: config.esxi_password,
39
39
  port: config.esxi_hostport,
40
40
  keys: config.local_private_keys,
41
41
  timeout: 20,
@@ -36,7 +36,7 @@ module VagrantPlugins
36
36
 
37
37
  #
38
38
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
39
- password: $esxi_password,
39
+ password: config.esxi_password,
40
40
  port: config.esxi_hostport,
41
41
  keys: config.local_private_keys,
42
42
  timeout: 20,
@@ -38,7 +38,7 @@ module VagrantPlugins
38
38
 
39
39
  #
40
40
  Net::SSH.start(config.esxi_hostname, config.esxi_username,
41
- password: $esxi_password,
41
+ password: config.esxi_password,
42
42
  port: config.esxi_hostport,
43
43
  keys: config.local_private_keys,
44
44
  timeout: 20,
@@ -160,7 +160,7 @@ module VagrantPlugins
160
160
  b1.use Provision
161
161
  b1.use SyncedFolderCleanup
162
162
  b1.use SyncedFolders
163
- #b1.use SetHostname # Still too buggy. Tested with vagrant 2.0.4dev
163
+ b1.use SetHostname
164
164
  end
165
165
  end
166
166
  end
@@ -8,6 +8,7 @@ module VagrantPlugins
8
8
  attr_accessor :esxi_hostport
9
9
  attr_accessor :esxi_username
10
10
  attr_accessor :esxi_password
11
+ attr_accessor :encoded_esxi_password
11
12
  attr_accessor :esxi_disk_store
12
13
  attr_accessor :esxi_virtual_network
13
14
  attr_accessor :esxi_resource_pool
@@ -31,14 +32,12 @@ module VagrantPlugins
31
32
  attr_accessor :local_allow_overwrite
32
33
  attr_accessor :local_lax
33
34
  attr_accessor :local_use_ip_cache
34
- attr_accessor :local_private_keys_path
35
35
  attr_accessor :debug
36
36
  attr_accessor :supported_guest_virtualhw_versions
37
37
  attr_accessor :supported_guest_disk_types
38
38
  attr_accessor :supported_guest_nic_types
39
39
  attr_accessor :supported_guest_guestos
40
40
  attr_accessor :saved_ipaddress
41
- attr_accessor :saved_ipaddress_count
42
41
 
43
42
  #
44
43
  # legacy (1.x) config entries
@@ -65,6 +64,7 @@ module VagrantPlugins
65
64
  @esxi_hostport = 22
66
65
  @esxi_username = 'root'
67
66
  @esxi_password = nil
67
+ @encoded_esxi_password = nil
68
68
  @esxi_disk_store = nil
69
69
  @esxi_virtual_network = nil
70
70
  @esxi_resource_pool = nil
@@ -90,15 +90,6 @@ module VagrantPlugins
90
90
  @local_use_ip_cache = 'True'
91
91
  @debug = 'False'
92
92
  @saved_ipaddress = nil
93
- @saved_ipaddress_count = 0
94
- @system_private_keys = [
95
- '~/.ssh/id_rsa',
96
- '~/.ssh/id_ecdsa',
97
- '~/.ssh/id_dsa'
98
- ]
99
- #'~/.ssh/id_ed25519',
100
- # Removed support for ed25519 because libsodium is not compatible with windows.
101
- # Should be added back when net-ssh 5.0 is out of beta.
102
93
  @supported_guest_virtualhw_versions = [
103
94
  4,7,8,9,10,11,12,13
104
95
  ]
@@ -365,6 +356,7 @@ module VagrantPlugins
365
356
  end
366
357
 
367
358
  @guest_username = nil if @guest_username == UNSET_VALUE
359
+ @encoded_esxi_password = nil
368
360
 
369
361
  @guest_boot_disk_size = @guest_boot_disk_size.to_i if @guest_boot_disk_size.is_a? String
370
362
  @guest_boot_disk_size = nil if @guest_boot_disk_size == 0
@@ -375,8 +367,14 @@ module VagrantPlugins
375
367
 
376
368
  @esxi_virtual_network = ['--NotSet--'] if @esxi_virtual_network.nil?
377
369
 
378
- @local_private_keys = @system_private_keys if @local_private_keys == nil
379
-
370
+ @local_private_keys = [
371
+ '~/.ssh/id_rsa',
372
+ '~/.ssh/id_ecdsa',
373
+ '~/.ssh/id_dsa'
374
+ ]
375
+ #'~/.ssh/id_ed25519',
376
+ # Removed support for ed25519 because libsodium is not compatible with windows.
377
+ # Should be added back when net-ssh 5.0 is out of beta.
380
378
 
381
379
  if @local_lax =~ /true/i
382
380
  @local_lax = 'True'
@@ -400,6 +398,7 @@ module VagrantPlugins
400
398
  else
401
399
  @guest_snapshot_quiesced = ''
402
400
  end
401
+ @saved_ipaddress = nil
403
402
 
404
403
  end
405
404
  end
@@ -1,7 +1,7 @@
1
1
  # VERSION
2
2
  module VagrantPlugins
3
3
  module ESXi
4
- VERSION = '2.2.0'
4
+ VERSION = '2.2.1'
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-04-13'
6
+ s.date = '2018-04-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.2.0
4
+ version: 2.2.1
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-04-13 00:00:00.000000000 Z
11
+ date: 2018-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n