vmware_guest: Fix windows joindomain customization (#20303)

This commit is contained in:
aperigault 2017-01-18 11:52:51 +01:00 committed by John R Barker
parent b2a16379c8
commit e9704b389b

View file

@ -1062,10 +1062,15 @@ class PyVmomiHelper(object):
ident.userData.orgName = str(self.params['customization']['productid'])
if 'joindomain' in self.params['customization']:
# TODO: Escalate if domainAdmin and domainPassword are not provided
if 'domainadmin' not in self.params['customization'] or 'domainadminpassword' not in self.params['customization']:
self.module.fail_json(msg="'domainadmin' and 'domainadminpassword' entries are mandatory in 'customization' section to use joindomain feature")
ident.identification.domainAdmin = str(self.params['customization'].get('domainadmin'))
ident.identification.domainAdminPassword = str(self.params['customization'].get('domainadminpassword'))
ident.identification.joinDomain = str(self.params['customization'].get('joindomain'))
ident.identification.domainAdminPassword = vim.vm.customization.Password()
ident.identification.domainAdminPassword.value = str(self.params['customization'].get('domainadminpassword'))
ident.identification.domainAdminPassword.plainText = True
elif 'joinworkgroup' in self.params['customization']:
ident.identification.joinWorkgroup = str(self.params['customization'].get('joinworkgroup'))