Merge pull request #39410 from cetanu/develop

allow non-hostname characters in vmware obj name
This commit is contained in:
Mike Place 2017-02-15 10:35:02 -07:00 committed by GitHub
commit 9e88357f3e

View File

@ -116,7 +116,7 @@ configuration, run :py:func:`test_vcenter_connection`
# Import python libs
from __future__ import absolute_import
from random import randint
from re import findall
from re import findall, split
import pprint
import logging
import time
@ -2570,8 +2570,8 @@ def create(vm_):
global_ip = vim.vm.customization.GlobalIPSettings()
if 'dns_servers' in list(vm_.keys()):
global_ip.dnsServerList = vm_['dns_servers']
hostName = vm_name.split('.')[0]
domainName = vm_name.split('.', 1)[-1]
hostName, domainName = split(r'[^\w-]', vm_name, maxsplit=1)
domainName = domainName.split('.', maxsplit=1)[-1]
if 'Windows' not in object_ref.config.guestFullName:
identity = vim.vm.customization.LinuxPrep()
identity.hostName = vim.vm.customization.FixedName(name=hostName)