From e313bc37072f05f1b0d6bc8e14d2e487358cdb3e Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 4 Mar 2024 19:48:46 +0100 Subject: [PATCH] fix bailout if there is no TXT entry --- cmdeploy/src/cmdeploy/dns.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmdeploy/src/cmdeploy/dns.py b/cmdeploy/src/cmdeploy/dns.py index 09b694a3..465ba52e 100644 --- a/cmdeploy/src/cmdeploy/dns.py +++ b/cmdeploy/src/cmdeploy/dns.py @@ -36,12 +36,11 @@ class DNS: cmd = "ip a | grep inet6 | grep 'scope global' | sed -e 's#/64 scope global##' | sed -e 's#inet6##'" return self.shell(cmd).strip() - def get(self, typ: str, domain: str) -> Optional[str]: - """Get a DNS entry""" + def get(self, typ: str, domain: str) -> str: + """Get a DNS entry or empty string if there is none.""" dig_result = self.shell(f"dig -r -q {domain} -t {typ} +short") line = dig_result.partition("\n")[0] - if line: - return line + return line def check_ptr_record(self, ip: str, mail_domain) -> bool: """Check the PTR record for an IPv4 or IPv6 address."""