From a2bee86efde1850a92d75b2e5f0dc91abb58ccbd Mon Sep 17 00:00:00 2001 From: Adrien Dorsaz Date: Fri, 12 Jun 2020 23:03:29 +0200 Subject: [PATCH] code style: follow pep8 recommendation of 99 max char by line --- .gitlab-ci.yml | 20 ++++++++++---------- acme_dns_tiny.py | 12 ++++++++---- tests/config_factory.py | 3 ++- tests/staging_test_acme_dns_tiny.py | 6 ++++-- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 683866d..e305244 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,20 +64,20 @@ compile: lint: extends: .check script: - - pylint3 acme_dns_tiny.py - - pylint3 tools/acme_account_deactivate.py - - pylint3 tools/acme_account_rollover.py - - pylint3 tests/config_factory.py - - pylint3 tests/staging_test_acme_dns_tiny.py - - pylint3 tests/unit_test_acme_dns_tiny.py - - pylint3 tests/staging_test_acme_account_deactivate.py - - pylint3 tests/staging_test_acme_account_rollover.py + - pylint3 --max-line-length=99 acme_dns_tiny.py + - pylint3 --max-line-length=99 tools/acme_account_deactivate.py + - pylint3 --max-line-length=99 tools/acme_account_rollover.py + - pylint3 --max-line-length=99 tests/config_factory.py + - pylint3 --max-line-length=99 tests/staging_test_acme_dns_tiny.py + - pylint3 --max-line-length=99 tests/unit_test_acme_dns_tiny.py + - pylint3 --max-line-length=99 tests/staging_test_acme_account_deactivate.py + - pylint3 --max-line-length=99 tests/staging_test_acme_account_rollover.py pep8: extends: .check script: - - pycodestyle --max-line-length=100 --ignore=E401,W503 --exclude=tests . - - pycodestyle --max-line-length=100 --ignore=E722 tests + - pycodestyle --max-line-length=99 --ignore=E401,W503 --exclude=tests . + - pycodestyle --max-line-length=99 --ignore=E722 tests jessie-ut: extends: .unit_test diff --git a/acme_dns_tiny.py b/acme_dns_tiny.py index cbad341..ff5bd06 100644 --- a/acme_dns_tiny.py +++ b/acme_dns_tiny.py @@ -169,7 +169,8 @@ def get_crt(config, log=LOGGER): log.info("Update contact information if needed.") if ("contact" in account_request and set(account_request["contact"]) != set(account_info["contact"])): - http_response, result = _send_signed_request(private_acme_signature["kid"], account_request) + http_response, result = _send_signed_request(private_acme_signature["kid"], + account_request) if http_response.status_code == 200: log.debug(" - Account updated with latest contact informations.") else: @@ -190,7 +191,8 @@ def get_crt(config, log=LOGGER): and order["type"] == "urn:ietf:params:acme:error:userActionRequired"): raise ValueError(("Order creation failed ({0}). Read Terms of Service ({1}), then follow " "your CA instructions: {2}") - .format(order["detail"], http_response.headers['Link'], order["instance"])) + .format(order["detail"], + http_response.headers['Link'], order["instance"])) else: raise ValueError("Error getting new Order: {0} {1}" .format(http_response.status_code, order)) @@ -240,7 +242,8 @@ def get_crt(config, log=LOGGER): while challenge_verified is False: try: log.debug(('Self test (try: %s): Check resource with value "%s" exits on ' - 'nameservers: %s'), number_check_fail, keydigest64, resolver.nameservers) + 'nameservers: %s'), number_check_fail, keydigest64, + resolver.nameservers) for response in resolver.query(dnsrr_domain, rdtype="TXT").rrset: log.debug(" - Found value %s", response.to_text()) challenge_verified = (challenge_verified @@ -281,7 +284,8 @@ def get_crt(config, log=LOGGER): _update_dns(dnsrr_set, "delete") log.info("Request to finalize the order (all chalenge have been completed)") - csr_der = _base64(_openssl("req", ["-in", config["acmednstiny"]["CSRFile"], "-outform", "DER"])) + csr_der = _base64(_openssl("req", ["-in", config["acmednstiny"]["CSRFile"], + "-outform", "DER"])) http_response, result = _send_signed_request(order["finalize"], {"csr": csr_der}) if http_response.status_code != 200: raise ValueError("Error while sending the CSR: {0} {1}" diff --git a/tests/config_factory.py b/tests/config_factory.py index 160e6db..82a7ce4 100644 --- a/tests/config_factory.py +++ b/tests/config_factory.py @@ -141,7 +141,8 @@ def generate_acme_dns_tiny_config(): # pylint: disable=too-many-locals,too-many wild_san_conf = NamedTemporaryFile(delete=False) with open("/etc/ssl/openssl.cnf", 'r') as opensslcnf: wild_san_conf.write(opensslcnf.read().encode("utf8")) - wild_san_conf.write("\n[SAN]\nsubjectAltName=DNS:{0},DNS:*.{0}\n".format(DOMAIN).encode("utf8")) + wild_san_conf.write("\n[SAN]\nsubjectAltName=DNS:{0},DNS:*.{0}\n" + .format(DOMAIN).encode("utf8")) wild_san_conf.seek(0) Popen(["openssl", "req", "-new", "-sha256", "-key", domain_key, "-subj", "/", "-reqexts", "SAN", "-config", wild_san_conf.name, diff --git a/tests/staging_test_acme_dns_tiny.py b/tests/staging_test_acme_dns_tiny.py index 346619c..c2f1e00 100644 --- a/tests/staging_test_acme_dns_tiny.py +++ b/tests/staging_test_acme_dns_tiny.py @@ -206,13 +206,15 @@ class TestACMEDNSTiny(unittest.TestCase): """Can't use the account key for the CSR.""" self.assertRaisesRegex(ValueError, "certificate public key must be different than account key", - acme_dns_tiny.main, [self.configs['account_as_domain'], "--verbose"]) + acme_dns_tiny.main, [self.configs['account_as_domain'], + "--verbose"]) def test_failure_dns_update_tsigkeyname(self): """Fail to update DNS records by invalid TSIG Key name.""" self.assertRaisesRegex(ValueError, "Error updating DNS", - acme_dns_tiny.main, [self.configs['invalid_tsig_name'], "--verbose"]) + acme_dns_tiny.main, [self.configs['invalid_tsig_name'], + "--verbose"]) if __name__ == "__main__": # pragma: no cover -- GitLab