Commit a2bee86e authored by Adrien Dorsaz's avatar Adrien Dorsaz

code style: follow pep8 recommendation of 99 max char by line

parent 68e54ce8
Pipeline #272 failed with stages
in 13 minutes and 37 seconds
...@@ -64,20 +64,20 @@ compile: ...@@ -64,20 +64,20 @@ compile:
lint: lint:
extends: .check extends: .check
script: script:
- pylint3 acme_dns_tiny.py - pylint3 --max-line-length=99 acme_dns_tiny.py
- pylint3 tools/acme_account_deactivate.py - pylint3 --max-line-length=99 tools/acme_account_deactivate.py
- pylint3 tools/acme_account_rollover.py - pylint3 --max-line-length=99 tools/acme_account_rollover.py
- pylint3 tests/config_factory.py - pylint3 --max-line-length=99 tests/config_factory.py
- pylint3 tests/staging_test_acme_dns_tiny.py - pylint3 --max-line-length=99 tests/staging_test_acme_dns_tiny.py
- pylint3 tests/unit_test_acme_dns_tiny.py - pylint3 --max-line-length=99 tests/unit_test_acme_dns_tiny.py
- pylint3 tests/staging_test_acme_account_deactivate.py - pylint3 --max-line-length=99 tests/staging_test_acme_account_deactivate.py
- pylint3 tests/staging_test_acme_account_rollover.py - pylint3 --max-line-length=99 tests/staging_test_acme_account_rollover.py
pep8: pep8:
extends: .check extends: .check
script: script:
- pycodestyle --max-line-length=100 --ignore=E401,W503 --exclude=tests . - pycodestyle --max-line-length=99 --ignore=E401,W503 --exclude=tests .
- pycodestyle --max-line-length=100 --ignore=E722 tests - pycodestyle --max-line-length=99 --ignore=E722 tests
jessie-ut: jessie-ut:
extends: .unit_test extends: .unit_test
......
...@@ -169,7 +169,8 @@ def get_crt(config, log=LOGGER): ...@@ -169,7 +169,8 @@ def get_crt(config, log=LOGGER):
log.info("Update contact information if needed.") log.info("Update contact information if needed.")
if ("contact" in account_request if ("contact" in account_request
and set(account_request["contact"]) != set(account_info["contact"])): 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: if http_response.status_code == 200:
log.debug(" - Account updated with latest contact informations.") log.debug(" - Account updated with latest contact informations.")
else: else:
...@@ -190,7 +191,8 @@ def get_crt(config, log=LOGGER): ...@@ -190,7 +191,8 @@ def get_crt(config, log=LOGGER):
and order["type"] == "urn:ietf:params:acme:error:userActionRequired"): and order["type"] == "urn:ietf:params:acme:error:userActionRequired"):
raise ValueError(("Order creation failed ({0}). Read Terms of Service ({1}), then follow " raise ValueError(("Order creation failed ({0}). Read Terms of Service ({1}), then follow "
"your CA instructions: {2}") "your CA instructions: {2}")
.format(order["detail"], http_response.headers['Link'], order["instance"])) .format(order["detail"],
http_response.headers['Link'], order["instance"]))
else: else:
raise ValueError("Error getting new Order: {0} {1}" raise ValueError("Error getting new Order: {0} {1}"
.format(http_response.status_code, order)) .format(http_response.status_code, order))
...@@ -240,7 +242,8 @@ def get_crt(config, log=LOGGER): ...@@ -240,7 +242,8 @@ def get_crt(config, log=LOGGER):
while challenge_verified is False: while challenge_verified is False:
try: try:
log.debug(('Self test (try: %s): Check resource with value "%s" exits on ' 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: for response in resolver.query(dnsrr_domain, rdtype="TXT").rrset:
log.debug(" - Found value %s", response.to_text()) log.debug(" - Found value %s", response.to_text())
challenge_verified = (challenge_verified challenge_verified = (challenge_verified
...@@ -281,7 +284,8 @@ def get_crt(config, log=LOGGER): ...@@ -281,7 +284,8 @@ def get_crt(config, log=LOGGER):
_update_dns(dnsrr_set, "delete") _update_dns(dnsrr_set, "delete")
log.info("Request to finalize the order (all chalenge have been completed)") 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}) http_response, result = _send_signed_request(order["finalize"], {"csr": csr_der})
if http_response.status_code != 200: if http_response.status_code != 200:
raise ValueError("Error while sending the CSR: {0} {1}" raise ValueError("Error while sending the CSR: {0} {1}"
......
...@@ -141,7 +141,8 @@ def generate_acme_dns_tiny_config(): # pylint: disable=too-many-locals,too-many ...@@ -141,7 +141,8 @@ def generate_acme_dns_tiny_config(): # pylint: disable=too-many-locals,too-many
wild_san_conf = NamedTemporaryFile(delete=False) wild_san_conf = NamedTemporaryFile(delete=False)
with open("/etc/ssl/openssl.cnf", 'r') as opensslcnf: with open("/etc/ssl/openssl.cnf", 'r') as opensslcnf:
wild_san_conf.write(opensslcnf.read().encode("utf8")) 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) wild_san_conf.seek(0)
Popen(["openssl", "req", "-new", "-sha256", "-key", domain_key, Popen(["openssl", "req", "-new", "-sha256", "-key", domain_key,
"-subj", "/", "-reqexts", "SAN", "-config", wild_san_conf.name, "-subj", "/", "-reqexts", "SAN", "-config", wild_san_conf.name,
......
...@@ -206,13 +206,15 @@ class TestACMEDNSTiny(unittest.TestCase): ...@@ -206,13 +206,15 @@ class TestACMEDNSTiny(unittest.TestCase):
"""Can't use the account key for the CSR.""" """Can't use the account key for the CSR."""
self.assertRaisesRegex(ValueError, self.assertRaisesRegex(ValueError,
"certificate public key must be different than account key", "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): def test_failure_dns_update_tsigkeyname(self):
"""Fail to update DNS records by invalid TSIG Key name.""" """Fail to update DNS records by invalid TSIG Key name."""
self.assertRaisesRegex(ValueError, self.assertRaisesRegex(ValueError,
"Error updating DNS", "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 if __name__ == "__main__": # pragma: no cover
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment