VMware: Allow user to set customization specification (#38530)
This fix adds new argument parameter which allows user to set customization specification which is already created with required values like Windows Product Key and Networking details etc. Fixes: #38404 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
6e6325503a
commit
d1cd6ee56d
1 changed files with 20 additions and 0 deletions
|
@ -262,6 +262,12 @@ options:
|
|||
- ' - C(type) (string): Value type, string type by default.'
|
||||
- ' - C(operation): C(remove): This attribute is required only when removing properties.'
|
||||
version_added: '2.6'
|
||||
customization_spec:
|
||||
description:
|
||||
- Unique name identifying the requested customization specification.
|
||||
- This parameter is case sensitive.
|
||||
- If set, then overrides C(customization) parameter values.
|
||||
version_added: '2.6'
|
||||
extends_documentation_fragment: vmware.documentation
|
||||
'''
|
||||
|
||||
|
@ -1267,6 +1273,19 @@ class PyVmomiHelper(PyVmomi):
|
|||
self.change_detected = True
|
||||
|
||||
def customize_vm(self, vm_obj):
|
||||
|
||||
# User specified customization specification
|
||||
custom_spec_name = self.params.get('customization_spec')
|
||||
if custom_spec_name:
|
||||
cc_mgr = self.content.customizationSpecManager
|
||||
if cc_mgr.DoesCustomizationSpecExist(name=custom_spec_name):
|
||||
temp_spec = cc_mgr.GetCustomizationSpec(name=custom_spec_name)
|
||||
self.customspec = temp_spec.spec
|
||||
return
|
||||
else:
|
||||
self.module.fail_json(msg="Unable to find customization specification"
|
||||
" '%s' in given configuration." % custom_spec_name)
|
||||
|
||||
# Network settings
|
||||
adaptermaps = []
|
||||
for network in self.params['networks']:
|
||||
|
@ -2095,6 +2114,7 @@ def main():
|
|||
networks=dict(type='list', default=[]),
|
||||
resource_pool=dict(type='str'),
|
||||
customization=dict(type='dict', default={}, no_log=True),
|
||||
customization_spec=dict(type='str', default=None),
|
||||
vapp_properties=dict(type='list', default=[]),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue