library/ipadiscovery.py: Allow to use server only also

The discovery was not working if a server has been specified. The domain has
been needed additionally. The domain is now gathered from the server name if
it is missing in this case.
This commit is contained in:
Thomas Woerner
2017-09-14 13:16:02 +02:00
parent 4789595428
commit 2253a415f4

View File

@@ -226,6 +226,10 @@ def main():
module.fail_json(
msg="Invalid hostname, '%s' must not be used." % hostname)
# Get domain from first server if domain is not set, but there are servers
if opt_domain is None and len(opt_servers) > 0:
opt_domain = opt_servers[0][opt_servers[0].find(".")+1:]
# Create the discovery instance
ds = ipadiscovery.IPADiscovery()