knife-vsphere 2.1.1 → 2.1.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 +5 -5
- data/lib/chef/knife/base_vsphere_command.rb +69 -70
- data/lib/chef/knife/customization_helper.rb +4 -4
- data/lib/chef/knife/search_helper.rb +16 -7
- data/lib/chef/knife/vsphere_cluster_list.rb +8 -8
- data/lib/chef/knife/vsphere_cpu_ratio.rb +4 -4
- data/lib/chef/knife/vsphere_customization_list.rb +3 -3
- data/lib/chef/knife/vsphere_datastore_file.rb +17 -17
- data/lib/chef/knife/vsphere_datastore_list.rb +11 -11
- data/lib/chef/knife/vsphere_datastore_maxfree.rb +14 -14
- data/lib/chef/knife/vsphere_datastorecluster_list.rb +7 -7
- data/lib/chef/knife/vsphere_datastorecluster_maxfree.rb +10 -10
- data/lib/chef/knife/vsphere_folder_list.rb +4 -4
- data/lib/chef/knife/vsphere_hosts_list.rb +10 -10
- data/lib/chef/knife/vsphere_pool_list.rb +5 -5
- data/lib/chef/knife/vsphere_pool_query.rb +7 -7
- data/lib/chef/knife/vsphere_pool_show.rb +8 -8
- data/lib/chef/knife/vsphere_template_list.rb +7 -7
- data/lib/chef/knife/vsphere_vlan_create.rb +8 -8
- data/lib/chef/knife/vsphere_vlan_list.rb +3 -3
- data/lib/chef/knife/vsphere_vm_cdrom.rb +27 -27
- data/lib/chef/knife/vsphere_vm_clone.rb +224 -214
- data/lib/chef/knife/vsphere_vm_config.rb +6 -6
- data/lib/chef/knife/vsphere_vm_delete.rb +17 -17
- data/lib/chef/knife/vsphere_vm_disk_extend.rb +11 -11
- data/lib/chef/knife/vsphere_vm_disk_list.rb +6 -6
- data/lib/chef/knife/vsphere_vm_execute.rb +14 -14
- data/lib/chef/knife/vsphere_vm_find.rb +87 -87
- data/lib/chef/knife/vsphere_vm_list.rb +12 -12
- data/lib/chef/knife/vsphere_vm_markastemplate.rb +5 -5
- data/lib/chef/knife/vsphere_vm_migrate.rb +20 -25
- data/lib/chef/knife/vsphere_vm_move.rb +17 -17
- data/lib/chef/knife/vsphere_vm_net.rb +8 -8
- data/lib/chef/knife/vsphere_vm_network_add.rb +22 -24
- data/lib/chef/knife/vsphere_vm_network_delete.rb +8 -8
- data/lib/chef/knife/vsphere_vm_network_list.rb +5 -5
- data/lib/chef/knife/vsphere_vm_network_set.rb +10 -10
- data/lib/chef/knife/vsphere_vm_property_get.rb +7 -7
- data/lib/chef/knife/vsphere_vm_property_set.rb +16 -16
- data/lib/chef/knife/vsphere_vm_show.rb +8 -8
- data/lib/chef/knife/vsphere_vm_snapshot.rb +35 -35
- data/lib/chef/knife/vsphere_vm_state.rb +31 -31
- data/lib/chef/knife/vsphere_vm_toolsconfig.rb +11 -11
- data/lib/chef/knife/vsphere_vm_vmdk_add.rb +32 -32
- data/lib/chef/knife/vsphere_vm_vnc_set.rb +15 -15
- data/lib/chef/knife/vsphere_vm_wait_sysprep.rb +10 -11
- data/lib/knife-vsphere/version.rb +1 -1
- metadata +5 -89
@@ -2,13 +2,13 @@
|
|
2
2
|
# Author:: Ezra Pagel (<ezra@cpan.org>)
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "chef/knife"
|
6
|
+
require "chef/knife/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
|
-
banner
|
11
|
+
banner "knife vsphere customization list"
|
12
12
|
|
13
13
|
common_options
|
14
14
|
|
@@ -1,33 +1,33 @@
|
|
1
1
|
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "chef/knife"
|
3
|
+
require "chef/knife/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
|
-
banner
|
8
|
+
banner "knife vsphere datastore file"
|
9
9
|
|
10
10
|
common_options
|
11
11
|
|
12
12
|
option :local_file,
|
13
|
-
long:
|
14
|
-
short:
|
15
|
-
description:
|
13
|
+
long: "--local-file FILE",
|
14
|
+
short: "-f",
|
15
|
+
description: "Local file and path"
|
16
16
|
|
17
17
|
option :remote_file,
|
18
|
-
long:
|
19
|
-
short:
|
20
|
-
description:
|
18
|
+
long: "--remote-file FILE",
|
19
|
+
short: "-r",
|
20
|
+
description: "Remote file and path"
|
21
21
|
|
22
22
|
option :upload,
|
23
|
-
long:
|
24
|
-
short:
|
25
|
-
description:
|
23
|
+
long: "--upload-file",
|
24
|
+
short: "-u",
|
25
|
+
description: "Upload local file to remote"
|
26
26
|
|
27
27
|
option :download,
|
28
|
-
long:
|
29
|
-
short:
|
30
|
-
description:
|
28
|
+
long: "--download-file",
|
29
|
+
short: "-D",
|
30
|
+
description: "Download remote file to local"
|
31
31
|
|
32
32
|
# Main run method for datastore_file
|
33
33
|
#
|
@@ -36,11 +36,11 @@ class Chef::Knife::VsphereDatastoreFile < Chef::Knife::BaseVsphereCommand
|
|
36
36
|
|
37
37
|
unless get_config(:upload) || get_config(:download)
|
38
38
|
show_usage
|
39
|
-
fatal_exit(
|
39
|
+
fatal_exit("You must specify either upload or download")
|
40
40
|
end
|
41
41
|
unless get_config(:local_file) && get_config(:remote_file)
|
42
42
|
show_usage
|
43
|
-
fatal_exit(
|
43
|
+
fatal_exit("You must specify both local-file and remote-file")
|
44
44
|
end
|
45
45
|
|
46
46
|
vim_connection
|
@@ -15,24 +15,24 @@
|
|
15
15
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
16
|
# PERFORMANCE OF THIS SOFTWARE
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef/knife"
|
19
|
+
require "chef/knife/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
|
-
banner
|
24
|
+
banner "knife vsphere datastore list"
|
25
25
|
|
26
26
|
common_options
|
27
27
|
|
28
28
|
option :list,
|
29
|
-
long:
|
30
|
-
short:
|
29
|
+
long: "--list",
|
30
|
+
short: "-L",
|
31
31
|
description: "Indicates whether to list VM's in datastore",
|
32
32
|
boolean: true
|
33
33
|
option :pool,
|
34
|
-
long:
|
35
|
-
description:
|
34
|
+
long: "--pool pool",
|
35
|
+
description: "Target pool"
|
36
36
|
|
37
37
|
# The main run method for datastore_list
|
38
38
|
#
|
@@ -51,7 +51,7 @@ class Chef::Knife::VsphereDatastoreList < Chef::Knife::BaseVsphereCommand
|
|
51
51
|
|
52
52
|
pool_info = pools.map do |pool|
|
53
53
|
datastores = list_ds(pool)
|
54
|
-
{
|
54
|
+
{ "Pool" => pool.name, "Datastores" => datastores }
|
55
55
|
end
|
56
56
|
ui.output(pool_info)
|
57
57
|
end
|
@@ -63,7 +63,7 @@ class Chef::Knife::VsphereDatastoreList < Chef::Knife::BaseVsphereCommand
|
|
63
63
|
host_name = vm.guest[:hostName]
|
64
64
|
guest_full_name = vm.guest[:guest_full_name]
|
65
65
|
guest_state = vm.guest[:guest_state]
|
66
|
-
{
|
66
|
+
{ "VM Name" => host_name, "OS" => guest_full_name, "State" => guest_state }
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -71,8 +71,8 @@ class Chef::Knife::VsphereDatastoreList < Chef::Knife::BaseVsphereCommand
|
|
71
71
|
pool.datastore.map do |store|
|
72
72
|
avail = number_to_human_size(store.summary[:freeSpace])
|
73
73
|
cap = number_to_human_size(store.summary[:capacity])
|
74
|
-
ds_info = {
|
75
|
-
ds_info[
|
74
|
+
ds_info = { "Datastore" => store.name, "Free" => avail, "Capacity" => cap }
|
75
|
+
ds_info["Vms"] = list_vms(store) if get_config(:list)
|
76
76
|
ds_info
|
77
77
|
end
|
78
78
|
end
|
@@ -15,27 +15,27 @@
|
|
15
15
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
16
|
# PERFORMANCE OF THIS SOFTWARE
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef/knife"
|
19
|
+
require "chef/knife/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
|
-
banner
|
24
|
+
banner "knife vsphere datastore maxfree"
|
25
25
|
|
26
26
|
option :regex,
|
27
|
-
short:
|
28
|
-
long:
|
29
|
-
description:
|
30
|
-
default:
|
27
|
+
short: "-r REGEX",
|
28
|
+
long: "--regex REGEX",
|
29
|
+
description: "Regex to match the datastore name",
|
30
|
+
default: ""
|
31
31
|
|
32
32
|
option :vlan,
|
33
|
-
long:
|
34
|
-
description:
|
33
|
+
long: "--vlan VLAN",
|
34
|
+
description: "Require listed vlan available to datastore's parent"
|
35
35
|
|
36
36
|
option :pool,
|
37
|
-
long:
|
38
|
-
description:
|
37
|
+
long: "--pool pool",
|
38
|
+
description: "Pool or Cluster to search for datastores in"
|
39
39
|
|
40
40
|
common_options
|
41
41
|
|
@@ -44,7 +44,7 @@ class Chef::Knife::VsphereDatastoreMaxfree < Chef::Knife::BaseVsphereCommand
|
|
44
44
|
def run
|
45
45
|
$stdout.sync = true
|
46
46
|
if get_config(:vlan) && get_config(:pool)
|
47
|
-
fatal_exit(
|
47
|
+
fatal_exit("Please select either vlan or pool")
|
48
48
|
end
|
49
49
|
|
50
50
|
vim_connection
|
@@ -53,11 +53,11 @@ class Chef::Knife::VsphereDatastoreMaxfree < Chef::Knife::BaseVsphereCommand
|
|
53
53
|
datastores = find_datastores
|
54
54
|
datastores.each do |store|
|
55
55
|
if regex.match(store.name) &&
|
56
|
-
|
56
|
+
(max.nil? || max.summary[:freeSpace] < store.summary[:freeSpace])
|
57
57
|
max = store
|
58
58
|
end
|
59
59
|
end
|
60
|
-
ui.output(max ? {
|
60
|
+
ui.output(max ? { "Datastore" => max.name } : {})
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -15,12 +15,12 @@
|
|
15
15
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
16
|
# PERFORMANCE OF THIS SOFTWARE
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef/knife"
|
19
|
+
require "chef/knife/base_vsphere_command"
|
20
20
|
|
21
21
|
def number_to_human_size(number)
|
22
22
|
number = number.to_f
|
23
|
-
storage_units_fmt = %w
|
23
|
+
storage_units_fmt = %w{byte kB MB GB TB}
|
24
24
|
base = 1024
|
25
25
|
if number.to_i < base
|
26
26
|
unit = storage_units_fmt[0]
|
@@ -32,19 +32,19 @@ def number_to_human_size(number)
|
|
32
32
|
unit = storage_units_fmt[exponent]
|
33
33
|
end
|
34
34
|
|
35
|
-
format(
|
35
|
+
format("%0.2f %s", number, unit)
|
36
36
|
end
|
37
37
|
|
38
38
|
def traverse_folders_for_dsclusters(folder)
|
39
39
|
print_dsclusters_in_folder(folder)
|
40
40
|
folder.childEntity.each do |child|
|
41
|
-
traverse_folders_for_dsclusters(child) if child.class.to_s ==
|
41
|
+
traverse_folders_for_dsclusters(child) if child.class.to_s == "Folder"
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
def print_dsclusters_in_folder(folder)
|
46
46
|
folder.childEntity.each do |child|
|
47
|
-
next unless child.class.to_s ==
|
47
|
+
next unless child.class.to_s == "StoragePod"
|
48
48
|
avail = number_to_human_size(child.summary[:freeSpace])
|
49
49
|
cap = number_to_human_size(child.summary[:capacity])
|
50
50
|
puts "#{ui.color('DatastoreCluster', :cyan)}: #{child.name} (#{avail} / #{cap})"
|
@@ -53,7 +53,7 @@ end
|
|
53
53
|
|
54
54
|
# Lists all known data store cluster in datacenter with sizes
|
55
55
|
class Chef::Knife::VsphereDatastoreclusterList < Chef::Knife::BaseVsphereCommand
|
56
|
-
banner
|
56
|
+
banner "knife vsphere datastorecluster list"
|
57
57
|
|
58
58
|
common_options
|
59
59
|
|
@@ -15,8 +15,8 @@
|
|
15
15
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
16
|
# PERFORMANCE OF THIS SOFTWARE
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef/knife"
|
19
|
+
require "chef/knife/base_vsphere_command"
|
20
20
|
|
21
21
|
def max_dscluster(dscluster, max_dscluster)
|
22
22
|
return true unless max_dscluster
|
@@ -30,10 +30,10 @@ end
|
|
30
30
|
|
31
31
|
def find_max_dscluster(folder, max_dscluster, regex)
|
32
32
|
folder.childEntity.each do |child|
|
33
|
-
if child.class.to_s ==
|
33
|
+
if child.class.to_s == "Folder"
|
34
34
|
sub_max = find_max_dscluster(child, max_dscluster, regex)
|
35
35
|
max_dscluster = sub_max if max_dscluster(sub_max, max_dscluster)
|
36
|
-
elsif child.class.to_s ==
|
36
|
+
elsif child.class.to_s == "StoragePod"
|
37
37
|
if max_dscluster(child, max_dscluster) && regex.match(child.name)
|
38
38
|
max_dscluster = child
|
39
39
|
end
|
@@ -45,13 +45,13 @@ end
|
|
45
45
|
|
46
46
|
# Gets the data store cluster with the most free space in datacenter
|
47
47
|
class Chef::Knife::VsphereDatastoreclusterMaxfree < Chef::Knife::BaseVsphereCommand
|
48
|
-
banner
|
48
|
+
banner "knife vsphere datastorecluster maxfree"
|
49
49
|
|
50
50
|
option :regex,
|
51
|
-
short:
|
52
|
-
long:
|
53
|
-
description:
|
54
|
-
default:
|
51
|
+
short: "-r REGEX",
|
52
|
+
long: "--regex REGEX",
|
53
|
+
description: "Regex to match the datastore cluster name",
|
54
|
+
default: ""
|
55
55
|
common_options
|
56
56
|
|
57
57
|
def run
|
@@ -68,7 +68,7 @@ class Chef::Knife::VsphereDatastoreclusterMaxfree < Chef::Knife::BaseVsphereComm
|
|
68
68
|
if max_dscluster
|
69
69
|
puts max_dscluster.name
|
70
70
|
else
|
71
|
-
puts
|
71
|
+
puts "No datastore clusters found"
|
72
72
|
exit 1
|
73
73
|
end
|
74
74
|
end
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# Author:: Ezra Pagel (<ezra@cpan.org>)
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "chef/knife"
|
6
|
+
require "chef/knife/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
|
-
banner
|
11
|
+
banner "knife vsphere folder list"
|
12
12
|
|
13
13
|
common_options
|
14
14
|
|
@@ -21,7 +21,7 @@ class Chef::Knife::VsphereFolderList < Chef::Knife::BaseVsphereCommand
|
|
21
21
|
|
22
22
|
folders = find_all_in_folder(folder, RbVmomi::VIM::Folder)
|
23
23
|
folders.each do |child|
|
24
|
-
traverse_folders(child, indent_level
|
24
|
+
traverse_folders(child, indent_level + 1)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "chef/knife"
|
2
|
+
require "chef/knife/base_vsphere_command"
|
3
|
+
require "rbvmomi"
|
4
|
+
require "netaddr"
|
5
5
|
|
6
6
|
# list hosts belonging to pool
|
7
7
|
# VsphereHostslist extends the BaseVspherecommand
|
8
8
|
class Chef::Knife::VsphereHostsList < Chef::Knife::BaseVsphereCommand
|
9
|
-
banner
|
9
|
+
banner "knife vsphere hosts list"
|
10
10
|
|
11
11
|
common_options
|
12
12
|
option :pool,
|
13
|
-
long:
|
14
|
-
short:
|
15
|
-
description:
|
13
|
+
long: "--pool pool",
|
14
|
+
short: "-h",
|
15
|
+
description: "Target pool"
|
16
16
|
|
17
17
|
# The main run method for hosts_list
|
18
18
|
#
|
@@ -30,7 +30,7 @@ class Chef::Knife::VsphereHostsList < Chef::Knife::BaseVsphereCommand
|
|
30
30
|
|
31
31
|
pool_list = pools.map do |pool|
|
32
32
|
host_list = list_hosts(pool)
|
33
|
-
{
|
33
|
+
{ "Pool" => pool.name, "Hosts" => host_list }
|
34
34
|
end
|
35
35
|
ui.output(pool_list)
|
36
36
|
end
|
@@ -40,7 +40,7 @@ class Chef::Knife::VsphereHostsList < Chef::Knife::BaseVsphereCommand
|
|
40
40
|
def list_hosts(pool)
|
41
41
|
hosts = pool.host || []
|
42
42
|
hosts.map do |hostc|
|
43
|
-
{
|
43
|
+
{ "Host" => hostc.name }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -2,12 +2,12 @@
|
|
2
2
|
# Author:: Jesse Campbell (<hikeit@gmail.com>)
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "chef/knife"
|
6
|
+
require "chef/knife/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
|
-
banner
|
10
|
+
banner "knife vsphere pool list"
|
11
11
|
|
12
12
|
common_options
|
13
13
|
|
@@ -15,8 +15,8 @@ class Chef::Knife::VspherePoolList < Chef::Knife::BaseVsphereCommand
|
|
15
15
|
return if folder.is_a? RbVmomi::VIM::VirtualApp
|
16
16
|
|
17
17
|
if folder.is_a? RbVmomi::VIM::ResourcePool
|
18
|
-
pools = folder.path[3..-1].reject { |p| p.last ==
|
19
|
-
puts "#{ui.color('Pool', :cyan)}: " + pools.map(&:last).join(
|
18
|
+
pools = folder.path[3..-1].reject { |p| p.last == "Resources" }
|
19
|
+
puts "#{ui.color('Pool', :cyan)}: " + pools.map(&:last).join("/")
|
20
20
|
end
|
21
21
|
|
22
22
|
folders = find_all_in_folder(folder, RbVmomi::VIM::ManagedObject) || []
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "chef/knife"
|
2
|
+
require "chef/knife/base_vsphere_command"
|
3
|
+
require "rbvmomi"
|
4
|
+
require "netaddr"
|
5
5
|
|
6
6
|
# VspherePoolQuery extends the BaseVsphereCommand
|
7
7
|
class Chef::Knife::VspherePoolQuery < Chef::Knife::BaseVsphereCommand
|
8
|
-
banner
|
8
|
+
banner 'knife vsphere pool query POOLNAME QUERY. See "http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html" for allowed QUERY values.'
|
9
9
|
|
10
10
|
common_options
|
11
11
|
|
@@ -13,8 +13,8 @@ class Chef::Knife::VspherePoolQuery < Chef::Knife::BaseVsphereCommand
|
|
13
13
|
#
|
14
14
|
def run
|
15
15
|
args = ARGV
|
16
|
-
args[2] =
|
17
|
-
ui.warn
|
16
|
+
args[2] = "show"
|
17
|
+
ui.warn "vsphere pool query is moving to vsphere pool show. Next time, please run"
|
18
18
|
ui.warn args.join " "
|
19
19
|
Chef::Knife.run(args)
|
20
20
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "chef/knife"
|
2
|
+
require "chef/knife/base_vsphere_command"
|
3
|
+
require "rbvmomi"
|
4
|
+
require "netaddr"
|
5
5
|
|
6
6
|
class Chef::Knife::VspherePoolShow < Chef::Knife::BaseVsphereCommand
|
7
|
-
banner
|
7
|
+
banner 'knife vsphere pool show POOLNAME QUERY. See "http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html" for allowed QUERY values.'
|
8
8
|
|
9
9
|
common_options
|
10
10
|
|
@@ -26,13 +26,13 @@ class Chef::Knife::VspherePoolShow < Chef::Knife::BaseVsphereCommand
|
|
26
26
|
poolname = @name_args[0]
|
27
27
|
if poolname.nil?
|
28
28
|
show_usage
|
29
|
-
fatal_exit(
|
29
|
+
fatal_exit("You must specify a resource poor or cluster name (see knife vsphere pool list)")
|
30
30
|
end
|
31
31
|
|
32
32
|
query_string = @name_args[1]
|
33
33
|
if query_string.nil?
|
34
34
|
show_usage
|
35
|
-
fatal_exit(
|
35
|
+
fatal_exit("You must specify a QUERY value (e.g. summary.overallStatus )")
|
36
36
|
end
|
37
37
|
|
38
38
|
vim_connection
|
@@ -43,7 +43,7 @@ class Chef::Knife::VspherePoolShow < Chef::Knife::BaseVsphereCommand
|
|
43
43
|
pool = traverse_folders_for_pool(folder, poolname) || abort("Pool #{poolname} not found")
|
44
44
|
|
45
45
|
# split QUERY by dots, and walk the object model
|
46
|
-
query = query_string.split
|
46
|
+
query = query_string.split "."
|
47
47
|
result = pool
|
48
48
|
query.each do |part|
|
49
49
|
message, index = part.split(/[\[\]]/)
|