1
0
mirror of https://github.com/laurivosandi/certidude synced 2024-11-04 20:38:12 +00:00

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

View File

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