snobear/ezmomi

Deploy fails with certain characters in hostname

derchrisuk opened this issue · 1 comments

Not sure if this is a problem of ezmomi of pyvmomi.
When I try to deploy a template, and use a . or _ in the hostname, the deploy fails with this:

pyVmomi.VmomiSupport.InvalidArgument: (vmodl.fault.InvalidArgument) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = 'A specified parameter was not correct. \nspec.identity.hostName',
faultCause = <unset>,
faultMessage = (vmodl.LocalizableMessage) [],
invalidProperty = u'spec.identity.hostName'
}

I fixed my issue buy using the following to remove certain special characters from the hostname:

ident.hostName.name = self.config['hostname'].translate(None, '._!@#^%$&')