Better fallback for FQDN detection

This commit is contained in:
Lauri Võsandi 2017-06-04 14:33:47 +00:00
parent 0a98b3f82e
commit ecb1d9b3f3
1 changed files with 1 additions and 2 deletions

View File

@ -20,8 +20,7 @@ STORAGE_PATH = "/var/lib/certidude/"
try:
FQDN = socket.getaddrinfo(socket.gethostname(), 0, socket.AF_INET, 0, 0, socket.AI_CANONNAME)[0][3]
except socket.gaierror:
click.echo("Failed to resolve fully qualified hostname of this machine, make sure hostname -f works")
sys.exit(254)
FQDN = socket.gethostname()
try:
HOSTNAME, DOMAIN = FQDN.split(".", 1)