knife-vsphere 3.0.1 → 4.0.1
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 +4 -4
- data/lib/chef/knife/base_vsphere_command.rb +35 -32
- data/lib/chef/knife/search_helper.rb +3 -3
- data/lib/chef/knife/vsphere_customization_list.rb +1 -1
- data/lib/chef/knife/vsphere_datastore_file.rb +12 -12
- data/lib/chef/knife/vsphere_datastore_list.rb +6 -6
- data/lib/chef/knife/vsphere_datastore_maxfree.rb +8 -8
- data/lib/chef/knife/vsphere_datastorecluster_list.rb +2 -1
- data/lib/chef/knife/vsphere_datastorecluster_maxfree.rb +4 -4
- data/lib/chef/knife/vsphere_folder_list.rb +1 -1
- data/lib/chef/knife/vsphere_hosts_list.rb +3 -3
- data/lib/chef/knife/vsphere_pool_list.rb +1 -1
- data/lib/chef/knife/vsphere_vlan_create.rb +2 -2
- data/lib/chef/knife/vsphere_vlan_list.rb +1 -1
- data/lib/chef/knife/vsphere_vm_cdrom.rb +18 -18
- data/lib/chef/knife/vsphere_vm_clone.rb +168 -333
- data/lib/chef/knife/vsphere_vm_delete.rb +7 -7
- data/lib/chef/knife/vsphere_vm_disk_extend.rb +4 -3
- data/lib/chef/knife/vsphere_vm_execute.rb +8 -8
- data/lib/chef/knife/vsphere_vm_find.rb +50 -49
- data/lib/chef/knife/vsphere_vm_list.rb +13 -12
- data/lib/chef/knife/vsphere_vm_migrate.rb +8 -8
- data/lib/chef/knife/vsphere_vm_move.rb +13 -13
- data/lib/chef/knife/vsphere_vm_net.rb +1 -1
- data/lib/chef/knife/vsphere_vm_network_add.rb +7 -8
- data/lib/chef/knife/vsphere_vm_network_delete.rb +1 -1
- data/lib/chef/knife/vsphere_vm_property_set.rb +3 -3
- data/lib/chef/knife/vsphere_vm_snapshot.rb +32 -30
- data/lib/chef/knife/vsphere_vm_state.rb +12 -12
- data/lib/chef/knife/vsphere_vm_toolsconfig.rb +3 -3
- data/lib/chef/knife/vsphere_vm_vmdk_add.rb +15 -13
- data/lib/chef/knife/vsphere_vm_vnc_set.rb +7 -7
- data/lib/chef/knife/vsphere_vm_wait_sysprep.rb +6 -6
- data/lib/knife-vsphere/version.rb +1 -1
- metadata +31 -17
@@ -23,24 +23,24 @@ class Chef::Knife::VsphereVmState < Chef::Knife::BaseVsphereCommand
|
|
23
23
|
common_options
|
24
24
|
|
25
25
|
option :state,
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
short: "-s STATE",
|
27
|
+
long: "--state STATE",
|
28
|
+
description: "The power state to transition the VM into; one of on|off|suspended|reboot"
|
29
29
|
|
30
30
|
option :wait_port,
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
short: "-w PORT",
|
32
|
+
long: "--wait-port PORT",
|
33
|
+
description: "Wait for VM to be accessible on a port"
|
34
34
|
|
35
35
|
option :shutdown,
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
short: "-g",
|
37
|
+
long: "--shutdown",
|
38
|
+
description: "Guest OS shutdown"
|
39
39
|
|
40
40
|
option :recursive,
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
short: "-r",
|
42
|
+
long: "--recursive",
|
43
|
+
description: "Search all folders"
|
44
44
|
|
45
45
|
# The main run method for vm_state
|
46
46
|
#
|
@@ -13,9 +13,9 @@ class Chef::Knife::VsphereVmToolsconfig < Chef::Knife::BaseVsphereCommand
|
|
13
13
|
for available properties and types."
|
14
14
|
|
15
15
|
option :empty,
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
short: "-e",
|
17
|
+
long: "--empty",
|
18
|
+
description: "Allow empty string"
|
19
19
|
common_options
|
20
20
|
|
21
21
|
# The main run method for vm_toolsconfig
|
@@ -15,14 +15,14 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
15
15
|
common_options
|
16
16
|
|
17
17
|
option :vmdk_type,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
long: "--vmdk-type TYPE",
|
19
|
+
description: "Type of VMDK",
|
20
|
+
# this is a bad idea as it will let you overcommit SAN by 400% or more. thick is a more "sane" default
|
21
|
+
default: "thin"
|
22
22
|
|
23
23
|
option :target_lun,
|
24
|
-
|
25
|
-
|
24
|
+
long: "--target-lun NAME",
|
25
|
+
description: "name of target LUN"
|
26
26
|
|
27
27
|
# The main run method for vm_vmdk_add
|
28
28
|
#
|
@@ -68,7 +68,7 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
68
68
|
rescue RbVmomi::Fault => e
|
69
69
|
ui.warn "Ignoring a fault when trying to create #{vmdk_dir}. This may be related to issue #213."
|
70
70
|
if log_verbose?
|
71
|
-
puts "Chose #{vmdk_datastore.name} out of #{vmdk_datastores.map(&:name).join(
|
71
|
+
puts "Chose #{vmdk_datastore.name} out of #{vmdk_datastores.map(&:name).join(", ")}"
|
72
72
|
puts e
|
73
73
|
end
|
74
74
|
end
|
@@ -84,7 +84,7 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
84
84
|
vm_files = pc.collectMultiple vms, "layoutEx.file"
|
85
85
|
vm_files.keys.each do |vmFile|
|
86
86
|
vm_files[vmFile]["layoutEx.file"].each do |layout|
|
87
|
-
if layout.name =~
|
87
|
+
if layout.name =~ %r{^\[#{vmdk_datastore.name}\] #{vmname}/#{vmname}_([0-9]+).vmdk}
|
88
88
|
num = Regexp.last_match(1)
|
89
89
|
next_vmdk = num.to_i + 1 if next_vmdk <= num.to_i
|
90
90
|
end
|
@@ -104,11 +104,11 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
104
104
|
diskType: vmdk_type
|
105
105
|
)
|
106
106
|
ui.info "Creating VMDK"
|
107
|
-
ui.info "#{ui.color
|
108
|
-
ui.info "#{ui.color
|
107
|
+
ui.info "#{ui.color "Capacity:", :cyan} #{size} GB"
|
108
|
+
ui.info "#{ui.color "Disk:", :cyan} #{vmdk_name}"
|
109
109
|
|
110
110
|
if get_config(:noop)
|
111
|
-
ui.info "#{ui.color
|
111
|
+
ui.info "#{ui.color "Skipping disk creation process because --noop specified.", :red}"
|
112
112
|
else
|
113
113
|
vdm.CreateVirtualDisk_Task(
|
114
114
|
datacenter: datacenter,
|
@@ -132,6 +132,7 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
132
132
|
scsi_tree[device.key]["device"] = device
|
133
133
|
end
|
134
134
|
next unless device.class == RbVmomi::VIM::VirtualDisk
|
135
|
+
|
135
136
|
if scsi_tree[device.controllerKey].nil?
|
136
137
|
scsi_tree[device.controllerKey] = {}
|
137
138
|
scsi_tree[device.controllerKey]["children"] = []
|
@@ -172,7 +173,7 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
172
173
|
)
|
173
174
|
|
174
175
|
if get_config(:noop)
|
175
|
-
ui.info "#{ui.color
|
176
|
+
ui.info "#{ui.color "Skipping controller creation process because --noop specified.", :red}"
|
176
177
|
else
|
177
178
|
vm.ReconfigVM_Task(spec: vm_config_spec).wait_for_completion
|
178
179
|
end
|
@@ -195,6 +196,7 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
195
196
|
used_unit_numbers = []
|
196
197
|
scsi_tree.keys.sort.each do |c|
|
197
198
|
next unless controller.key == scsi_tree[c]["device"].key
|
199
|
+
|
198
200
|
used_unit_numbers.push(scsi_tree[c]["device"].scsiCtlrUnitNumber)
|
199
201
|
scsi_tree[c]["children"].each do |disk|
|
200
202
|
used_unit_numbers.push(disk.unitNumber)
|
@@ -237,7 +239,7 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
|
|
237
239
|
)
|
238
240
|
|
239
241
|
if get_config(:noop)
|
240
|
-
ui.info "#{ui.color
|
242
|
+
ui.info "#{ui.color "Skipping disk attaching process because --noop specified.", :red}"
|
241
243
|
else
|
242
244
|
vm.ReconfigVM_Task(spec: vm_config_spec).wait_for_completion
|
243
245
|
end
|
@@ -12,14 +12,14 @@ class Chef::Knife::VsphereVmVncset < Chef::Knife::BaseVsphereCommand
|
|
12
12
|
banner "knife vsphere vm vncset VMNAME"
|
13
13
|
|
14
14
|
option :vnc_port,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
long: "--vnc-port PORT",
|
16
|
+
description: "Port to run VNC on",
|
17
|
+
required: true
|
18
18
|
|
19
19
|
option :vnc_password,
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
long: "--vnc-password PASSWORD",
|
21
|
+
description: "Password for connecting to VNC",
|
22
|
+
required: true
|
23
23
|
|
24
24
|
common_options
|
25
25
|
|
@@ -42,7 +42,7 @@ class Chef::Knife::VsphereVmVncset < Chef::Knife::BaseVsphereCommand
|
|
42
42
|
extraConfig: [
|
43
43
|
{ key: "RemoteDisplay.vnc.enabled", value: "true" },
|
44
44
|
{ key: "RemoteDisplay.vnc.port", value: config[:vnc_port].to_s },
|
45
|
-
{ key: "RemoteDisplay.vnc.password", value: config[:vnc_password].to_s }
|
45
|
+
{ key: "RemoteDisplay.vnc.password", value: config[:vnc_password].to_s },
|
46
46
|
],
|
47
47
|
}
|
48
48
|
).wait_for_completion
|
@@ -22,14 +22,14 @@ class Chef::Knife::VsphereVmWaitSysprep < Chef::Knife::BaseVsphereCommand
|
|
22
22
|
common_options
|
23
23
|
|
24
24
|
option :sleep,
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
long: "--sleep TIME",
|
26
|
+
description: "The time in seconds to wait between queries for CustomizationSucceeded event. Default: 60 seconds",
|
27
|
+
default: 60
|
28
28
|
|
29
29
|
option :timeout,
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
long: "--timeout TIME",
|
31
|
+
description: "The timeout in seconds before aborting. Default: 300 seconds",
|
32
|
+
default: 300
|
33
33
|
|
34
34
|
# The main run method for vm_wait_sysprep.
|
35
35
|
#
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Pagel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: knife-windows
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "<"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "<"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '4'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: netaddr
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +66,34 @@ dependencies:
|
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: 2.6.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: chef
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '15.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '15.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: chef-bin
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '15.1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '15.1'
|
83
97
|
description: VMware vSphere support for Chef Infra's Knife command
|
84
98
|
email: ezra@cpan.org
|
85
99
|
executables: []
|
@@ -144,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
158
|
requirements:
|
145
159
|
- - ">="
|
146
160
|
- !ruby/object:Gem::Version
|
147
|
-
version: '2.
|
161
|
+
version: '2.5'
|
148
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - ">="
|