vmpooler-provider-vsphere 2.1.0 → 3.1.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
  SHA256:
3
- metadata.gz: e7facc5944e6f5a919f916566cd3399a762381f3b046dcd46739ceab2ef72b37
4
- data.tar.gz: d8afc51cbd6aa0bfdc195d17403c4908f93733b9998d2ed4663c7243d8bc32b9
3
+ metadata.gz: fa975e899d87bb13db4a666994ba9aab6795b90f77e4fa82fc1ab2f593ff9df4
4
+ data.tar.gz: b71765cf7c70a82ab6a170661c00783f5c140cd72e2d42587e37431a902479c8
5
5
  SHA512:
6
- metadata.gz: 8ee5e106fe90c9e26068af66a1456fda16ffd0932f1f132ff08927fb7efe5a3e0c0af62c212a2b5945605791cedb2d54b3130115ff1190740bb8c1d0547da650
7
- data.tar.gz: 789357d7be7a20a7974c365c86564fc53721c67e4e86cfbc111f9c3c8f1e6f6b9c9650b8f974a747d50e92cb2338868fa4d78e787b32c1d7a0eab5e909c2329e
6
+ metadata.gz: 3c3b57116ad877e205f601ee52b239b3ab7bec57da02ee29272b54dee8b3604bbe653165279f37182337b637b0d5746145fe7dba27a20f7f0f5328e9b986c8f6
7
+ data.tar.gz: 4943b690045a60941b7b9cdf760fb702cb0b78e44c2e4cd3ca2b984d6a568c83b872b97abe2b0162c6518b7c34dd92a58dbd28d4afe629c5df7f50d49b48d32d
@@ -51,6 +51,11 @@ module Vmpooler
51
51
  'vsphere'
52
52
  end
53
53
 
54
+ def domain(pool_name)
55
+ dns_plugin_name = pool_config(pool_name)['dns_plugin']
56
+ dns_config(dns_plugin_name)
57
+ end
58
+
54
59
  def folder_configured?(folder_title, base_folder, configured_folders, allowlist)
55
60
  return true if allowlist&.include?(folder_title)
56
61
  return false unless configured_folders.keys.include?(folder_title)
@@ -387,6 +392,16 @@ module Vmpooler
387
392
  vm_hash
388
393
  end
389
394
 
395
+ # The inner method requires vmware tools running in the guest os
396
+ def get_vm_ip_address(vm_name, pool_name)
397
+ @connection_pool.with_metrics do |pool_object|
398
+ connection = ensured_vsphere_connection(pool_object)
399
+ vm_object = find_vm(pool_name, vm_name, connection)
400
+ vm_hash = generate_vm_hash(vm_object, pool_name)
401
+ return vm_hash['ip']
402
+ end
403
+ end
404
+
390
405
  def create_config_spec(vm_name, template_name, extra_config)
391
406
  RbVmomi::VIM.VirtualMachineConfigSpec(
392
407
  annotation: JSON.pretty_generate(
@@ -540,9 +555,10 @@ module Vmpooler
540
555
  true
541
556
  end
542
557
 
543
- def vm_ready?(_pool_name, vm_name)
558
+ def vm_ready?(pool_name, vm_name)
544
559
  begin
545
- open_socket(vm_name, global_config[:config]['domain'])
560
+ domain = domain(pool_name)
561
+ open_socket(vm_name, domain)
546
562
  rescue StandardError => _e
547
563
  return false
548
564
  end
@@ -582,13 +598,28 @@ module Vmpooler
582
598
  boottime = vm_object.runtime.bootTime if vm_object.runtime&.bootTime
583
599
  powerstate = vm_object.runtime.powerState if vm_object.runtime&.powerState
584
600
 
601
+ ip_maxloop = 60
602
+ ip_loop_delay = 1
603
+ ip_loop_count = 1
604
+ ip = nil
605
+ while ip.nil?
606
+ sleep(ip_loop_delay)
607
+ ip = vm_object.guest_ip
608
+ unless ip_maxloop == 0
609
+ break if ip_loop_count >= ip_maxloop
610
+
611
+ ip_loop_count += 1
612
+ end
613
+ end
614
+
585
615
  {
586
616
  'name' => vm_object.name,
587
617
  'hostname' => hostname,
588
618
  'template' => pool_configuration['template'],
589
619
  'poolname' => pool_name,
590
620
  'boottime' => boottime,
591
- 'powerstate' => powerstate
621
+ 'powerstate' => powerstate,
622
+ 'ip' => ip
592
623
  }
593
624
  end
594
625
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VmpoolerProviderVsphere
4
- VERSION = '2.1.0'
4
+ VERSION = '3.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmpooler-provider-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-06 00:00:00.000000000 Z
11
+ date: 2023-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - "~>"
37
37
  - !ruby/object:Gem::Version
38
- version: '2.4'
38
+ version: '3.0'
39
39
  name: vmpooler
40
40
  prerelease: false
41
41
  type: :runtime
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '2.4'
46
+ version: '3.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements: