Skip to content

Commit

Permalink
Version 3.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
adferrand committed Sep 3, 2020
1 parent 468c208 commit 49959c9
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 121 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.2 - 03/09/2020
### Modified
* Relax versions constraints on Lexicon dependencies until there is a real need.

Expand Down
5 changes: 4 additions & 1 deletion lexicon/providers/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ def authenticate(self):
# ArgsConfigSource needs to be reprocessed to rescope the provided
# args to the delegate provider
new_dict = {}
for (key, value,) in config_source._parameters.items():
for (
key,
value,
) in config_source._parameters.items():
if key.startswith(target_prefix):
new_param_name = re.sub("^{0}".format(target_prefix), "", key)
if provider_name not in new_dict:
Expand Down
5 changes: 3 additions & 2 deletions lexicon/providers/easyname.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ def provider_parser(subparser):
"--auth-username", help="Specify username used to authenticate"
)
subparser.add_argument(
"--auth-password", help="Specify password used to authenticate",
"--auth-password",
help="Specify password used to authenticate",
)


class Provider(BaseProvider):
"""
easyname provider
easyname provider
"""

URLS = {
Expand Down
9 changes: 6 additions & 3 deletions lexicon/providers/exoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def _create_record(self, rtype, name, content):
record["prio"] = self._get_lexicon_option("priority")

payload = self._post(
"/v1/domains/{0}/records".format(self.domain), {"record": record},
"/v1/domains/{0}/records".format(self.domain),
{"record": record},
)

status = "id" in payload.get("record", {})
Expand All @@ -75,7 +76,8 @@ def _list_records(self, rtype=None, name=None, content=None):
name = self._relative_name(name)
filter_query["name"] = name
payload = self._get(
"/v1/domains/{0}/records".format(self.domain), query_params=filter_query,
"/v1/domains/{0}/records".format(self.domain),
query_params=filter_query,
)

records = []
Expand Down Expand Up @@ -127,7 +129,8 @@ def _update_record(self, identifier, rtype=None, name=None, content=None):

for record_id in identifiers:
self._put(
"/v1/domains/{0}/records/{1}".format(self.domain, identifier), record,
"/v1/domains/{0}/records/{1}".format(self.domain, identifier),
record,
)
LOGGER.debug("update_record: %s", record_id)

Expand Down
21 changes: 16 additions & 5 deletions lexicon/providers/gehirn.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
if "." not in identifier:
# delete entire record
path = "/zones/{}/versions/{}/records/{}".format(
self.domain_id, self.version_id, identifier,
self.domain_id,
self.version_id,
identifier,
)
self._delete(path)
LOGGER.debug("delete_record: %s", True)
Expand All @@ -212,7 +214,9 @@ def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
if not record["records"]:
# delete entire record
path = "/zones/{}/versions/{}/records/{}".format(
self.domain_id, self.version_id, record["id"],
self.domain_id,
self.version_id,
record["id"],
)
self._delete(path)
else:
Expand Down Expand Up @@ -240,7 +244,9 @@ def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
continue

path = "/zones/{}/versions/{}/records/{}".format(
self.domain_id, self.version_id, a_record["id"],
self.domain_id,
self.version_id,
a_record["id"],
)
self._delete(path)

Expand Down Expand Up @@ -285,12 +291,17 @@ def _update_internal_record(self, record):
if record.get("id"):
# PUT
path = "/zones/{}/versions/{}/records/{}".format(
self.domain_id, self.version_id, record["id"],
self.domain_id,
self.version_id,
record["id"],
)
return self._put(path, record)

# POST
path = "/zones/{}/versions/{}/records".format(self.domain_id, self.version_id,)
path = "/zones/{}/versions/{}/records".format(
self.domain_id,
self.version_id,
)
return self._post(path, record)

def _build_content(self, rtype, record):
Expand Down
5 changes: 3 additions & 2 deletions lexicon/providers/henet.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ def provider_parser(subparser):
"--auth-username", help="specify username for authentication"
)
subparser.add_argument(
"--auth-password", help="specify password for authentication",
"--auth-password",
help="specify password for authentication",
)


class Provider(BaseProvider):
"""
he.net provider
he.net provider
"""

def __init__(self, config):
Expand Down
10 changes: 8 additions & 2 deletions lexicon/providers/infoblox.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ def _create_record_internal(self, rtype, name, content):
else:
raise Exception("Name not specified, no FQDN could be build")
if rtype.upper() in IB_TYPE2CONTENT:
uri = "{0}{1}".format(self.api_endpoint, IB_TYPE2CONTENT[rtype.upper()][1],)
uri = "{0}{1}".format(
self.api_endpoint,
IB_TYPE2CONTENT[rtype.upper()][1],
)
payload = self._generate_payload(rtype, name, content)
try:
response = self.session.post(uri, data=json.dumps(payload))
Expand Down Expand Up @@ -285,7 +288,10 @@ def _delete_record(self, identifier=None, rtype=None, name=None, content=None):

def _delete_record_internal(self, identifier=None):
if identifier:
uri = "{0}{1}".format(self.api_endpoint, identifier,)
uri = "{0}{1}".format(
self.api_endpoint,
identifier,
)
try:
response = self.session.delete(uri)
except BaseException:
Expand Down
5 changes: 2 additions & 3 deletions lexicon/providers/namecheap.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
return True

def _convert_to_namecheap(self, record):
""" converts from lexicon format record to namecheap format record,
"""converts from lexicon format record to namecheap format record,
suitable to sending through the api to namecheap"""

processed_record = {}
Expand Down Expand Up @@ -292,8 +292,7 @@ def _convert_to_namecheap(self, record):
return processed_record

def _convert_to_lexicon(self, record):
""" converts from namecheap raw record format to lexicon format record
"""
"""converts from namecheap raw record format to lexicon format record"""

name = record["Name"]

Expand Down
2 changes: 1 addition & 1 deletion lexicon/tests/providers/test_directadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _filter_query_parameters(self):

def _filter_response(self, response):
"""See `IntegrationTests._filter_response` for more information on how
to filter the provider response."""
to filter the provider response."""
return response

def _test_parameters_overrides(self):
Expand Down
4 changes: 2 additions & 2 deletions lexicon/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_client_basic_init():


def test_client_legacy_init(monkeypatch):
monkeypatch.setenv('LEXICON_FAKEPROVIDER_AUTH_KEY', 'MY_KEY')
monkeypatch.setenv("LEXICON_FAKEPROVIDER_AUTH_KEY", "MY_KEY")
options = {
"provider_name": "fakeprovider",
"action": "list",
Expand All @@ -45,7 +45,7 @@ def test_client_legacy_init(monkeypatch):
assert client.action == options["action"]
assert client.config.resolve("lexicon:domain") == options["domain"]
assert client.config.resolve("lexicon:type") == options["type"]
assert client.config.resolve("lexicon:fakeprovider:auth_key") == 'MY_KEY'
assert client.config.resolve("lexicon:fakeprovider:auth_key") == "MY_KEY"


def test_client_init_when_domain_includes_subdomain_should_strip():
Expand Down
Loading

0 comments on commit 49959c9

Please sign in to comment.