From 2253a415f41cd76e87a2b129e01a1b0bf37376aa Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Thu, 14 Sep 2017 13:16:02 +0200
Subject: [PATCH] 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.
---
 library/ipadiscovery.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/library/ipadiscovery.py b/library/ipadiscovery.py
index 6adf42b0..a42bc856 100644
--- a/library/ipadiscovery.py
+++ b/library/ipadiscovery.py
@@ -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()
 
-- 
GitLab