knife-vsphere 4.1.1 → 4.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chef/knife/{base_vsphere_command.rb → helpers/base_vsphere_command.rb} +1 -1
  3. data/lib/chef/knife/{customization_helper.rb → helpers/customization_helper.rb} +0 -0
  4. data/lib/chef/knife/{search_helper.rb → helpers/search_helper.rb} +0 -0
  5. data/lib/chef/knife/vsphere_cluster_list.rb +5 -1
  6. data/lib/chef/knife/vsphere_cpu_ratio.rb +5 -1
  7. data/lib/chef/knife/vsphere_customization_list.rb +5 -1
  8. data/lib/chef/knife/vsphere_datastore_file.rb +5 -1
  9. data/lib/chef/knife/vsphere_datastore_list.rb +5 -1
  10. data/lib/chef/knife/vsphere_datastore_maxfree.rb +5 -1
  11. data/lib/chef/knife/vsphere_datastorecluster_list.rb +5 -1
  12. data/lib/chef/knife/vsphere_datastorecluster_maxfree.rb +5 -1
  13. data/lib/chef/knife/vsphere_folder_list.rb +5 -1
  14. data/lib/chef/knife/vsphere_hosts_list.rb +2 -2
  15. data/lib/chef/knife/vsphere_pool_list.rb +5 -1
  16. data/lib/chef/knife/vsphere_pool_query.rb +3 -3
  17. data/lib/chef/knife/vsphere_pool_show.rb +3 -3
  18. data/lib/chef/knife/vsphere_template_list.rb +7 -3
  19. data/lib/chef/knife/vsphere_vlan_create.rb +5 -1
  20. data/lib/chef/knife/vsphere_vlan_list.rb +5 -1
  21. data/lib/chef/knife/vsphere_vm_cdrom.rb +13 -9
  22. data/lib/chef/knife/vsphere_vm_clone.rb +9 -9
  23. data/lib/chef/knife/vsphere_vm_config.rb +7 -3
  24. data/lib/chef/knife/vsphere_vm_delete.rb +5 -3
  25. data/lib/chef/knife/vsphere_vm_disk_extend.rb +7 -3
  26. data/lib/chef/knife/vsphere_vm_disk_list.rb +7 -4
  27. data/lib/chef/knife/vsphere_vm_execute.rb +7 -4
  28. data/lib/chef/knife/vsphere_vm_find.rb +7 -3
  29. data/lib/chef/knife/vsphere_vm_list.rb +5 -1
  30. data/lib/chef/knife/vsphere_vm_markastemplate.rb +7 -3
  31. data/lib/chef/knife/vsphere_vm_migrate.rb +7 -3
  32. data/lib/chef/knife/vsphere_vm_move.rb +7 -3
  33. data/lib/chef/knife/vsphere_vm_net.rb +8 -3
  34. data/lib/chef/knife/vsphere_vm_network_add.rb +7 -3
  35. data/lib/chef/knife/vsphere_vm_network_delete.rb +7 -3
  36. data/lib/chef/knife/vsphere_vm_network_list.rb +7 -3
  37. data/lib/chef/knife/vsphere_vm_network_set.rb +7 -3
  38. data/lib/chef/knife/vsphere_vm_property_get.rb +8 -4
  39. data/lib/chef/knife/vsphere_vm_property_set.rb +9 -5
  40. data/lib/chef/knife/vsphere_vm_show.rb +8 -4
  41. data/lib/chef/knife/vsphere_vm_snapshot.rb +7 -3
  42. data/lib/chef/knife/vsphere_vm_state.rb +7 -3
  43. data/lib/chef/knife/vsphere_vm_toolsconfig.rb +8 -3
  44. data/lib/chef/knife/vsphere_vm_vmdk_add.rb +7 -3
  45. data/lib/chef/knife/vsphere_vm_vnc_set.rb +7 -3
  46. data/lib/chef/knife/vsphere_vm_wait_sysprep.rb +7 -5
  47. data/lib/knife-vsphere/version.rb +1 -1
  48. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cfe5c1c1b9116075b77a7b236b0bc2c68941f8cbe0fd0709e2aac00222242e4
4
- data.tar.gz: a55ed4ac26a65cc58652220f09867d5086ce18114d7d94d282d283ce91f2683f
3
+ metadata.gz: 307f7c1cd017840eedf083fc9100f88db74a408dd9c9bcd08c7b2a401851f8b4
4
+ data.tar.gz: 3b35e982f80c555bca6be48b81f7379b49f57ec6d261bd06c016af5d7039c606
5
5
  SHA512:
6
- metadata.gz: 5556739494250e3b82eae764a0eae727c879df643dfc0708e9521fe75476546254c63c4167fb17fc7a7aa1eca007a62f6b418f5664292b38dc18029571a38a8d
7
- data.tar.gz: 2daac5962badbc2b10ba6477f6da3a1ba45eecd86699455fd2bbf9f33ded3f0acc0011c125a4653370b8d7bd30ce585ad59baad6391060e680a47c0f65e19ecb
6
+ metadata.gz: d5b7d2579d4dfd42b376ea7617e293275804e05d24472b6f8c89ce014011c733d6f5d327b22cb6f4b8b0fde681d4a048e878be67e67da650e5e9b605fcd6f98b
7
+ data.tar.gz: 20498b9a638555471299bdece10201351ff16c0757d8057bc8a8fccae0bdfe48f72f0538661a880ef3d9d000b778cb5e9d500ce1cd4f3d391079bd3b1689b5da
@@ -5,7 +5,6 @@
5
5
  #
6
6
 
7
7
  require "chef/knife"
8
- require "rbvmomi"
9
8
  require "chef/knife/bootstrap"
10
9
 
11
10
  # Power state on
@@ -22,6 +21,7 @@ class Chef
22
21
  # Main knife vsphere that more or less everything in this gem is built off of
23
22
  class BaseVsphereCommand < Chef::Knife::Bootstrap
24
23
  deps do
24
+ require "rbvmomi"
25
25
  Chef::Knife::Bootstrap.load_deps
26
26
  require "base64"
27
27
  require "filesize"
@@ -4,12 +4,16 @@
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  require "chef/knife"
7
- require_relative "base_vsphere_command"
7
+ require_relative "helpers/base_vsphere_command"
8
8
 
9
9
  # Lists all known clusters in the configured datacenter
10
10
  class Chef::Knife::VsphereClusterList < Chef::Knife::BaseVsphereCommand
11
11
  banner "knife vsphere cluster list"
12
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ end
16
+
13
17
  common_options
14
18
 
15
19
  def traverse_folders(folder)
@@ -1,10 +1,14 @@
1
1
  require "chef/knife"
2
- require_relative "base_vsphere_command"
2
+ require_relative "helpers/base_vsphere_command"
3
3
 
4
4
  # VsphereCpuratio extends the BaseVspherecommand
5
5
  class Chef::Knife::VsphereCpuRatio < Chef::Knife::BaseVsphereCommand
6
6
  banner "knife vsphere cpu ratio [CLUSTER] [HOST]"
7
7
 
8
+ deps do
9
+ Chef::Knife::BaseVsphereCommand.load_deps
10
+ end
11
+
8
12
  common_options
9
13
 
10
14
  # The main run method for cpu_ratio
@@ -3,13 +3,17 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
6
+ require_relative "helpers/base_vsphere_command"
7
7
 
8
8
  # Lists all customization specifications in the configured datacenter
9
9
  # VsphereCustomizationlist extends the BaseVspherecommand
10
10
  class Chef::Knife::VsphereCustomizationList < Chef::Knife::BaseVsphereCommand
11
11
  banner "knife vsphere customization list"
12
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ end
16
+
13
17
  common_options
14
18
 
15
19
  # The main run method for customization_list
@@ -1,12 +1,16 @@
1
1
 
2
2
  require "chef/knife"
3
- require_relative "base_vsphere_command"
3
+ require_relative "helpers/base_vsphere_command"
4
4
 
5
5
  # Upload or download a file from a datastore
6
6
  # VsphereDatastoreFile extends the BaseVspherecommand
7
7
  class Chef::Knife::VsphereDatastoreFile < Chef::Knife::BaseVsphereCommand
8
8
  banner "knife vsphere datastore file"
9
9
 
10
+ deps do
11
+ Chef::Knife::BaseVsphereCommand.load_deps
12
+ end
13
+
10
14
  common_options
11
15
 
12
16
  option :local_file,
@@ -16,13 +16,17 @@
16
16
  # PERFORMANCE OF THIS SOFTWARE
17
17
 
18
18
  require "chef/knife"
19
- require_relative "base_vsphere_command"
19
+ require_relative "helpers/base_vsphere_command"
20
20
 
21
21
  # Lists all known data stores in datacenter with sizes
22
22
  # VsphereDatastorelist extends the BaseVspherecommand
23
23
  class Chef::Knife::VsphereDatastoreList < Chef::Knife::BaseVsphereCommand
24
24
  banner "knife vsphere datastore list"
25
25
 
26
+ deps do
27
+ Chef::Knife::BaseVsphereCommand.load_deps
28
+ end
29
+
26
30
  common_options
27
31
 
28
32
  option :list,
@@ -16,13 +16,17 @@
16
16
  # PERFORMANCE OF THIS SOFTWARE
17
17
 
18
18
  require "chef/knife"
19
- require_relative "base_vsphere_command"
19
+ require_relative "helpers/base_vsphere_command"
20
20
 
21
21
  # Gets the data store with the most free space in datacenter
22
22
  # VsphereDatastoreMaxfree extends the BaseVspherecommand
23
23
  class Chef::Knife::VsphereDatastoreMaxfree < Chef::Knife::BaseVsphereCommand
24
24
  banner "knife vsphere datastore maxfree"
25
25
 
26
+ deps do
27
+ Chef::Knife::BaseVsphereCommand.load_deps
28
+ end
29
+
26
30
  option :regex,
27
31
  short: "-r REGEX",
28
32
  long: "--regex REGEX",
@@ -16,7 +16,7 @@
16
16
  # PERFORMANCE OF THIS SOFTWARE
17
17
 
18
18
  require "chef/knife"
19
- require_relative "base_vsphere_command"
19
+ require_relative "helpers/base_vsphere_command"
20
20
 
21
21
  def number_to_human_size(number)
22
22
  number = number.to_f
@@ -56,6 +56,10 @@ end
56
56
  class Chef::Knife::VsphereDatastoreclusterList < Chef::Knife::BaseVsphereCommand
57
57
  banner "knife vsphere datastorecluster list"
58
58
 
59
+ deps do
60
+ Chef::Knife::BaseVsphereCommand.load_deps
61
+ end
62
+
59
63
  common_options
60
64
 
61
65
  def run
@@ -16,7 +16,7 @@
16
16
  # PERFORMANCE OF THIS SOFTWARE
17
17
 
18
18
  require "chef/knife"
19
- require_relative "base_vsphere_command"
19
+ require_relative "helpers/base_vsphere_command"
20
20
 
21
21
  def max_dscluster(dscluster, max_dscluster)
22
22
  return true unless max_dscluster
@@ -47,6 +47,10 @@ end
47
47
  class Chef::Knife::VsphereDatastoreclusterMaxfree < Chef::Knife::BaseVsphereCommand
48
48
  banner "knife vsphere datastorecluster maxfree"
49
49
 
50
+ deps do
51
+ Chef::Knife::BaseVsphereCommand.load_deps
52
+ end
53
+
50
54
  option :regex,
51
55
  short: "-r REGEX",
52
56
  long: "--regex REGEX",
@@ -3,13 +3,17 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
6
+ require_relative "helpers/base_vsphere_command"
7
7
 
8
8
  # Lists all vm folders
9
9
  # VsphereFolderlist extends the BaseVspherecommand
10
10
  class Chef::Knife::VsphereFolderList < Chef::Knife::BaseVsphereCommand
11
11
  banner "knife vsphere folder list"
12
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ end
16
+
13
17
  common_options
14
18
 
15
19
  # Walks though the folders to find something
@@ -1,5 +1,5 @@
1
1
  require "chef/knife"
2
- require_relative "base_vsphere_command"
2
+ require_relative "helpers/base_vsphere_command"
3
3
 
4
4
  # list hosts belonging to pool
5
5
  # VsphereHostslist extends the BaseVspherecommand
@@ -7,7 +7,7 @@ class Chef::Knife::VsphereHostsList < Chef::Knife::BaseVsphereCommand
7
7
  banner "knife vsphere hosts list"
8
8
 
9
9
  deps do
10
- require "rbvmomi"
10
+ Chef::Knife::BaseVsphereCommand.load_deps
11
11
  require "netaddr"
12
12
  end
13
13
 
@@ -3,12 +3,16 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
6
+ require_relative "helpers/base_vsphere_command"
7
7
 
8
8
  # Lists all known pools in the configured datacenter
9
9
  class Chef::Knife::VspherePoolList < Chef::Knife::BaseVsphereCommand
10
10
  banner "knife vsphere pool list"
11
11
 
12
+ deps do
13
+ Chef::Knife::BaseVsphereCommand.load_deps
14
+ end
15
+
12
16
  common_options
13
17
 
14
18
  def traverse_folders(folder)
@@ -1,12 +1,12 @@
1
1
  require "chef/knife"
2
- require_relative "base_vsphere_command"
2
+ require_relative "helpers/base_vsphere_command"
3
3
 
4
4
  # VspherePoolQuery extends the BaseVsphereCommand
5
5
  class Chef::Knife::VspherePoolQuery < Chef::Knife::BaseVsphereCommand
6
- banner 'knife vsphere pool query POOLNAME QUERY. See "http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html" for allowed QUERY values.'
6
+ banner 'knife vsphere pool query POOLNAME QUERY. See "https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html" for allowed QUERY values.'
7
7
 
8
8
  deps do
9
- require "rbvmomi"
9
+ Chef::Knife::BaseVsphereCommand.load_deps
10
10
  require "netaddr"
11
11
  end
12
12
 
@@ -1,11 +1,11 @@
1
1
  require "chef/knife"
2
- require_relative "base_vsphere_command"
2
+ require_relative "helpers/base_vsphere_command"
3
3
 
4
4
  class Chef::Knife::VspherePoolShow < Chef::Knife::BaseVsphereCommand
5
- banner 'knife vsphere pool show POOLNAME QUERY. See "http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html" for allowed QUERY values.'
5
+ banner 'knife vsphere pool show POOLNAME QUERY. See "https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html" for allowed QUERY values.'
6
6
 
7
7
  deps do
8
- require "rbvmomi"
8
+ Chef::Knife::BaseVsphereCommand.load_deps
9
9
  require "netaddr"
10
10
  end
11
11
 
@@ -4,15 +4,19 @@
4
4
  #
5
5
 
6
6
  require "chef/knife"
7
- require_relative "base_vsphere_command"
8
- require_relative "search_helper"
7
+ require_relative "helpers/base_vsphere_command"
9
8
 
10
9
  # Lists all known VM templates in the configured datacenter
11
10
  # VsphereTemplatelist extends the BaseVspherecommand
12
11
  class Chef::Knife::VsphereTemplateList < Chef::Knife::BaseVsphereCommand
13
- include SearchHelper
14
12
  banner "knife vsphere template list"
15
13
 
14
+ deps do
15
+ Chef::Knife::BaseVsphereCommand.load_deps
16
+ require_relative "helpers/search_helper"
17
+ include SearchHelper
18
+ end
19
+
16
20
  common_options
17
21
 
18
22
  # The main run method for template_list
@@ -1,11 +1,15 @@
1
1
  require "chef/knife"
2
- require_relative "base_vsphere_command"
2
+ require_relative "helpers/base_vsphere_command"
3
3
 
4
4
  # Lists all known data stores in datacenter with sizes
5
5
  # VsphereVlanCreate extends BaseVspherecommand
6
6
  class Chef::Knife::VsphereVlanCreate < Chef::Knife::BaseVsphereCommand
7
7
  banner "knife vsphere vlan create NAME VID"
8
8
 
9
+ deps do
10
+ Chef::Knife::BaseVsphereCommand.load_deps
11
+ end
12
+
9
13
  common_options
10
14
 
11
15
  option :switch,
@@ -15,13 +15,17 @@
15
15
  # PERFORMANCE OF THIS SOFTWARE
16
16
 
17
17
  require "chef/knife"
18
- require_relative "base_vsphere_command"
18
+ require_relative "helpers/base_vsphere_command"
19
19
 
20
20
  # Lists all known data stores in datacenter with sizes
21
21
  # VsphereVlanlist extends the BaseVspherecommand
22
22
  class Chef::Knife::VsphereVlanList < Chef::Knife::BaseVsphereCommand
23
23
  banner "knife vsphere vlan list"
24
24
 
25
+ deps do
26
+ Chef::Knife::BaseVsphereCommand.load_deps
27
+ end
28
+
25
29
  common_options
26
30
 
27
31
  # The main run method for vlan_list
@@ -1,14 +1,18 @@
1
1
  # License:: Apache License, Version 2.0
2
2
 
3
3
  require "chef/knife"
4
- require_relative "base_vsphere_command"
5
- require_relative "search_helper"
4
+ require_relative "helpers/base_vsphere_command"
6
5
 
7
6
  # VsphereVmCdrom extends the BaseVspherecommand
8
7
  class Chef::Knife::VsphereVmCdrom < Chef::Knife::BaseVsphereCommand
9
- include SearchHelper
10
8
  banner "knife vsphere vm cdrom VMNAME (options)"
11
9
 
10
+ deps do
11
+ Chef::Knife::BaseVsphereCommand.load_deps
12
+ require_relative "helpers/search_helper"
13
+ include SearchHelper
14
+ end
15
+
12
16
  # The empty device name.
13
17
  EMPTY_DEVICE_NAME ||= "".freeze
14
18
 
@@ -66,15 +70,15 @@ class Chef::Knife::VsphereVmCdrom < Chef::Knife::BaseVsphereCommand
66
70
 
67
71
  vm = get_vm_by_name(vmname, get_config(:folder)) || fatal_exit("Could not find #{vmname}")
68
72
 
69
- cdrom_obj = vm.config.hardware.device.find { |hw| hw.class == RbVmomi::VIM::VirtualCdrom }
73
+ cdrom_obj = vm.config.hardware.device.find { |hw| hw.class == ::RbVmomi::VIM::VirtualCdrom }
70
74
  fatal_exit "Could not find a cd drive" unless cdrom_obj
71
75
 
72
76
  backing = if get_config(:attach)
73
- RbVmomi::VIM::VirtualCdromIsoBackingInfo(
77
+ ::RbVmomi::VIM::VirtualCdromIsoBackingInfo(
74
78
  fileName: iso_path
75
79
  )
76
80
  else
77
- RbVmomi::VIM::VirtualCdromRemoteAtapiBackingInfo(deviceName: EMPTY_DEVICE_NAME)
81
+ ::RbVmomi::VIM::VirtualCdromRemoteAtapiBackingInfo(deviceName: EMPTY_DEVICE_NAME)
78
82
  end
79
83
 
80
84
  vm.ReconfigVM_Task(
@@ -85,14 +89,14 @@ class Chef::Knife::VsphereVmCdrom < Chef::Knife::BaseVsphereCommand
85
89
  private
86
90
 
87
91
  def spec(cd_device, backing)
88
- RbVmomi::VIM::VirtualMachineConfigSpec(
92
+ ::RbVmomi::VIM::VirtualMachineConfigSpec(
89
93
  deviceChange: [{
90
94
  operation: :edit,
91
- device: RbVmomi::VIM::VirtualCdrom(
95
+ device: ::RbVmomi::VIM::VirtualCdrom(
92
96
  backing: backing,
93
97
  key: cd_device.key,
94
98
  controllerKey: cd_device.controllerKey,
95
- connectable: RbVmomi::VIM::VirtualDeviceConnectInfo(
99
+ connectable: ::RbVmomi::VIM::VirtualDeviceConnectInfo(
96
100
  startConnected: get_config(:on_boot) || false,
97
101
  connected: get_config(:attach) || false,
98
102
  allowGuestControl: true
@@ -7,20 +7,23 @@
7
7
  #
8
8
 
9
9
  require "chef/knife"
10
- require_relative "base_vsphere_command"
11
- require_relative "search_helper"
10
+ require_relative "helpers/base_vsphere_command"
12
11
 
13
12
  # VsphereVmClone extends the BaseVspherecommand
14
13
  class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand
15
14
  banner "knife vsphere vm clone VMNAME (options)"
16
15
 
17
16
  deps do
17
+ Chef::Knife::BaseVsphereCommand.load_deps
18
18
  require "ipaddr"
19
19
  require "netaddr"
20
20
  require "securerandom"
21
- require_relative "customization_helper"
22
21
  require "chef/json_compat"
23
- Chef::Knife::Bootstrap.load_deps
22
+
23
+ require_relative "helpers/search_helper"
24
+ include SearchHelper
25
+
26
+ require_relative "helpers/customization_helper"
24
27
  include CustomizationHelper
25
28
  end
26
29
 
@@ -31,9 +34,6 @@ class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand
31
34
  # a linklayer origin is an actual nic
32
35
  ORIGIN_IS_REAL_NIC ||= "linklayer".freeze
33
36
 
34
- # include Chef::Knife::WinrmBase
35
- include SearchHelper
36
-
37
37
  common_options
38
38
 
39
39
  option :dest_folder,
@@ -84,7 +84,7 @@ class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand
84
84
 
85
85
  option :customization_plugin_data,
86
86
  long: "--cplugin-data CUST_PLUGIN_DATA",
87
- description: "String of data to pass to the plugin. Use any format you wish."
87
+ description: "String of data to pass to the plugin. Use any format you wish."
88
88
 
89
89
  option :customization_vlan,
90
90
  long: "--cvlan CUST_VLANS",
@@ -716,7 +716,7 @@ class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand
716
716
  if @customization_plugin.respond_to?(:data=)
717
717
  @customization_plugin.data = cplugin_data
718
718
  else
719
- abort "Customization plugin has no :data= accessor to receive the --cplugin-data argument. Define both or neither."
719
+ abort "Customization plugin has no :data= accessor to receive the --cplugin-data argument. Define both or neither."
720
720
  end
721
721
  end
722
722
  else
@@ -2,16 +2,20 @@
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require "chef/knife"
5
- require_relative "base_vsphere_command"
6
- require_relative "search_helper"
5
+ require_relative "helpers/base_vsphere_command"
7
6
 
8
7
  # VsphereVMconfig extends the BaseVspherecommand
9
8
  class Chef::Knife::VsphereVmConfig < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
9
  banner "knife vsphere vm config VMNAME PROPERTY VALUE (PROPERTY VALUE)...
12
10
  See \"https://www.vmware.com/support/developer/converter-sdk/conv60_apireference/vim.vm.ConfigSpec.html\"
13
11
  for allowed ATTRIBUTE values (any property of type xs:string is supported)."
14
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ require_relative "helpers/search_helper"
16
+ include SearchHelper
17
+ end
18
+
15
19
  common_options
16
20
 
17
21
  # The main run method in vm_config
@@ -4,16 +4,18 @@
4
4
  #
5
5
 
6
6
  require "chef/knife"
7
- require_relative "base_vsphere_command"
8
- require_relative "search_helper"
7
+ require_relative "helpers/base_vsphere_command"
9
8
 
10
9
  # Delete a virtual machine from vCenter
11
10
  # VsphereVmDelete extends the BaseVspherecommand
12
11
  class Chef::Knife::VsphereVmDelete < Chef::Knife::BaseVsphereCommand
13
- include SearchHelper
14
12
  banner "knife vsphere vm delete VMNAME (options)"
15
13
 
16
14
  deps do
15
+ Chef::Knife::BaseVsphereCommand.load_deps
16
+ require_relative "helpers/search_helper"
17
+ include SearchHelper
18
+
17
19
  # These two are needed for the '--purge' deletion case
18
20
  require "chef/node"
19
21
  require "chef/api_client"
@@ -4,13 +4,17 @@
4
4
  #
5
5
 
6
6
  require "chef/knife"
7
- require_relative "base_vsphere_command"
8
- require_relative "search_helper"
7
+ require_relative "helpers/base_vsphere_command"
9
8
 
10
9
  class Chef::Knife::VsphereVmDiskExtend < Chef::Knife::BaseVsphereCommand
11
- include SearchHelper
12
10
  banner "knife vsphere vm disk extend VMNAME SIZE. Extends the disk of vm VMNAME to SIZE kilobytes."
13
11
 
12
+ deps do
13
+ Chef::Knife::BaseVsphereCommand.load_deps
14
+ require_relative "helpers/search_helper"
15
+ include SearchHelper
16
+ end
17
+
14
18
  common_options
15
19
 
16
20
  option :diskname,
@@ -1,14 +1,17 @@
1
1
  require "chef/knife"
2
- require_relative "base_vsphere_command"
3
- require_relative "search_helper"
2
+ require_relative "helpers/base_vsphere_command"
4
3
 
5
4
  # List the disks attached to a VM
6
5
  # VsphereVmdisklist extends the BaseVspherecommand
7
6
  class Chef::Knife::VsphereVmDiskList < Chef::Knife::BaseVsphereCommand
8
- include SearchHelper
9
-
10
7
  banner "knife vsphere vm disk list VMNAME"
11
8
 
9
+ deps do
10
+ Chef::Knife::BaseVsphereCommand.load_deps
11
+ require_relative "helpers/search_helper"
12
+ include SearchHelper
13
+ end
14
+
12
15
  common_options
13
16
 
14
17
  # The main run method for vm_disk_list
@@ -2,15 +2,18 @@
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require "chef/knife"
5
- require_relative "base_vsphere_command"
6
- require_relative "search_helper"
5
+ require_relative "helpers/base_vsphere_command"
7
6
 
8
7
  # VsphereVMexecute extends the Basevspherecommand
9
8
  class Chef::Knife::VsphereVmExecute < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
-
12
9
  banner "knife vsphere vm execute VMNAME COMMAND ARGS"
13
10
 
11
+ deps do
12
+ Chef::Knife::BaseVsphereCommand.load_deps
13
+ require_relative "helpers/search_helper"
14
+ include SearchHelper
15
+ end
16
+
14
17
  option :exec_user,
15
18
  long: "--exec-user USER",
16
19
  description: "User to execute as",
@@ -3,14 +3,18 @@
3
3
  #
4
4
 
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # find vms belonging to pool that match criteria, display specified fields
10
9
  class Chef::Knife::VsphereVmFind < Chef::Knife::BaseVsphereCommand
11
- include SearchHelper
12
10
  banner "knife vsphere vm find"
13
11
 
12
+ deps do
13
+ Chef::Knife::BaseVsphereCommand.load_deps
14
+ require_relative "helpers/search_helper"
15
+ include SearchHelper
16
+ end
17
+
14
18
  VMFOLDER ||= "vm".freeze
15
19
 
16
20
  common_options
@@ -3,12 +3,16 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
6
+ require_relative "helpers/base_vsphere_command"
7
7
 
8
8
  # Lists all known virtual machines in the configured datacenter
9
9
  class Chef::Knife::VsphereVmList < Chef::Knife::BaseVsphereCommand
10
10
  banner "knife vsphere vm list"
11
11
 
12
+ deps do
13
+ Chef::Knife::BaseVsphereCommand.load_deps
14
+ end
15
+
12
16
  common_options
13
17
 
14
18
  option :recursive,
@@ -7,17 +7,21 @@
7
7
  #
8
8
 
9
9
  require "chef/knife"
10
- require_relative "base_vsphere_command"
11
- require_relative "search_helper"
10
+ require_relative "helpers/base_vsphere_command"
12
11
 
13
12
  # Clone an existing template into a new VM, optionally applying a customization specification.
14
13
  # usage:
15
14
  # knife vsphere vm markastemplate MyVM --folder /templates
16
15
  # Vspherevmmarkastemplate extends the Basevspherecommand
17
16
  class Chef::Knife::VsphereVmMarkastemplate < Chef::Knife::BaseVsphereCommand
18
- include SearchHelper
19
17
  banner "knife vsphere vm markastemplate VMNAME"
20
18
 
19
+ deps do
20
+ Chef::Knife::BaseVsphereCommand.load_deps
21
+ require_relative "helpers/search_helper"
22
+ include SearchHelper
23
+ end
24
+
21
25
  common_options
22
26
 
23
27
  # The main run method for vm_markastemplate
@@ -3,15 +3,19 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # migrate vm to specified resource pool , datastore and host
10
9
  class Chef::Knife::VsphereVmMigrate < Chef::Knife::BaseVsphereCommand
11
- include SearchHelper
12
10
  # migrate --resource-pool --dest-host --dest-datastore
13
11
  banner "knife vsphere vm migrate VMNAME (options)"
14
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ require_relative "helpers/search_helper"
16
+ include SearchHelper
17
+ end
18
+
15
19
  common_options
16
20
 
17
21
  option :dest_host,
@@ -3,15 +3,19 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # Moves the VM to another folder or datastore
10
9
  # VsphereVmMove extends the BaseVspherecommand
11
10
  class Chef::Knife::VsphereVmMove < Chef::Knife::BaseVsphereCommand
12
- include SearchHelper
13
11
  banner "knife vsphere vm move VMNAME"
14
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ require_relative "helpers/search_helper"
16
+ include SearchHelper
17
+ end
18
+
15
19
  common_options
16
20
 
17
21
  option :dest_name,
@@ -3,14 +3,19 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # Switch VM networking state up/down (on all network interfaces)
10
9
  # VsphereVmNet extends the BaseVspherecommand
11
10
  class Chef::Knife::VsphereVmNet < Chef::Knife::BaseVsphereCommand
12
- include SearchHelper
13
11
  banner "knife vsphere vm net STATE VMNAME"
12
+
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ require_relative "helpers/search_helper"
16
+ include SearchHelper
17
+ end
18
+
14
19
  common_options
15
20
 
16
21
  # The main run method for vm_net
@@ -3,13 +3,17 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  class Chef::Knife::VsphereVmNetworkAdd < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
9
  banner "knife vsphere vm network add VMNAME NETWORKNAME"
12
10
 
11
+ deps do
12
+ Chef::Knife::BaseVsphereCommand.load_deps
13
+ require_relative "helpers/search_helper"
14
+ include SearchHelper
15
+ end
16
+
13
17
  option :adapter_type,
14
18
  long: "--adapter-type STRING",
15
19
  description: "Adapter type eg e1000,vmxnet3",
@@ -3,13 +3,17 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  class Chef::Knife::VsphereVmNetworkDelete < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
9
  banner "knife vsphere vm network delete VMNAME NICNAME"
12
10
 
11
+ deps do
12
+ Chef::Knife::BaseVsphereCommand.load_deps
13
+ require_relative "helpers/search_helper"
14
+ include SearchHelper
15
+ end
16
+
13
17
  common_options
14
18
 
15
19
  def run
@@ -3,14 +3,18 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # VsphereVmNetworklist extends the BaseVspherecommand
10
9
  class Chef::Knife::VsphereVmNetworkList < Chef::Knife::BaseVsphereCommand
11
- include SearchHelper
12
10
  banner "knife vsphere vm network list VMNAME"
13
11
 
12
+ deps do
13
+ Chef::Knife::BaseVsphereCommand.load_deps
14
+ require_relative "helpers/search_helper"
15
+ include SearchHelper
16
+ end
17
+
14
18
  common_options
15
19
 
16
20
  # The main run method for vm_network_list
@@ -3,15 +3,19 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # Changes network on a certain VM
10
9
  # VsphereVmNetworkSet extends the BaseVspherecommand
11
10
  class Chef::Knife::VsphereVmNetworkSet < Chef::Knife::BaseVsphereCommand
12
- include SearchHelper
13
11
  banner "knife vsphere vm network set VMNAME NETWORKNAME"
14
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ require_relative "helpers/search_helper"
16
+ include SearchHelper
17
+ end
18
+
15
19
  common_options
16
20
 
17
21
  option :nic,
@@ -2,13 +2,17 @@
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require "chef/knife"
5
- require_relative "base_vsphere_command"
6
- require_relative "search_helper"
5
+ require_relative "helpers/base_vsphere_command"
7
6
 
8
7
  # VsphereVMPropertyget extends the BaseVspherecommand
9
8
  class Chef::Knife::VsphereVmPropertyGet < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
- banner "knife vsphere vm property get VMNAME PROPERTY. Gets a vApp Property on VMNAME."
9
+ banner "knife vsphere vm property get VMNAME PROPERTY. Gets a vApp Property on VMNAME."
10
+
11
+ deps do
12
+ Chef::Knife::BaseVsphereCommand.load_deps
13
+ require_relative "helpers/search_helper"
14
+ include SearchHelper
15
+ end
12
16
 
13
17
  common_options
14
18
 
@@ -2,19 +2,23 @@
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require "chef/knife"
5
- require_relative "base_vsphere_command"
6
- require_relative "search_helper"
5
+ require_relative "helpers/base_vsphere_command"
7
6
 
8
7
  # VsphereVMPropertySet extends Basevspherecommand
9
8
  class Chef::Knife::VsphereVmPropertySet < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
- banner "knife vsphere vm property set VMNAME PROPERTY VALUE. Sets a vApp Property on VMNAME."
9
+ banner "knife vsphere vm property set VMNAME PROPERTY VALUE. Sets a vApp Property on VMNAME."
10
+
11
+ deps do
12
+ Chef::Knife::BaseVsphereCommand.load_deps
13
+ require_relative "helpers/search_helper"
14
+ include SearchHelper
15
+ end
12
16
 
13
17
  common_options
14
18
 
15
19
  option :ovf_environment_transport,
16
20
  long: "--ovf-environment-transport STRING",
17
- description: "Comma delimited string. Configures the transports to use for properties. Supported values are: iso and com.vmware.guestInfo."
21
+ description: "Comma delimited string. Configures the transports to use for properties. Supported values are: iso and com.vmware.guestInfo."
18
22
 
19
23
  # The main run method for vm_property_set
20
24
  #
@@ -2,13 +2,17 @@
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require "chef/knife"
5
- require_relative "base_vsphere_command"
6
- require_relative "search_helper"
5
+ require_relative "helpers/base_vsphere_command"
7
6
 
8
7
  # VsphereVmShow extends the BaseVspherecommand
9
8
  class Chef::Knife::VsphereVmShow < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
- banner 'knife vsphere vm show VMNAME QUERY. See "http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.VirtualMachine.html" for allowed QUERY values.'
9
+ banner 'knife vsphere vm show VMNAME QUERY. See "https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.VirtualMachine.html" for allowed QUERY values.'
10
+
11
+ deps do
12
+ Chef::Knife::BaseVsphereCommand.load_deps
13
+ require_relative "helpers/search_helper"
14
+ include SearchHelper
15
+ end
12
16
 
13
17
  common_options
14
18
 
@@ -3,14 +3,18 @@
3
3
  #
4
4
 
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # Manage snapshots of a virtual machine
10
9
  class Chef::Knife::VsphereVmSnapshot < Chef::Knife::BaseVsphereCommand
11
- include SearchHelper
12
10
  banner "knife vsphere vm snapshot VMNAME (options)"
13
11
 
12
+ deps do
13
+ Chef::Knife::BaseVsphereCommand.load_deps
14
+ require_relative "helpers/search_helper"
15
+ include SearchHelper
16
+ end
17
+
14
18
  common_options
15
19
 
16
20
  option :list,
@@ -4,13 +4,11 @@
4
4
  #
5
5
 
6
6
  require "chef/knife"
7
- require_relative "base_vsphere_command"
8
- require_relative "search_helper"
7
+ require_relative "helpers/base_vsphere_command"
9
8
 
10
9
  # Manage power state of a virtual machine
11
10
  # VsphereVmState extends the BaseVspherecommand
12
11
  class Chef::Knife::VsphereVmState < Chef::Knife::BaseVsphereCommand
13
- include SearchHelper
14
12
  # The Different power states that vSphere reports
15
13
  POWER_STATES ||= {
16
14
  PS_ON => "powered on",
@@ -20,6 +18,12 @@ class Chef::Knife::VsphereVmState < Chef::Knife::BaseVsphereCommand
20
18
 
21
19
  banner "knife vsphere vm state VMNAME (options)"
22
20
 
21
+ deps do
22
+ Chef::Knife::BaseVsphereCommand.load_deps
23
+ require_relative "helpers/search_helper"
24
+ include SearchHelper
25
+ end
26
+
23
27
  common_options
24
28
 
25
29
  option :state,
@@ -2,20 +2,25 @@
2
2
  # License:: Apache License, Version 2.0
3
3
 
4
4
  require "chef/knife"
5
- require_relative "base_vsphere_command"
6
- require_relative "search_helper"
5
+ require_relative "helpers/base_vsphere_command"
7
6
 
8
7
  # Vspherevmtoolsconfig extends the BaseVspherecommand
9
8
  class Chef::Knife::VsphereVmToolsconfig < Chef::Knife::BaseVsphereCommand
10
- include SearchHelper
11
9
  banner "knife vsphere vm toolsconfig VMNAME PROPERTY VALUE
12
10
  See \"https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.ToolsConfigInfo.html\"
13
11
  for available properties and types."
14
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ require_relative "helpers/search_helper"
16
+ include SearchHelper
17
+ end
18
+
15
19
  option :empty,
16
20
  short: "-e",
17
21
  long: "--empty",
18
22
  description: "Allow empty string"
23
+
19
24
  common_options
20
25
 
21
26
  # The main run method for vm_toolsconfig
@@ -3,15 +3,19 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # Add a new disk to a virtual machine
10
9
  # VsphereVmvmdkadd extends the BaseVspherecommand
11
10
  class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
12
- include SearchHelper
13
11
  banner "knife vsphere vm vmdk add VMNAME DISK_GB"
14
12
 
13
+ deps do
14
+ Chef::Knife::BaseVsphereCommand.load_deps
15
+ require_relative "helpers/search_helper"
16
+ include SearchHelper
17
+ end
18
+
15
19
  common_options
16
20
 
17
21
  option :vmdk_type,
@@ -3,14 +3,18 @@
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  require "chef/knife"
6
- require_relative "base_vsphere_command"
7
- require_relative "search_helper"
6
+ require_relative "helpers/base_vsphere_command"
8
7
 
9
8
  # Main class VsphereVMvncset extends the BaseVspherecommand
10
9
  class Chef::Knife::VsphereVmVncset < Chef::Knife::BaseVsphereCommand
11
- include SearchHelper
12
10
  banner "knife vsphere vm vncset VMNAME"
13
11
 
12
+ deps do
13
+ Chef::Knife::BaseVsphereCommand.load_deps
14
+ require_relative "helpers/search_helper"
15
+ include SearchHelper
16
+ end
17
+
14
18
  option :vnc_port,
15
19
  long: "--vnc-port PORT",
16
20
  description: "Port to run VNC on",
@@ -5,20 +5,22 @@
5
5
  #
6
6
 
7
7
  require "chef/knife"
8
- require_relative "base_vsphere_command"
9
- require_relative "search_helper"
8
+ require_relative "helpers/base_vsphere_command"
10
9
 
11
10
  # Wait for vm finishing Sysprep.
12
11
  # usage:
13
12
  # knife vsphere vm wait sysprep somemachine --sleep 30 \
14
13
  # --timeout 600
15
14
  class Chef::Knife::VsphereVmWaitSysprep < Chef::Knife::BaseVsphereCommand
16
- include SearchHelper
17
-
18
15
  banner "knife vsphere vm wait sysprep VMNAME (options)"
19
16
 
20
17
  deps do
21
- require_relative "customization_helper"
18
+ Chef::Knife::BaseVsphereCommand.load_deps
19
+
20
+ require_relative "helpers/search_helper"
21
+ include SearchHelper
22
+
23
+ require_relative "helpers/customization_helper"
22
24
  include CustomizationHelper
23
25
  end
24
26
 
@@ -1,5 +1,5 @@
1
1
  # The main knife-vsphere module.
2
2
  module KnifeVsphere
3
3
  # The version of this gem.
4
- VERSION = "4.1.1".freeze
4
+ VERSION = "4.1.3".freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Pagel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-31 00:00:00.000000000 Z
11
+ date: 2020-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netaddr
@@ -99,9 +99,9 @@ extensions: []
99
99
  extra_rdoc_files: []
100
100
  files:
101
101
  - LICENSE
102
- - lib/chef/knife/base_vsphere_command.rb
103
- - lib/chef/knife/customization_helper.rb
104
- - lib/chef/knife/search_helper.rb
102
+ - lib/chef/knife/helpers/base_vsphere_command.rb
103
+ - lib/chef/knife/helpers/customization_helper.rb
104
+ - lib/chef/knife/helpers/search_helper.rb
105
105
  - lib/chef/knife/vsphere_cluster_list.rb
106
106
  - lib/chef/knife/vsphere_cpu_ratio.rb
107
107
  - lib/chef/knife/vsphere_customization_list.rb