diff --git a/temboardagent/inventory.py b/temboardagent/inventory.py index 4804898f..a36091d8 100644 --- a/temboardagent/inventory.py +++ b/temboardagent/inventory.py @@ -33,6 +33,8 @@ def hostname(self, hostname=None): raise Exception("Unsupported OS.") if not check_fqdn(hostname): raise ValueError("Invalid FQDN: %s" % (hostname)) + if '.' not in hostname: + logger.warning("Hostname %s is not a FQDN.", hostname) return hostname def uname(self): diff --git a/temboardagent/tools.py b/temboardagent/tools.py index 5c1db045..55d1106e 100644 --- a/temboardagent/tools.py +++ b/temboardagent/tools.py @@ -130,14 +130,15 @@ def which(prog, search_path=None): def check_fqdn(name): """ Check if a hostname is fully qualified, it must only contain - letters, - and have dots. + letters, - . + We now allow hostname without dot. """ - # StackOverflow #11809631 - if re.match(r'(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?