fog 1.30.0 → 1.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -0
- data/CONTRIBUTORS.md +73 -1
- data/LICENSE.md +1 -1
- data/Rakefile +10 -8
- data/fog.gemspec +6 -3
- data/lib/fog/cloudstack/models/compute/server.rb +2 -0
- data/lib/fog/openstack.rb +1 -1
- data/lib/fog/openstack/baremetal.rb +5 -5
- data/lib/fog/openstack/compute.rb +20 -9
- data/lib/fog/openstack/core.rb +53 -14
- data/lib/fog/openstack/examples/compute/basics.rb +3 -1
- data/lib/fog/openstack/identity.rb +29 -254
- data/lib/fog/openstack/identity_v2.rb +264 -0
- data/lib/fog/openstack/identity_v3.rb +249 -0
- data/lib/fog/openstack/image.rb +1 -1
- data/lib/fog/openstack/metering.rb +1 -1
- data/lib/fog/openstack/models/baremetal/node.rb +22 -0
- data/lib/fog/openstack/models/compute/flavor.rb +13 -0
- data/lib/fog/openstack/models/compute/service.rb +48 -0
- data/lib/fog/openstack/models/compute/services.rb +20 -0
- data/lib/fog/openstack/models/identity_v2/ec2_credential.rb +45 -0
- data/lib/fog/openstack/models/identity_v2/ec2_credentials.rb +55 -0
- data/lib/fog/openstack/models/identity_v2/role.rb +52 -0
- data/lib/fog/openstack/models/identity_v2/roles.rb +22 -0
- data/lib/fog/openstack/models/identity_v2/tenant.rb +64 -0
- data/lib/fog/openstack/models/identity_v2/tenants.rb +31 -0
- data/lib/fog/openstack/models/identity_v2/user.rb +71 -0
- data/lib/fog/openstack/models/identity_v2/users.rb +43 -0
- data/lib/fog/openstack/models/identity_v3/domain.rb +47 -0
- data/lib/fog/openstack/models/identity_v3/domains.rb +36 -0
- data/lib/fog/openstack/models/identity_v3/endpoint.rb +50 -0
- data/lib/fog/openstack/models/identity_v3/endpoints.rb +27 -0
- data/lib/fog/openstack/models/identity_v3/group.rb +96 -0
- data/lib/fog/openstack/models/identity_v3/groups.rb +31 -0
- data/lib/fog/openstack/models/identity_v3/os_credential.rb +73 -0
- data/lib/fog/openstack/models/identity_v3/os_credentials.rb +31 -0
- data/lib/fog/openstack/models/identity_v3/policies.rb +31 -0
- data/lib/fog/openstack/models/identity_v3/policy.rb +46 -0
- data/lib/fog/openstack/models/identity_v3/project.rb +98 -0
- data/lib/fog/openstack/models/identity_v3/projects.rb +31 -0
- data/lib/fog/openstack/models/identity_v3/role.rb +45 -0
- data/lib/fog/openstack/models/identity_v3/role_assignment.rb +22 -0
- data/lib/fog/openstack/models/identity_v3/role_assignments.rb +22 -0
- data/lib/fog/openstack/models/identity_v3/roles.rb +35 -0
- data/lib/fog/openstack/models/identity_v3/service.rb +47 -0
- data/lib/fog/openstack/models/identity_v3/services.rb +31 -0
- data/lib/fog/openstack/models/identity_v3/token.rb +26 -0
- data/lib/fog/openstack/models/identity_v3/tokens.rb +40 -0
- data/lib/fog/openstack/models/identity_v3/user.rb +87 -0
- data/lib/fog/openstack/models/identity_v3/users.rb +35 -0
- data/lib/fog/openstack/network.rb +2 -9
- data/lib/fog/openstack/orchestration.rb +1 -6
- data/lib/fog/openstack/planning.rb +1 -1
- data/lib/fog/openstack/requests/baremetal/set_node_maintenance.rb +36 -0
- data/lib/fog/openstack/requests/baremetal/set_node_power_state.rb +35 -0
- data/lib/fog/openstack/requests/baremetal/set_node_provision_state.rb +38 -0
- data/lib/fog/openstack/requests/baremetal/unset_node_maintenance.rb +36 -0
- data/lib/fog/openstack/requests/compute/create_flavor_metadata.rb +38 -0
- data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/delete_service.rb +32 -0
- data/lib/fog/openstack/requests/compute/disable_service.rb +37 -0
- data/lib/fog/openstack/requests/compute/disable_service_log_reason.rb +38 -0
- data/lib/fog/openstack/requests/compute/enable_service.rb +38 -0
- data/lib/fog/openstack/requests/compute/get_flavor_metadata.rb +27 -0
- data/lib/fog/openstack/requests/compute/list_services.rb +72 -0
- data/lib/fog/openstack/requests/compute/list_tenants_with_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_zones.rb +32 -0
- data/lib/fog/openstack/requests/identity_v2/add_user_to_tenant.rb +36 -0
- data/lib/fog/openstack/requests/identity_v2/check_token.rb +22 -0
- data/lib/fog/openstack/requests/identity_v2/create_ec2_credential.rb +59 -0
- data/lib/fog/openstack/requests/identity_v2/create_role.rb +38 -0
- data/lib/fog/openstack/requests/identity_v2/create_tenant.rb +34 -0
- data/lib/fog/openstack/requests/identity_v2/create_user.rb +45 -0
- data/lib/fog/openstack/requests/identity_v2/create_user_role.rb +26 -0
- data/lib/fog/openstack/requests/identity_v2/delete_ec2_credential.rb +43 -0
- data/lib/fog/openstack/requests/identity_v2/delete_role.rb +30 -0
- data/lib/fog/openstack/requests/identity_v2/delete_tenant.rb +33 -0
- data/lib/fog/openstack/requests/identity_v2/delete_user.rb +30 -0
- data/lib/fog/openstack/requests/identity_v2/delete_user_role.rb +25 -0
- data/lib/fog/openstack/requests/identity_v2/get_ec2_credential.rb +50 -0
- data/lib/fog/openstack/requests/identity_v2/get_role.rb +30 -0
- data/lib/fog/openstack/requests/identity_v2/get_tenant.rb +33 -0
- data/lib/fog/openstack/requests/identity_v2/get_tenants_by_id.rb +20 -0
- data/lib/fog/openstack/requests/identity_v2/get_tenants_by_name.rb +20 -0
- data/lib/fog/openstack/requests/identity_v2/get_user_by_id.rb +34 -0
- data/lib/fog/openstack/requests/identity_v2/get_user_by_name.rb +29 -0
- data/lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb +45 -0
- data/lib/fog/openstack/requests/identity_v2/list_endpoints_for_token.rb +20 -0
- data/lib/fog/openstack/requests/identity_v2/list_roles.rb +33 -0
- data/lib/fog/openstack/requests/identity_v2/list_roles_for_user_on_tenant.rb +32 -0
- data/lib/fog/openstack/requests/identity_v2/list_tenants.rb +47 -0
- data/lib/fog/openstack/requests/identity_v2/list_user_global_roles.rb +20 -0
- data/lib/fog/openstack/requests/identity_v2/list_users.rb +35 -0
- data/lib/fog/openstack/requests/identity_v2/remove_user_from_tenant.rb +22 -0
- data/lib/fog/openstack/requests/identity_v2/set_tenant.rb +21 -0
- data/lib/fog/openstack/requests/identity_v2/update_tenant.rb +30 -0
- data/lib/fog/openstack/requests/identity_v2/update_user.rb +34 -0
- data/lib/fog/openstack/requests/identity_v2/validate_token.rb +22 -0
- data/lib/fog/openstack/requests/identity_v3/add_user_to_group.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/auth_domains.rb +29 -0
- data/lib/fog/openstack/requests/identity_v3/auth_projects.rb +29 -0
- data/lib/fog/openstack/requests/identity_v3/check_domain_group_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/check_domain_user_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/check_project_group_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/check_project_user_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/create_domain.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_endpoint.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_group.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_os_credential.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_policy.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_project.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_role.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_service.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/create_user.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/delete_domain.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_endpoint.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_group.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_os_credential.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_policy.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_project.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_service.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/delete_user.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/get_domain.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_endpoint.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_group.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_os_credential.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_policy.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_project.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_role.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_service.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/get_user.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/grant_domain_group_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/grant_domain_user_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/grant_project_group_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/grant_project_user_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/group_user_check.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/list_domain_group_roles.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/list_domain_user_roles.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/list_domains.rb +31 -0
- data/lib/fog/openstack/requests/identity_v3/list_endpoints.rb +31 -0
- data/lib/fog/openstack/requests/identity_v3/list_group_users.rb +32 -0
- data/lib/fog/openstack/requests/identity_v3/list_groups.rb +42 -0
- data/lib/fog/openstack/requests/identity_v3/list_os_credentials.rb +29 -0
- data/lib/fog/openstack/requests/identity_v3/list_policies.rb +28 -0
- data/lib/fog/openstack/requests/identity_v3/list_project_group_roles.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/list_project_user_roles.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/list_projects.rb +42 -0
- data/lib/fog/openstack/requests/identity_v3/list_role_assignments.rb +35 -0
- data/lib/fog/openstack/requests/identity_v3/list_roles.rb +42 -0
- data/lib/fog/openstack/requests/identity_v3/list_services.rb +30 -0
- data/lib/fog/openstack/requests/identity_v3/list_user_groups.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/list_user_projects.rb +23 -0
- data/lib/fog/openstack/requests/identity_v3/list_users.rb +32 -0
- data/lib/fog/openstack/requests/identity_v3/remove_user_from_group.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/revoke_domain_group_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/revoke_domain_user_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/revoke_project_group_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/revoke_project_user_role.rb +20 -0
- data/lib/fog/openstack/requests/identity_v3/token_authenticate.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/token_check.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/token_revoke.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/token_validate.rb +22 -0
- data/lib/fog/openstack/requests/identity_v3/update_domain.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_endpoint.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_group.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_os_credential.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_policy.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_project.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_role.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_service.rb +21 -0
- data/lib/fog/openstack/requests/identity_v3/update_user.rb +21 -0
- data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +1 -1
- data/lib/fog/openstack/volume.rb +1 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +27 -8
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +376 -37
- data/lib/tasks/changelog_task.rb +1 -1
- data/spec/fog/openstack/identity_v3/authv3_a.yml +61 -0
- data/spec/fog/openstack/identity_v3/authv3_b.yml +61 -0
- data/spec/fog/openstack/identity_v3/authv3_c.yml +61 -0
- data/spec/fog/openstack/identity_v3/authv3_project.yml +61 -0
- data/spec/fog/openstack/identity_v3/authv3_token.yml +151 -0
- data/spec/fog/openstack/identity_v3/authv3_unscoped.yml +334 -0
- data/spec/fog/openstack/identity_v3/idv2_unscoped_token_v3.yml +467 -0
- data/spec/fog/openstack/identity_v3/idv3.yml +61 -0
- data/spec/fog/openstack/identity_v3/idv3_credential.yml +111 -0
- data/spec/fog/openstack/identity_v3/idv3_credential_crud.yml +528 -0
- data/spec/fog/openstack/identity_v3/idv3_domain.yml +195 -0
- data/spec/fog/openstack/identity_v3/idv3_domain_crud.yml +686 -0
- data/spec/fog/openstack/identity_v3/idv3_domain_group_roles_mutation.yml +906 -0
- data/spec/fog/openstack/identity_v3/idv3_domain_roles_mutation.yml +505 -0
- data/spec/fog/openstack/identity_v3/idv3_endpoint.yml +303 -0
- data/spec/fog/openstack/identity_v3/idv3_endpoints_crud.yml +718 -0
- data/spec/fog/openstack/identity_v3/idv3_group_crud_mutation.yml +975 -0
- data/spec/fog/openstack/identity_v3/idv3_policy.yml +147 -0
- data/spec/fog/openstack/identity_v3/idv3_policy_crud.yml +368 -0
- data/spec/fog/openstack/identity_v3/idv3_project.yml +211 -0
- data/spec/fog/openstack/identity_v3/idv3_project_crud.yml +663 -0
- data/spec/fog/openstack/identity_v3/idv3_project_group_user_roles_mutation.yml +1378 -0
- data/spec/fog/openstack/identity_v3/idv3_role.yml +199 -0
- data/spec/fog/openstack/identity_v3/idv3_role_crud.yml +616 -0
- data/spec/fog/openstack/identity_v3/idv3_service.yml +223 -0
- data/spec/fog/openstack/identity_v3/idv3_services_crud.yml +562 -0
- data/spec/fog/openstack/identity_v3/idv3_token.yml +240 -0
- data/spec/fog/openstack/identity_v3/idv3_user_crud.yml +572 -0
- data/spec/fog/openstack/identity_v3/idv3_users.yml +393 -0
- data/spec/fog/openstack/identity_v3_spec.rb +929 -0
- data/tests/openstack/requests/baremetal/node_tests.rb +18 -0
- data/tests/openstack/requests/compute/flavor_tests.rb +18 -0
- data/tests/openstack/requests/compute/service_tests.rb +33 -0
- metadata +259 -49
- data/lib/fog/openstack/models/identity/ec2_credential.rb +0 -44
- data/lib/fog/openstack/models/identity/ec2_credentials.rb +0 -53
- data/lib/fog/openstack/models/identity/role.rb +0 -50
- data/lib/fog/openstack/models/identity/roles.rb +0 -20
- data/lib/fog/openstack/models/identity/tenant.rb +0 -62
- data/lib/fog/openstack/models/identity/tenants.rb +0 -29
- data/lib/fog/openstack/models/identity/user.rb +0 -69
- data/lib/fog/openstack/models/identity/users.rb +0 -41
- data/lib/fog/openstack/requests/identity/add_user_to_tenant.rb +0 -34
- data/lib/fog/openstack/requests/identity/check_token.rb +0 -20
- data/lib/fog/openstack/requests/identity/create_ec2_credential.rb +0 -57
- data/lib/fog/openstack/requests/identity/create_role.rb +0 -36
- data/lib/fog/openstack/requests/identity/create_tenant.rb +0 -32
- data/lib/fog/openstack/requests/identity/create_user.rb +0 -43
- data/lib/fog/openstack/requests/identity/create_user_role.rb +0 -24
- data/lib/fog/openstack/requests/identity/delete_ec2_credential.rb +0 -42
- data/lib/fog/openstack/requests/identity/delete_role.rb +0 -28
- data/lib/fog/openstack/requests/identity/delete_tenant.rb +0 -31
- data/lib/fog/openstack/requests/identity/delete_user.rb +0 -28
- data/lib/fog/openstack/requests/identity/delete_user_role.rb +0 -23
- data/lib/fog/openstack/requests/identity/get_ec2_credential.rb +0 -48
- data/lib/fog/openstack/requests/identity/get_role.rb +0 -28
- data/lib/fog/openstack/requests/identity/get_tenant.rb +0 -31
- data/lib/fog/openstack/requests/identity/get_tenants_by_id.rb +0 -18
- data/lib/fog/openstack/requests/identity/get_tenants_by_name.rb +0 -18
- data/lib/fog/openstack/requests/identity/get_user_by_id.rb +0 -32
- data/lib/fog/openstack/requests/identity/get_user_by_name.rb +0 -27
- data/lib/fog/openstack/requests/identity/list_ec2_credentials.rb +0 -43
- data/lib/fog/openstack/requests/identity/list_endpoints_for_token.rb +0 -18
- data/lib/fog/openstack/requests/identity/list_roles.rb +0 -31
- data/lib/fog/openstack/requests/identity/list_roles_for_user_on_tenant.rb +0 -30
- data/lib/fog/openstack/requests/identity/list_tenants.rb +0 -45
- data/lib/fog/openstack/requests/identity/list_user_global_roles.rb +0 -18
- data/lib/fog/openstack/requests/identity/list_users.rb +0 -33
- data/lib/fog/openstack/requests/identity/remove_user_from_tenant.rb +0 -20
- data/lib/fog/openstack/requests/identity/set_tenant.rb +0 -19
- data/lib/fog/openstack/requests/identity/update_tenant.rb +0 -28
- data/lib/fog/openstack/requests/identity/update_user.rb +0 -32
- data/lib/fog/openstack/requests/identity/validate_token.rb +0 -20
@@ -58,7 +58,16 @@ module Fog
|
|
58
58
|
# * 'numCPUs'<~Integer> - the number of Virtual CPUs of the Destination VM
|
59
59
|
# * 'memoryMB'<~Integer> - the size of memory of the Destination VM in MB
|
60
60
|
# * customization_spec<~Hash>: Options are marked as required if you
|
61
|
-
# use this customization_spec.
|
61
|
+
# use this customization_spec.
|
62
|
+
# As defined https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Specification.html
|
63
|
+
# * encryptionKey <~array of bytes> Used to encrypt/decrypt password
|
64
|
+
# * globalIPSettings expects a hash, REQUIRED
|
65
|
+
# * identity expects a hash, REQUIRED - either LinuxPrep, Sysprep or SysprepText
|
66
|
+
# * nicSettingMap expects an array
|
67
|
+
# * options expects a hash
|
68
|
+
# * All options can be parsed using a yaml template with cloudinit_to_customspec.rb
|
69
|
+
#
|
70
|
+
# OLD Values still supported:
|
62
71
|
# This only support cloning and setting DHCP on the first interface
|
63
72
|
# * 'domain'<~String> - *REQUIRED* This is put into
|
64
73
|
# /etc/resolve.conf (we hope)
|
@@ -156,52 +165,382 @@ module Fog
|
|
156
165
|
virtual_machine_config_spec.memoryHotAddEnabled = options['memoryHotAddEnabled'] if ( options.key?('memoryHotAddEnabled') )
|
157
166
|
virtual_machine_config_spec.firmware = options['firmware'] if ( options.key?('firmware') )
|
158
167
|
# Options['customization_spec']
|
159
|
-
#
|
160
|
-
# Collect your variables ifset (writing at 11pm revist me)
|
168
|
+
# OLD Options still supported
|
161
169
|
# * domain <~String> - *REQUIRED* - Sets the server's domain for customization
|
162
170
|
# * dnsSuffixList <~Array> - Optional - Sets the dns search paths in resolv - Example: ["dev.example.com", "example.com"]
|
171
|
+
# * time_zone <~String> - Required - Only valid linux options are valid - example: 'America/Denver'
|
163
172
|
# * ipsettings <~Hash> - Optional - If not set defaults to dhcp
|
164
173
|
# * ip <~String> - *REQUIRED* Sets the ip address of the VM - Example: 10.0.0.10
|
165
174
|
# * dnsServerList <~Array> - Optional - Sets the nameservers in resolv - Example: ["10.0.0.2", "10.0.0.3"]
|
166
175
|
# * gateway <~Array> - Optional - Sets the gateway for the interface - Example: ["10.0.0.1"]
|
167
176
|
# * subnetMask <~String> - *REQUIRED* - Set the netmask of the interface - Example: "255.255.255.0"
|
168
177
|
# For other ip settings options see http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.customization.IPSettings.html
|
178
|
+
#
|
179
|
+
# Implement complete customization spec as per https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Specification.html
|
180
|
+
# * encryptionKey <~Array> - Optional, encryption key used to encypt any encrypted passwords
|
181
|
+
# https://pubs.vmware.com/vsphere-51/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.GlobalIPSettings.html
|
182
|
+
# * globalIPSettings <~Hash> - REQUIRED
|
183
|
+
# * dnsServerList <~Array> - Optional, list of dns servers - Example: ["10.0.0.2", "10.0.0.3"]
|
184
|
+
# * dnsSuffixList <~Array> - Optional, List of name resolution suffixes - Example: ["dev.example.com", "example.com"]
|
185
|
+
# * identity <~Hash> - REQUIRED, Network identity and settings, similar to Microsoft's Sysprep tool. This is a Sysprep, LinuxPrep, or SysprepText object
|
186
|
+
# * Sysprep <~Hash> - Optional, representation of a Windows sysprep.inf answer file.
|
187
|
+
# * guiRunOnce: <~Hash> -Optional, representation of the sysprep GuiRunOnce key
|
188
|
+
# * commandList: <~Array> - REQUIRED, list of commands to run at first user logon, after guest customization. - Example: ["c:\sysprep\runaftersysprep.cmd", "c:\sysprep\installpuppet.ps1"]
|
189
|
+
# * guiUnattended: <~Hash> - REQUIRED, representation of the sysprep GuiUnattended key
|
190
|
+
# * autoLogin: boolean - REQUIRED, Flag to determine whether or not the machine automatically logs on as Administrator.
|
191
|
+
# * autoLogonCount: int - REQUIRED, specifies the number of times the machine should automatically log on as Administrator
|
192
|
+
# * password: <~Hash> - REQUIRED, new administrator password for the machine
|
193
|
+
# * plainText: boolean - REQUIRED, specify whether or not the password is in plain text, rather than encrypted
|
194
|
+
# * value: <~String> - REQUIRED, password string
|
195
|
+
# * timeZone: <~int> - REQUIRED, (see here for values https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx)
|
196
|
+
# * identification: <~Hash> - REQUIRED, representation of the sysprep Identification key
|
197
|
+
# * domainAdmin: <~String> - Optional, domain user account used for authentication if the virtual machine is joining a domain
|
198
|
+
# * domainAdminPassword: <~Hash> - Optional, password for the domain user account used for authentication
|
199
|
+
# * plainText: boolean - REQUIRED, specify whether or not the password is in plain text, rather than encrypted
|
200
|
+
# * value: <~String> - REQUIRED, password string
|
201
|
+
# * joinDomain: <~String> - Optional, The domain that the virtual machine should join. If this value is supplied, then domainAdmin and domainAdminPassword must also be supplied
|
202
|
+
# * joinWorkgroup: <~String> - Optional, The workgroup that the virtual machine should join.
|
203
|
+
# * licenseFilePrintData: <~Hash> - Optional, representation of the sysprep LicenseFilePrintData key
|
204
|
+
# * autoMode: <~String> - REQUIRED, Server licensing mode. Two strings are supported: 'perSeat' or 'perServer'
|
205
|
+
# * autoUsers: <~Int> - Optional, This key is valid only if AutoMode = PerServer. The integer value indicates the number of client licenses
|
206
|
+
# * userData: <~Hash> - REQUIRED, representation of the sysprep UserData key
|
207
|
+
# * computerName: <~String> - REQUIRED, The computer name of the (Windows) virtual machine. Will be truncates to 15 characters
|
208
|
+
# * fullName: <~String> - REQUIRED, User's full name
|
209
|
+
# * orgName: <~String> - REQUIRED, User's organization
|
210
|
+
# * productId: <~String> - REQUIRED, serial number for os, ignored if using volume licensed instance
|
211
|
+
# * LinuxPrep: <~Hash> - Optional, contains machine-wide settings (note the uppercase P)
|
212
|
+
# * domain: <~String> - REQUIRED, The fully qualified domain name.
|
213
|
+
# * hostName: <~String> - REQUIRED, the network host name
|
214
|
+
# * hwClockUTC: <~Boolean> - Optional, Specifies whether the hardware clock is in UTC or local time
|
215
|
+
# * timeZone: <~String> - Optional, Case sensistive timezone, valid values can be found at https://pubs.vmware.com/vsphere-51/topic/com.vmware.wssdk.apiref.doc/timezone.html
|
216
|
+
# * SysprepText: <~Hash> - Optional, alternate way to specify the sysprep.inf answer file.
|
217
|
+
# * value: <~String> - REQUIRED, Text for the sysprep.inf answer file.
|
218
|
+
# * nicSettingMap: <~Array> - Optional, IP settings that are specific to a particular virtual network adapter
|
219
|
+
# * Each item in array:
|
220
|
+
# * adapter: <~Hash> - REQUIRED, IP settings for the associated virtual network adapter
|
221
|
+
# * dnsDomain: <~String> - Optional, DNS domain suffix for adapter
|
222
|
+
# * dnsServerList: <~Array> - Optional, list of dns server ip addresses - Example: ["10.0.0.2", "10.0.0.3"]
|
223
|
+
# * gateway: <~Array> - Optional, list of gateways - Example: ["10.0.0.2", "10.0.0.3"]
|
224
|
+
# * ip: <~String> - Optional, but required if static IP
|
225
|
+
# * ipV6Spec: <~Hash> - Optional, IPv^ settings
|
226
|
+
# * ipAddress: <~String> - Optional, but required if setting static IP
|
227
|
+
# * gateway: <~Array> - Optional, list of ipv6 gateways
|
228
|
+
# * netBIOS: <~String> - Optional, NetBIOS settings, if supplied must be one of: disableNetBIOS','enableNetBIOS','enableNetBIOSViaDhcp'
|
229
|
+
# * primaryWINS: <~String> - Optional, IP address of primary WINS server
|
230
|
+
# * secondaryWINS: <~String> - Optional, IP address of secondary WINS server
|
231
|
+
# * subnetMask: <~String> - Optional, subnet mask for adapter
|
232
|
+
# * macAddress: <~String> - Optional, MAC address of adapter being customized. This cannot be set by the client
|
233
|
+
# * options: <~Hash> Optional operations, currently only win options have any value
|
234
|
+
# * changeSID: <~Boolean> - REQUIRED, The customization process should modify the machine's security identifier
|
235
|
+
# * deleteAccounts: <~Boolean> - REQUIRED, If deleteAccounts is true, then all user accounts are removed from the system
|
236
|
+
# * reboot: <~String> - Optional, (defaults to reboot), Action to be taken after running sysprep, must be one of: 'noreboot', 'reboot', 'shutdown'
|
237
|
+
#
|
169
238
|
if ( options.key?('customization_spec') )
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
239
|
+
custom_spec = options['customization_spec']
|
240
|
+
|
241
|
+
# backwards compatablity
|
242
|
+
if custom_spec.key?('domain')
|
243
|
+
# doing this means the old options quash any new ones passed as well... might not be the best way to do it?
|
244
|
+
# any 'old' options overwrite the following:
|
245
|
+
# - custom_spec['identity']['LinuxPrep']
|
246
|
+
# - custom_spec['globalIPSettings['['dnsServerList']
|
247
|
+
# - custom_spec['globalIPSettings']['dnsSuffixList']
|
248
|
+
# - custom_spec['nicSettingMap'][0]['adapter']['ip']
|
249
|
+
# - custom_spec['nicSettingMap'][0]['adapter']['gateway']
|
250
|
+
# - custom_spec['nicSettingMap'][0]['adapter']['subnetMask']
|
251
|
+
# - custom_spec['nicSettingMap'][0]['adapter']['dnsDomain']
|
252
|
+
# - custom_spec['nicSettingMap'][0]['adapter']['dnsServerList']
|
253
|
+
#
|
254
|
+
# we can assume old parameters being passed
|
255
|
+
cust_hostname = custom_spec['hostname'] || options['name']
|
256
|
+
custom_spec['identity'] = Hash.new unless custom_spec.key?('identity')
|
257
|
+
custom_spec['identity']['LinuxPrep'] = {"domain" => custom_spec['domain'], "hostName" => cust_hostname, "timeZone" => custom_spec['time_zone']}
|
258
|
+
|
259
|
+
if custom_spec.key?('ipsettings')
|
260
|
+
custom_spec['globalIPSettings']=Hash.new unless custom_spec.key?('globalIPSettings')
|
261
|
+
custom_spec['globalIPSettings']['dnsServerList'] = custom_spec['ipsettings']['dnsServerList'] if custom_spec['ipsettings'].key?('dnsServerList')
|
262
|
+
custom_spec['globalIPSettings']['dnsSuffixList'] = custom_spec['dnsSuffixList'] || [custom_spec['domain']] if ( custom_spec['dnsSuffixList'] || custom_spec['domain'])
|
263
|
+
end
|
264
|
+
|
265
|
+
if (custom_spec['ipsettings'].key?('ip') or custom_spec['ipsettings'].key?('gateway') or custom_spec['ipsettings'].key?('subnetMask') or custom_spec['ipsettings'].key?('domain') or custom_spec['ipsettings'].key?('dnsServerList'))
|
266
|
+
if custom_spec['ipsettings'].key?('ip')
|
267
|
+
raise ArgumentError, "subnetMask is required for static ip" unless custom_spec["ipsettings"].key?("subnetMask")
|
268
|
+
end
|
269
|
+
custom_spec['nicSettingMap']=Array.new unless custom_spec.key?('nicSettingMap')
|
270
|
+
custom_spec['nicSettingMap'][0]=Hash.new unless custom_spec['nicSettingMap'].length > 0
|
271
|
+
custom_spec['nicSettingMap'][0]['adapter']=Hash.new unless custom_spec['nicSettingMap'][0].key?('adapter')
|
272
|
+
custom_spec['nicSettingMap'][0]['adapter']['ip'] = custom_spec['ipsettings']['ip'] if custom_spec['ipsettings'].key?('ip')
|
273
|
+
custom_spec['nicSettingMap'][0]['adapter']['gateway'] = custom_spec['ipsettings']['gateway'] if custom_spec['ipsettings'].key?('gateway')
|
274
|
+
custom_spec['nicSettingMap'][0]['adapter']['subnetMask'] = custom_spec['ipsettings']['subnetMask'] if custom_spec['ipsettings'].key?('subnetMask')
|
275
|
+
custom_spec['nicSettingMap'][0]['adapter']['dnsDomain'] = custom_spec['ipsettings']['domain'] if custom_spec['ipsettings'].key?('domain')
|
276
|
+
custom_spec['nicSettingMap'][0]['adapter']['dnsServerList'] = custom_spec['ipsettings']['dnsServerList'] if custom_spec['ipsettings'].key?('dnsServerList')
|
277
|
+
end
|
278
|
+
end
|
279
|
+
### End of backwards compatability
|
280
|
+
|
281
|
+
## requirements check here ##
|
282
|
+
raise ArgumentError, "globalIPSettings are required when using Customization Spec" unless custom_spec.key?('globalIPSettings')
|
283
|
+
raise ArgumentError, "identity is required when using Customization Spec" unless custom_spec.key?('identity')
|
284
|
+
|
285
|
+
# encryptionKey
|
286
|
+
custom_encryptionKey = custom_spec['encryptionKey'] if custom_spec.key?('encryptionKey')
|
287
|
+
custom_encryptionKey ||= nil
|
288
|
+
|
289
|
+
# globalIPSettings
|
290
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.GlobalIPSettings.html
|
291
|
+
custom_globalIPSettings = RbVmomi::VIM::CustomizationGlobalIPSettings.new()
|
292
|
+
custom_globalIPSettings.dnsServerList = custom_spec['globalIPSettings']['dnsServerList'] if custom_spec['globalIPSettings'].key?("dnsServerList")
|
293
|
+
custom_globalIPSettings.dnsSuffixList = custom_spec['globalIPSettings']['dnsSuffixList'] if custom_spec['globalIPSettings'].key?("dnsSuffixList")
|
294
|
+
|
295
|
+
# identity
|
296
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.IdentitySettings.html
|
297
|
+
# Accepts the 3 supported CustomizationIdentitySettings Types:
|
298
|
+
# 1. CustomizationLinuxPrep (LinuxPrep) - note the uppercase P
|
299
|
+
# 2. CustomizationSysprep (Sysprep)
|
300
|
+
# 3. CustomizationSysprepText (SysprepText)
|
301
|
+
# At least one of these is required
|
302
|
+
#
|
303
|
+
identity = custom_spec['identity']
|
304
|
+
if identity.key?("LinuxPrep")
|
305
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.LinuxPrep.html
|
306
|
+
# Fields:
|
307
|
+
# * domain: string **REQUIRED**
|
308
|
+
# * hostName: string (CustomizationName) **REQUIRED** Will use options['name'] if not provided.
|
309
|
+
# * hwClockUTC: boolean
|
310
|
+
# * timeZone: string (https://pubs.vmware.com/vsphere-55/topic/com.vmware.wssdk.apiref.doc/timezone.html)
|
311
|
+
raise ArgumentError, "domain is required when using LinuxPrep identity" unless identity['LinuxPrep'].key?('domain')
|
312
|
+
custom_identity = RbVmomi::VIM::CustomizationLinuxPrep(:domain => identity['LinuxPrep']['domain'])
|
313
|
+
cust_hostname = RbVmomi::VIM::CustomizationFixedName(:name => identity['LinuxPrep']['hostName']) if identity['LinuxPrep'].key?('hostName')
|
314
|
+
cust_hostname ||= RbVmomi::VIM::CustomizationFixedName(:name => options['name'])
|
315
|
+
custom_identity.hostName = cust_hostname
|
316
|
+
custom_identity.hwClockUTC = identity['LinuxPrep']['hwClockUTC'] if identity['LinuxPrep'].key?('hwClockUTC')
|
317
|
+
custom_identity.timeZone = identity['LinuxPrep']['timeZone'] if identity['LinuxPrep'].key?('timeZone')
|
318
|
+
elsif identity.key?("Sysprep")
|
319
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Sysprep.html
|
320
|
+
# Fields:
|
321
|
+
# * guiRunOnce: CustomizationGuiRunOnce
|
322
|
+
# * guiUnattended: CustomizationGuiUnattended **REQUIRED**
|
323
|
+
# * identification: CustomizationIdentification **REQUIRED**
|
324
|
+
# * licenseFilePrintData: CustomizationLicenseFilePrintData
|
325
|
+
# * userData: CustomizationUserData **REQUIRED**
|
326
|
+
#
|
327
|
+
raise ArgumentError, "guiUnattended is required when using Sysprep identity" unless identity['Sysprep'].key?('guiUnattended')
|
328
|
+
raise ArgumentError, "identification is required when using Sysprep identity" unless identity['Sysprep'].key?('identification')
|
329
|
+
raise ArgumentError, "userData is required when using Sysprep identity" unless identity['Sysprep'].key?('userData')
|
330
|
+
if identity['Sysprep']['guiRunOnce']
|
331
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.GuiRunOnce.html
|
332
|
+
# Fields:
|
333
|
+
# * commandList: array of string **REQUIRED***
|
334
|
+
#
|
335
|
+
raise ArgumentError, "commandList is required when using Sysprep identity and guiRunOnce" unless identity['Sysprep']['guiRunOnce'].key?('commandList')
|
336
|
+
cust_guirunonce = RbVmomi::VIM.CustomizationGuiRunOnce( :commandList => identity['Sysprep']['guiRunOnce']['commandList'] )
|
337
|
+
end
|
338
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.GuiUnattended.html
|
339
|
+
# Fields:
|
340
|
+
# * autoLogin: boolean **REQUIRED**
|
341
|
+
# * autoLogonCount: int **REQUIRED**
|
342
|
+
# * timeZone: int (see here for values https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx) **REQUIRED**
|
343
|
+
# * password: CustomizationPassword
|
344
|
+
raise ArgumentError, "guiUnattended->autoLogon is required when using Sysprep identity" unless identity['Sysprep']['guiUnattended'].key?('autoLogon')
|
345
|
+
raise ArgumentError, "guiUnattended->autoLogonCount is required when using Sysprep identity" unless identity['Sysprep']['guiUnattended'].key?('autoLogonCount')
|
346
|
+
raise ArgumentError, "guiUnattended->timeZone is required when using Sysprep identity" unless identity['Sysprep']['guiUnattended'].key?('timeZone')
|
347
|
+
custom_guiUnattended = RbVmomi::VIM.CustomizationGuiUnattended(
|
348
|
+
:autoLogon => identity['Sysprep']['guiUnattended']['autoLogon'],
|
349
|
+
:autoLogonCount => identity['Sysprep']['guiUnattended']['autoLogonCount'],
|
350
|
+
:timeZone => identity['Sysprep']['guiUnattended']['timeZone']
|
351
|
+
)
|
352
|
+
if identity['Sysprep']['guiUnattended']['password']
|
353
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Password.html
|
354
|
+
# Fields:
|
355
|
+
# * plainText: boolean **REQUIRED**
|
356
|
+
# * value: string **REQUIRED**
|
357
|
+
raise ArgumentError, "guiUnattended->password->plainText is required when using Sysprep identity and guiUnattended -> password" unless identity['Sysprep']['guiUnattended']['password'].key?('plainText')
|
358
|
+
raise ArgumentError, "guiUnattended->password->value is required when using Sysprep identity and guiUnattended -> password" unless identity['Sysprep']['guiUnattended']['password'].key?('value')
|
359
|
+
custom_guiUnattended.password = RbVmomi::VIM.CustomizationPassword(
|
360
|
+
:plainText => identity['Sysprep']['guiUnattended']['password']['plainText'],
|
361
|
+
:value => identity['Sysprep']['guiUnattended']['password']['value']
|
362
|
+
)
|
363
|
+
end
|
364
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Identification.html
|
365
|
+
# Fields:
|
366
|
+
# * domainAdmin: string
|
367
|
+
# * domainAdminPassword: CustomizationPassword
|
368
|
+
# * joinDomain: string *If supplied domainAdmin and domainAdminPassword must be set
|
369
|
+
# * joinWorkgroup: string *If supplied, joinDomain, domainAdmin and domainAdminPassword will be ignored
|
370
|
+
custom_identification = RbVmomi::VIM.CustomizationIdentification()
|
371
|
+
if identity['Sysprep']['identification'].key?('joinWorkgroup')
|
372
|
+
custom_identification.joinWorkgroup = identity['Sysprep']['identification']['joinWorkgroup']
|
373
|
+
elsif identity['Sysprep']['identification'].key?('joinDomain')
|
374
|
+
raise ArgumentError, "identification->domainAdmin is required when using Sysprep identity and identification -> joinDomain" unless identity['Sysprep']['identification'].key?('domainAdmin')
|
375
|
+
raise ArgumentError, "identification->domainAdminPassword is required when using Sysprep identity and identification -> joinDomain" unless identity['Sysprep']['identification'].key?('domainAdmin')
|
376
|
+
raise ArgumentError, "identification->domainAdminPassword->plainText is required when using Sysprep identity and identification -> joinDomain" unless identity['Sysprep']['identification']['domainAdminPassword'].key?('plainText')
|
377
|
+
raise ArgumentError, "identification->domainAdminPassword->value is required when using Sysprep identity and identification -> joinDomain" unless identity['Sysprep']['identification']['domainAdminPassword'].key?('value')
|
378
|
+
custom_identification.joinDomain = identity['Sysprep']['identification']['joinDomain']
|
379
|
+
custom_identification.domainAdmin = identity['Sysprep']['identification']['domainAdmin']
|
380
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Password.html
|
381
|
+
# Fields:
|
382
|
+
# * plainText: boolean **REQUIRED**
|
383
|
+
# * value: string **REQUIRED**
|
384
|
+
custom_identification.domainAdminPassword = RbVmomi::VIM.CustomizationPassword(
|
385
|
+
:plainText => identity['Sysprep']['identification']['domainAdminPassword']['plainText'],
|
386
|
+
:value => identity['Sysprep']['identification']['domainAdminPassword']['value']
|
387
|
+
)
|
388
|
+
else
|
389
|
+
raise ArgumentError, "No valid Indentification found, valid values are 'joinWorkgroup' and 'joinDomain'"
|
390
|
+
end
|
391
|
+
if identity['Sysprep'].key?('licenseFilePrintData')
|
392
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.LicenseFilePrintData.html
|
393
|
+
# Fields:
|
394
|
+
# * autoMode: string (CustomizationLicenseDataMode) ** REQUIRED **, valid strings are: 'perSeat' or 'perServer'
|
395
|
+
# * autoUsers: int (valid only if AutoMode = PerServer)
|
396
|
+
raise ArgumentError, "licenseFilePrintData->autoMode is required when using Sysprep identity and licenseFilePrintData" unless identity['Sysprep']['licenseFilePrintData'].key?('autoMode')
|
397
|
+
raise ArgumentError, "Unsupported autoMode, supported modes are : 'perSeat' or 'perServer'" unless ['perSeat', 'perServer'].include? identity['Sysprep']['licenseFilePrintData']['autoMode']
|
398
|
+
custom_licenseFilePrintData = RbVmomi::VIM.CustomizationLicenseFilePrintData(
|
399
|
+
:autoMode => RbVmomi::VIM.CustomizationLicenseDataMode(identity['Sysprep']['licenseFilePrintData']['autoMode'])
|
400
|
+
)
|
401
|
+
if identity['Sysprep']['licenseFilePrintData'].key?('autoUsers')
|
402
|
+
custom_licenseFilePrintData.autoUsers = identity['Sysprep']['licenseFilePrintData']['autoUsers'] if identity['Sysprep']['licenseFilePrintData']['autoMode'] == "PerServer"
|
403
|
+
end
|
404
|
+
end
|
405
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.UserData.html
|
406
|
+
# Fields:
|
407
|
+
# * computerName: string (CustomizationFixedName) **REQUIRED**
|
408
|
+
# * fullName: string **REQUIRED**
|
409
|
+
# * orgName: string **REQUIRED**
|
410
|
+
# * productID: string **REQUIRED**
|
411
|
+
raise ArgumentError, "userData->computerName is required when using Sysprep identity" unless identity['Sysprep']['userData'].key?('computerName')
|
412
|
+
raise ArgumentError, "userData->fullName is required when using Sysprep identity" unless identity['Sysprep']['userData'].key?('fullName')
|
413
|
+
raise ArgumentError, "userData->orgName is required when using Sysprep identity" unless identity['Sysprep']['userData'].key?('orgName')
|
414
|
+
raise ArgumentError, "userData->productId is required when using Sysprep identity" unless identity['Sysprep']['userData'].key?('productId')
|
415
|
+
custom_userData = RbVmomi::VIM.CustomizationUserData(
|
416
|
+
:fullName => identity['Sysprep']['userData']['fullName'],
|
417
|
+
:orgName => identity['Sysprep']['userData']['orgName'],
|
418
|
+
:productId => identity['Sysprep']['userData']['productId'],
|
419
|
+
:computerName => RbVmomi::VIM.CustomizationFixedName(:name => identity['Sysprep']['userData']['computerName'])
|
420
|
+
)
|
421
|
+
|
422
|
+
custom_identity = RbVmomi::VIM::CustomizationSysprep(
|
423
|
+
:guiUnattended => custom_guiUnattended,
|
424
|
+
:identification => custom_identification,
|
425
|
+
:userData => custom_userData
|
426
|
+
)
|
427
|
+
custom_identity.guiRunOnce = cust_guirunonce if defined?(cust_guirunonce)
|
428
|
+
custom_identity.licenseFilePrintData = custom_licenseFilePrintData if defined?(custom_licenseFilePrintData)
|
429
|
+
elsif identity.key?("SysprepText")
|
430
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.SysprepText.html
|
431
|
+
# Fields:
|
432
|
+
# * value: string **REQUIRED**
|
433
|
+
raise ArgumentError, "SysprepText -> value is required when using SysprepText identity" unless identity['SysprepText'].key?('value')
|
434
|
+
custom_identity = RbVmomi::VIM::CustomizationSysprepText(:value => identity['SysprepText']['value'])
|
435
|
+
else
|
436
|
+
raise ArgumentError, "At least one of the following valid identities must be supplied: LinuxPrep, Sysprep, SysprepText"
|
174
437
|
end
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
438
|
+
|
439
|
+
if custom_spec.key?("nicSettingMap")
|
440
|
+
# custom_spec['nicSettingMap'] is an array of adapater mappings:
|
441
|
+
# custom_spec['nicSettingMap'][0]['macAddress']
|
442
|
+
# custom_spec['nicSettingMap'][0]['adapter']['ip']
|
443
|
+
#https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.AdapterMapping.html
|
444
|
+
# Fields:
|
445
|
+
# * adapter: CustomizationIPSettings **REQUIRED**
|
446
|
+
# * macAddress: string
|
447
|
+
raise ArgumentError, "At least one nicSettingMap is required when using nicSettingMap" unless custom_spec['nicSettingMap'].length > 0
|
448
|
+
raise ArgumentError, "Adapter is required when using nicSettingMap" unless custom_spec['nicSettingMap'][0].key?('adapter')
|
449
|
+
|
450
|
+
custom_nicSettingMap = []
|
451
|
+
# need to go through array here for each apapter
|
452
|
+
custom_spec['nicSettingMap'].each do | nic |
|
453
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.customization.IPSettings.html
|
454
|
+
# Fields:
|
455
|
+
# * dnsDomain: string
|
456
|
+
# * gateway: array of string
|
457
|
+
# * ip: CustomizationIpGenerator (string) **REQUIRED IF Assigning Static IP***
|
458
|
+
# * ipV6Spec: CustomizationIPSettingsIpV6AddressSpec
|
459
|
+
# * netBIOS: CustomizationNetBIOSMode (string)
|
460
|
+
# * primaryWINS: string
|
461
|
+
# * secondaryWINS: string
|
462
|
+
# * subnetMask: string - Required if assigning static IP
|
463
|
+
if nic['adapter'].key?('ip')
|
464
|
+
raise ArgumentError, "SubnetMask is required when assigning static IP when using nicSettingMap -> Adapter" unless nic['adapter'].key?('subnetMask')
|
465
|
+
custom_ip = RbVmomi::VIM.CustomizationFixedIp(:ipAddress => nic['adapter']['ip'])
|
466
|
+
else
|
467
|
+
custom_ip = RbVmomi::VIM::CustomizationDhcpIpGenerator.new()
|
468
|
+
end
|
469
|
+
custom_adapter = RbVmomi::VIM.CustomizationIPSettings(:ip => custom_ip)
|
470
|
+
custom_adapter.dnsDomain = nic['adapter']['dnsDomain'] if nic['adapter'].key?('dnsDomain')
|
471
|
+
custom_adapter.dnsServerList = nic['adapter']['dnsServerList'] if nic['adapter'].key?('dnsServerList')
|
472
|
+
custom_adapter.gateway = nic['adapter']['gateway'] if nic['adapter'].key?('gateway')
|
473
|
+
if nic['adapter'].key?('ipV6Spec')
|
474
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.IPSettings.IpV6AddressSpec.html
|
475
|
+
# Fields:
|
476
|
+
# * gateway: array of string
|
477
|
+
# * ip: CustomizationIpV6Generator[] **Required if setting static IP **
|
478
|
+
if nic['adapter']['ipV6Spec'].key?('ipAddress')
|
479
|
+
raise ArgumentError, "SubnetMask is required when assigning static IPv6 when using nicSettingMap -> Adapter -> ipV6Spec" unless nic['adapter']['ipV6Spec'].key?('subnetMask')
|
480
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.FixedIpV6.html
|
481
|
+
# * ipAddress: string **REQUIRED**
|
482
|
+
# * subnetMask: int **REQUIRED**
|
483
|
+
custom_ipv6 = RbVmomi::VIM.CustomizationFixedIpV6(
|
484
|
+
:ipAddress => nic['adapter']['ipV6Spec']['ipAddress'],
|
485
|
+
:subnetMask => nic['adapter']['ipV6Spec']['subnetMask']
|
486
|
+
)
|
487
|
+
else
|
488
|
+
custom_ipv6 = RbVmomi::VIM::CustomizationDhcpIpV6Generator.new()
|
489
|
+
end
|
490
|
+
custom_ipv6Spec = RbVmomo::VIM.CustomizationIPSettingsIpV6AddressSpec(:ip => custom_ipv6)
|
491
|
+
custom_ipv6Spec.gateway = nic['adapter']['ipV6Spec']['gateway'] if nic['adapter']['ipV6Spec'].key?('gateway')
|
492
|
+
custom_adapter.ipV6Spec = custom_ipv6Spec
|
493
|
+
end
|
494
|
+
if nic['adapter'].key?('netBIOS')
|
495
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.IPSettings.NetBIOSMode.html
|
496
|
+
# Fields:
|
497
|
+
# netBIOS: string matching: 'disableNetBIOS','enableNetBIOS' or 'enableNetBIOSViaDhcp' ** REQUIRED **
|
498
|
+
#
|
499
|
+
raise ArgumentError, "Unsupported NetBIOSMode, supported modes are : 'disableNetBIOS','enableNetBIOS' or 'enableNetBIOSViaDhcp'" unless ['disableNetBIOS','enableNetBIOS','enableNetBIOSViaDhcp'].include? nic['adapter']['netBIOS']
|
500
|
+
custom_adapter.netBIOS = RbVmomi::VIM.CustomizationNetBIOSMode(nic['adapter']['netBIOS'])
|
501
|
+
end
|
502
|
+
custom_adapter.primaryWINS = nic['adapter']['primaryWINS'] if nic['adapter'].key?('primaryWINS')
|
503
|
+
custom_adapter.secondaryWINS = nic['adapter']['secondaryWINS'] if nic['adapter'].key?('secondaryWINS')
|
504
|
+
custom_adapter.subnetMask = nic['adapter']['subnetMask'] if nic['adapter'].key?('subnetMask')
|
505
|
+
|
506
|
+
custom_adapter_mapping = RbVmomi::VIM::CustomizationAdapterMapping(:adapter => custom_adapter)
|
507
|
+
custom_adapter_mapping.macAddress = nic['macAddress'] if nic.key?('macAddress')
|
508
|
+
|
509
|
+
# build the adapters array, creates it if not already created, otherwise appends to it
|
510
|
+
custom_nicSettingMap << custom_adapter_mapping
|
511
|
+
end
|
512
|
+
end
|
513
|
+
custom_nicSettingMap = nil if custom_nicSettingMap.length < 1
|
514
|
+
|
515
|
+
if custom_spec.key?("options")
|
516
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Options.html
|
517
|
+
# this currently doesn't have any Linux options, just windows
|
518
|
+
# Fields:
|
519
|
+
# * changeSID: boolean **REQUIRED**
|
520
|
+
# * deleteAccounts: boolean **REQUIRED** **note deleteAccounts is deprecated as of VI API 2.5 so can be ignored
|
521
|
+
# * reboot: CustomizationSysprepRebootOption: (string) one of following 'noreboot', reboot' or 'shutdown' (defaults to reboot)
|
522
|
+
raise ArgumentError, "changeSID id required when using Windows Options" unless custom_spec['options'].key?('changeSID')
|
523
|
+
raise ArgumentError, "deleteAccounts id required when using Windows Options" unless custom_spec['options'].key?('deleteAccounts')
|
524
|
+
custom_options = RbVmomi::VIM::CustomizationWinOptions(
|
525
|
+
:changeSID => custom_spec['options']['changeSID'],
|
526
|
+
:deleteAccounts => custom_spec['options']['deleteAccounts']
|
527
|
+
)
|
528
|
+
if custom_spec['options'].key?('reboot')
|
529
|
+
raise ArgumentError, "Unsupported reboot option, supported options are : 'noreboot', 'reboot' or 'shutdown'" unless ['noreboot','reboot','shutdown'].include? custom_spec['options']['reboot']
|
530
|
+
custom_options.reboot = RBVmomi::VIM.CustomizationSysprepRebootOption(custom_spec['options']['reboot'])
|
531
|
+
end
|
181
532
|
end
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
cust_prep = RbVmomi::VIM::CustomizationLinuxPrep.new(
|
194
|
-
:domain => cust_domain,
|
195
|
-
:hostName => cust_hostname,
|
196
|
-
:hwClockUTC => cust_hwclockutc,
|
197
|
-
:timeZone => cust_timezone)
|
198
|
-
# Build the Custom Adapter Mapping Supports only one eth right now
|
199
|
-
cust_adapter_mapping = [RbVmomi::VIM::CustomizationAdapterMapping.new("adapter" => cust_ip_settings)]
|
200
|
-
# Build the customization Spec
|
201
|
-
customization_spec = RbVmomi::VIM::CustomizationSpec.new(
|
202
|
-
:identity => cust_prep,
|
203
|
-
:globalIPSettings => cust_global_ip_settings,
|
204
|
-
:nicSettingMap => cust_adapter_mapping)
|
533
|
+
custom_options ||=nil
|
534
|
+
|
535
|
+
# https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Specification.html
|
536
|
+
customization_spec = RbVmomi::VIM::CustomizationSpec(
|
537
|
+
:globalIPSettings => custom_globalIPSettings,
|
538
|
+
:identity => custom_identity
|
539
|
+
)
|
540
|
+
customization_spec.encryptionKey = custom_encryptionKey if defined?(custom_encryptionKey)
|
541
|
+
customization_spec.nicSettingMap = custom_nicSettingMap if defined?(custom_nicSettingMap)
|
542
|
+
customization_spec.options = custom_options if defined?(custom_options)
|
543
|
+
|
205
544
|
end
|
206
545
|
customization_spec ||= nil
|
207
546
|
|
@@ -229,7 +568,7 @@ module Fog
|
|
229
568
|
disk_backing.backing.fileName = "[#{disk.backing.datastore.name}]";
|
230
569
|
disk_backing.backing.parent = disk.backing
|
231
570
|
}
|
232
|
-
}
|
571
|
+
}
|
233
572
|
]
|
234
573
|
}
|
235
574
|
vm_mob_ref.ReconfigVM_Task(:spec => disk_spec).wait_for_completion
|
data/lib/tasks/changelog_task.rb
CHANGED
@@ -18,7 +18,6 @@ module Fog
|
|
18
18
|
|
19
19
|
add_commits_to_changelog
|
20
20
|
save_changelog
|
21
|
-
::Rake::Task[:github_release].invoke
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -141,6 +140,7 @@ Watchers | #{watchers}
|
|
141
140
|
'Rodrigo Estebanez',
|
142
141
|
'Rupak Ganguly',
|
143
142
|
'Stepan G. Fedorov',
|
143
|
+
'TerryHowe',
|
144
144
|
'Wesley Beary'
|
145
145
|
].include?(committer)
|
146
146
|
end
|