ipatests: Allow using FQDN with trailing dot as final hostname

When creating a BaseHost instance, the machine's hostname was
reconfigured to have the same shortname prepended the domain name
of the domain where it was defined.

However, it makes sense in certain use cases to define hosts
that have hostnames other than belonging directly in the domain
they were defined in.

Treat input hostnames with trailing dots as static FQDNs that
will not be changed by the name of the domain they were defined in.

Reviewed-By: Petr Viktorin <pviktori@redhat.com>
This commit is contained in:
Tomas Babej authored and Petr Viktorin committed 2014-04-17 16:31:11 +02:00
1 parent 24aa0a91e5
commit 49a59d1292
1 file changed
+5 -1
+5 -1
View File
@@ -41,7 +41,11 @@ class BaseHost(object):
shortname, dot, ext_domain = hostname.partition('.')
self.shortname = shortname
self.hostname = str(shortname + '.' + self.domain.name)
self.hostname = (hostname[:-1]
if hostname.endswith('.')
else shortname + '.' + self.domain.name)
self.external_hostname = str(external_hostname or hostname)
self.netbios = self.domain.name.split('.')[0].upper()