knife-vsphere 1.2.17 → 1.2.18
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/vsphere_vm_clone.rb +10 -1
- data/lib/chef/knife/vsphere_vm_network_set.rb +46 -0
- data/lib/knife-vsphere/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d94e79affa56d7c9ac20ff54a800e882729a428
|
4
|
+
data.tar.gz: 02e05a982fde906a602ed5f5033c20f259b9db9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f674ccb248127469ec5bc4e26f9410a08602180ee205280b68ef500f8da7ef296f665f133f5ca230f051fb74948e28e6d1697a94acb0c79a676111681b074eb2
|
7
|
+
data.tar.gz: 827d76a2f790947f0123a26d57703620eb9c477b37ff927be06722a4edb6ede2f93a470d2044af33a2c735357ff7a1d589815e2cbfb30572cf702e1d87e11259
|
@@ -224,6 +224,12 @@ class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand
|
|
224
224
|
proc: proc { |d| Chef::Config[:knife][:distro] = d },
|
225
225
|
default: 'chef-full'
|
226
226
|
|
227
|
+
option :tags,
|
228
|
+
long: '--tags TAGS',
|
229
|
+
description: 'Comma separated list of tags to apply to the node',
|
230
|
+
proc: ->(tags) { tags.split(/[\s,]+/) },
|
231
|
+
default: []
|
232
|
+
|
227
233
|
option :template_file,
|
228
234
|
long: '--template-file TEMPLATE',
|
229
235
|
description: 'Full path to location of template to use'
|
@@ -629,7 +635,9 @@ class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand
|
|
629
635
|
hostname = config[:customization_hostname] || config[:vmname]
|
630
636
|
|
631
637
|
if windows?(src_config)
|
632
|
-
#
|
638
|
+
# We should get here with the customizations set, either by a plugin or a --cspec
|
639
|
+
fatal_exit 'Windows clones need a customization identity. Try passing a --cspec or making a --cplugin' if cust_spec.identity.props.empty?
|
640
|
+
|
633
641
|
identification = RbVmomi::VIM.CustomizationIdentification(
|
634
642
|
joinWorkgroup: cust_spec.identity.identification.joinWorkgroup
|
635
643
|
)
|
@@ -774,6 +782,7 @@ class Chef::Knife::VsphereVmClone < Chef::Knife::BaseVsphereCommand
|
|
774
782
|
# may be needed for vpc mode
|
775
783
|
bootstrap.config[:no_host_key_verify] = get_config(:no_host_key_verify)
|
776
784
|
bootstrap.config[:node_ssl_verify_mode] = get_config(:node_ssl_verify_mode)
|
785
|
+
bootstrap.config[:tags] = get_config(:tags)
|
777
786
|
bootstrap
|
778
787
|
end
|
779
788
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Owen Groves (<omgroves@gmail.com>)
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
require 'chef/knife'
|
6
|
+
require 'chef/knife/base_vsphere_command'
|
7
|
+
|
8
|
+
# Changes network on a certain VM
|
9
|
+
class Chef::Knife::VsphereVmNetworkSet < Chef::Knife::BaseVsphereCommand
|
10
|
+
banner 'knife vsphere vm network set VMNAME NETWORKNAME'
|
11
|
+
|
12
|
+
common_options
|
13
|
+
|
14
|
+
option :nic,
|
15
|
+
long: '--nic INTEGER',
|
16
|
+
description: 'Network interface to use when multiple NICs are present on the VM. (0,1..)',
|
17
|
+
default: 0
|
18
|
+
|
19
|
+
def run
|
20
|
+
$stdout.sync = true
|
21
|
+
vmname = @name_args[0]
|
22
|
+
networkname = @name_args[1]
|
23
|
+
if vmname.nil?
|
24
|
+
show_usage
|
25
|
+
fatal_exit('You must specify a virtual machine name')
|
26
|
+
end
|
27
|
+
if networkname.nil?
|
28
|
+
show_usage
|
29
|
+
fatal_exit('You must specify a network name')
|
30
|
+
end
|
31
|
+
|
32
|
+
network = find_network(networkname)
|
33
|
+
vm = get_vm(vmname) || abort('VM not found')
|
34
|
+
nic = vm.config.hardware.device.each.grep(RbVmomi::VIM::VirtualEthernetCard)[Integer(get_config(:nic))]
|
35
|
+
if network.is_a? RbVmomi::VIM::DistributedVirtualPortgroup
|
36
|
+
port = RbVmomi::VIM.DistributedVirtualSwitchPortConnection(switchUuid: network.config.distributedVirtualSwitch.uuid, portgroupKey: network.key)
|
37
|
+
nic.backing = RbVmomi::VIM.VirtualEthernetCardDistributedVirtualPortBackingInfo(port: port)
|
38
|
+
elsif network.is_a? RbVmomi::VIM::Network
|
39
|
+
nic.backing = RbVmomi::VIM.VirtualEthernetCardNetworkBackingInfo(deviceName: network.name)
|
40
|
+
else
|
41
|
+
fatal_exit('Network type not recognized')
|
42
|
+
end
|
43
|
+
change_spec = RbVmomi::VIM.VirtualMachineConfigSpec(deviceChange: [RbVmomi::VIM.VirtualDeviceConfigSpec(device: nic, operation: 'edit')])
|
44
|
+
vm.ReconfigVM_Task(spec: change_spec).wait_for_completion
|
45
|
+
end
|
46
|
+
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: 1.2.
|
4
|
+
version: 1.2.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Pagel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: filesize
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/chef/knife/vsphere_vm_migrate.rb
|
160
160
|
- lib/chef/knife/vsphere_vm_move.rb
|
161
161
|
- lib/chef/knife/vsphere_vm_net.rb
|
162
|
+
- lib/chef/knife/vsphere_vm_network_set.rb
|
162
163
|
- lib/chef/knife/vsphere_vm_property_get.rb
|
163
164
|
- lib/chef/knife/vsphere_vm_property_set.rb
|
164
165
|
- lib/chef/knife/vsphere_vm_query.rb
|
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
version: '0'
|
190
191
|
requirements: []
|
191
192
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
193
|
+
rubygems_version: 2.5.1
|
193
194
|
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: vSphere Support for Knife
|