diff --git a/porkbun_ddns/porkbun_ddns.py b/porkbun_ddns/porkbun_ddns.py index 2713dc2..a9808c3 100644 --- a/porkbun_ddns/porkbun_ddns.py +++ b/porkbun_ddns/porkbun_ddns.py @@ -68,7 +68,9 @@ def _check_config(self) -> None: def set_subdomain(self, subdomain: str) -> None: self.subdomain = subdomain.lower() - if self.subdomain != '@': + if self.subdomain == '@': + self.fqdn = self.domain + else: self.fqdn = '.'.join([self.subdomain, self.domain]) def get_public_ips(self) -> list: @@ -197,7 +199,7 @@ def delete_records(self): in ["A", "AAAA"]] if self.fqdn in domain_names: for i in self.records: - if i["name"] == self.fqdn: + if i["name"] == self.fqdn and i['type'] in ["A", "AAAA"]: logger.debug('Deleting existing entry:\n{}'.format(json.dumps( {"name": self.fqdn, "type": i['type'], "content": str(i['content'])}))) self._delete_record(i['id'])