lexicon icon indicating copy to clipboard operation
lexicon copied to clipboard

Can't add CNAME record pointing to other domain using powerdns provider

Open fabiorauber opened this issue 3 years ago • 0 comments

When trying to add a CNAME record to domain foo.com, pointing to server.bar.com using lexicon powerdns provider, the CNAME record gets added with content server.bar.com.foo.com, even when the content variable contains the trailing dot.

I believe the culprit is https://github.com/AnalogJ/lexicon/blob/65b09e99190ff170ffc27bc589e1e589c92a9d74/lexicon/providers/powerdns.py#L154

https://github.com/AnalogJ/lexicon/blob/65b09e99190ff170ffc27bc589e1e589c92a9d74/lexicon/providers/base.py#L202

    def _fqdn_name(self, record_name: str) -> str:
        # strip trailing period from fqdn if present
        record_name = record_name.rstrip(".")
        # check if the record_name is fully specified
        if not record_name.endswith(self.domain):
            record_name = f"{record_name}.{self.domain}"
        return f"{record_name}."  # return the fqdn name

fabiorauber avatar Jun 30 '21 18:06 fabiorauber