Skip to content

Commit

Permalink
Version 3.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Ferrand committed Nov 2, 2020
1 parent 32f1d7d commit af8998a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## master - CURRENT

## 3.4.5 - 02/11/2020
### Added
* Add pagination support to Google Cloud DNS provider (#577)
* Add official support to Python 3.9
Expand Down
13 changes: 7 additions & 6 deletions lexicon/providers/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ def _authenticate(self):
# Create record. If record already exists with the same content, do nothing'
def _create_record(self, rtype, name, content):
content, cf_data = self._format_content(rtype, content)
data = {"type": rtype, "name": self._full_name(name), "content": content, "data": cf_data}
data = {
"type": rtype,
"name": self._full_name(name),
"content": content,
"data": cf_data,
}
if self._get_lexicon_option("ttl"):
data["ttl"] = self._get_lexicon_option("ttl")

Expand Down Expand Up @@ -220,11 +225,7 @@ def _format_content(self, rtype, content):
# fields that make up the record seperately, then the API joins
# them back together
_fp = content.split(" ")
data = {
"algorithm": _fp[0],
"type": _fp[1],
"fingerprint": _fp[2]
}
data = {"algorithm": _fp[0], "type": _fp[1], "fingerprint": _fp[2]}
content = None

return content, data
21 changes: 15 additions & 6 deletions lexicon/providers/godaddy.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def _create_record(self, rtype, name, content):
ttl = self._get_lexicon_option("ttl")

# Retrieve existing data in DNS zone.
records = self._get("/domains/{0}/records/{1}/{2}".format(domain, rtype, relative_name))
records = self._get(
"/domains/{0}/records/{1}/{2}".format(domain, rtype, relative_name)
)

# Check if a record already matches given parameters
for record in records:
Expand All @@ -112,7 +114,9 @@ def _create_record(self, rtype, name, content):
records.append(data)

# Insert the record
self._put("/domains/{0}/records/{1}/{2}".format(domain, rtype, relative_name), records)
self._put(
"/domains/{0}/records/{1}/{2}".format(domain, rtype, relative_name), records
)

LOGGER.debug("create_record: %s %s %s", rtype, name, content)

Expand Down Expand Up @@ -159,11 +163,16 @@ def _update_record(self, identifier, rtype=None, name=None, content=None):

# Synchronize data with updated records into DNS zone.
if updated_record is not None:
if identifier and self._relative_name(updated_record['name']) != relative_name:
self._put('/domains/{0}/records/{1}'.format(domain, rtype), records)
if (
identifier
and self._relative_name(updated_record["name"]) != relative_name
):
self._put("/domains/{0}/records/{1}".format(domain, rtype), records)
else:
self._put('/domains/{0}/records/{1}/{2}'.format(domain, rtype, relative_name),
updated_record)
self._put(
"/domains/{0}/records/{1}/{2}".format(domain, rtype, relative_name),
updated_record,
)

LOGGER.debug("update_record: %s %s %s", rtype, name, content)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "dns-lexicon"
version = "3.4.4"
version = "3.4.5"
description = "Manipulate DNS records on various DNS providers in a standardized/agnostic way"
license = "MIT"
keywords = [
Expand Down

0 comments on commit af8998a

Please sign in to comment.