Merge branch 'master' into reverter

Conflicts:
	letsencrypt/client/augeas_configurator.py
This commit is contained in:
James Kasten
2015-01-25 04:28:09 -08:00
10 changed files with 41 additions and 34 deletions
+6 -2
View File
@@ -72,7 +72,11 @@ style](#coding-style)**. The following tools are there to help you:
## Documentation ## Documentation
In order to generate the sphinx documentation, run the following commands. The official documentation is available at
https://letsencrypt.readthedocs.org.
In order to generate the Sphinx documentation, run the following
commands.
``` ```
./venv/bin/python setup.py docs ./venv/bin/python setup.py docs
@@ -80,7 +84,7 @@ cd docs
make clean html SPHINXBUILD=../venv/bin/sphinx-build make clean html SPHINXBUILD=../venv/bin/sphinx-build
``` ```
This should generate documentation in the /lets-encrypt-preview/docs/_build/html This should generate documentation in the `docs/_build/html`
directory. directory.
### Coding style ### Coding style
+2 -5
View File
@@ -338,9 +338,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
return vhs return vhs
# pylint: disable=anomalous-backslash-in-string
def is_name_vhost(self, target_addr): def is_name_vhost(self, target_addr):
"""Returns if vhost is a name based vhost r"""Returns if vhost is a name based vhost
NameVirtualHost was deprecated in Apache 2.4 as all VirtualHosts are NameVirtualHost was deprecated in Apache 2.4 as all VirtualHosts are
now NameVirtualHosts. If version is earlier than 2.4, check if addr now NameVirtualHosts. If version is earlier than 2.4, check if addr
@@ -958,10 +957,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
########################################################################### ###########################################################################
# Challenges Section # Challenges Section
########################################################################### ###########################################################################
# pylint: disable=no-self-use, unused-argument def get_chall_pref(self, unused_domain): # pylint: disable=no-self-use
def get_chall_pref(self, domain):
"""Return list of challenge preferences.""" """Return list of challenge preferences."""
return ["dvsni"] return ["dvsni"]
def perform(self, chall_list): def perform(self, chall_list):
+3 -3
View File
@@ -43,8 +43,7 @@ class Addr(object):
return self.__class__((self.tup[0], port)) return self.__class__((self.tup[0], port))
# pylint: disable=too-few-public-methods class VirtualHost(object): # pylint: disable=too-few-public-methods
class VirtualHost(object):
"""Represents an Apache Virtualhost. """Represents an Apache Virtualhost.
:ivar str filep: file path of VH :ivar str filep: file path of VH
@@ -58,7 +57,8 @@ class VirtualHost(object):
""" """
def __init__(self, filep, path, addrs, ssl, enabled, names=None): # pylint: disable=too-many-arguments def __init__(self, filep, path, addrs, ssl, enabled, names=None):
# pylint: disable=too-many-arguments
"""Initialize a VH.""" """Initialize a VH."""
self.filep = filep self.filep = filep
self.path = path self.path = path
+1 -1
View File
@@ -144,8 +144,8 @@ class Client(object):
return self.network.send_and_receive_expected( return self.network.send_and_receive_expected(
acme.certificate_request(csr_der, self.authkey.pem), "certificate") acme.certificate_request(csr_der, self.authkey.pem), "certificate")
# pylint: disable=no-self-use
def save_certificate(self, certificate_dict, cert_path, chain_path): def save_certificate(self, certificate_dict, cert_path, chain_path):
# pylint: disable=no-self-use
"""Saves the certificate received from the ACME server. """Saves the certificate received from the ACME server.
:param dict certificate_dict: certificate message from server :param dict certificate_dict: certificate message from server
+1 -2
View File
@@ -25,8 +25,7 @@ class ClientAuthenticator(object):
""" """
self.rec_token = recovery_token.RecoveryToken(server) self.rec_token = recovery_token.RecoveryToken(server)
# pylint: disable=unused-argument,no-self-use def get_chall_pref(self, unused_domain): # pylint: disable=no-self-use
def get_chall_pref(self, domain):
"""Return list of challenge preferences.""" """Return list of challenge preferences."""
return ["recoveryToken"] return ["recoveryToken"]
+18 -9
View File
@@ -42,10 +42,12 @@ class NcursesDisplay(CommonDisplayMixin):
self.width = width self.width = width
self.height = height self.height = height
def generic_notification(self, message): # pylint: disable=missing-docstring def generic_notification(self, message):
# pylint: disable=missing-docstring
self.dialog.msgbox(message, width=self.width) self.dialog.msgbox(message, width=self.width)
def generic_menu(self, message, choices, unused_input_text=""): # pylint: disable=missing-docstring def generic_menu(self, message, choices, unused_input_text=""):
# pylint: disable=missing-docstring
# Can accept either tuples or just the actual choices # Can accept either tuples or just the actual choices
if choices and isinstance(choices[0], tuple): if choices and isinstance(choices[0], tuple):
code, selection = self.dialog.menu( code, selection = self.dialog.menu(
@@ -61,7 +63,8 @@ class NcursesDisplay(CommonDisplayMixin):
def generic_input(self, message): # pylint: disable=missing-docstring def generic_input(self, message): # pylint: disable=missing-docstring
return self.dialog.inputbox(message) return self.dialog.inputbox(message)
def generic_yesno(self, message, yes_label="Yes", no_label="No"): # pylint: disable=missing-docstring def generic_yesno(self, message, yes_label="Yes", no_label="No"):
# pylint: disable=missing-docstring
return self.dialog.DIALOG_OK == self.dialog.yesno( return self.dialog.DIALOG_OK == self.dialog.yesno(
message, self.height, self.width, message, self.height, self.width,
yes_label=yes_label, no_label=no_label) yes_label=yes_label, no_label=no_label)
@@ -73,7 +76,8 @@ class NcursesDisplay(CommonDisplayMixin):
choices=choices) choices=choices)
return code, [str(s) for s in names] return code, [str(s) for s in names]
def success_installation(self, domains): # pylint: disable=missing-docstring def success_installation(self, domains):
# pylint: disable=missing-docstring
self.dialog.msgbox( self.dialog.msgbox(
"\nCongratulations! You have successfully enabled " "\nCongratulations! You have successfully enabled "
+ gen_https_names(domains) + "!", width=self.width) + gen_https_names(domains) + "!", width=self.width)
@@ -127,13 +131,15 @@ class FileDisplay(CommonDisplayMixin):
super(FileDisplay, self).__init__() super(FileDisplay, self).__init__()
self.outfile = outfile self.outfile = outfile
def generic_notification(self, message): # pylint: disable=missing-docstring def generic_notification(self, message):
# pylint: disable=missing-docstring
side_frame = '-' * 79 side_frame = '-' * 79
msg = textwrap.fill(message, 80) msg = textwrap.fill(message, 80)
self.outfile.write("\n%s\n%s\n%s\n" % (side_frame, msg, side_frame)) self.outfile.write("\n%s\n%s\n%s\n" % (side_frame, msg, side_frame))
raw_input("Press Enter to Continue") raw_input("Press Enter to Continue")
def generic_menu(self, message, choices, input_text=""): # pylint: disable=missing-docstring def generic_menu(self, message, choices, input_text=""):
# pylint: disable=missing-docstring
# Can take either tuples or single items in choices list # Can take either tuples or single items in choices list
if choices and isinstance(choices[0], tuple): if choices and isinstance(choices[0], tuple):
choices = ["%s - %s" % (c[0], c[1]) for c in choices] choices = ["%s - %s" % (c[0], c[1]) for c in choices]
@@ -153,7 +159,8 @@ class FileDisplay(CommonDisplayMixin):
return code, (selection - 1) return code, (selection - 1)
def generic_input(self, message): # pylint: disable=no-self-use,missing-docstring def generic_input(self, message):
# pylint: disable=no-self-use,missing-docstring
ans = raw_input("%s (Enter c to cancel)\n" % message) ans = raw_input("%s (Enter c to cancel)\n" % message)
if ans.startswith('c') or ans.startswith('C'): if ans.startswith('c') or ans.startswith('C'):
@@ -161,7 +168,8 @@ class FileDisplay(CommonDisplayMixin):
else: else:
return OK, ans return OK, ans
def generic_yesno(self, message, unused_yes_label="", unused_no_label=""): # pylint: disable=missing-docstring def generic_yesno(self, message, unused_yes_label="", unused_no_label=""):
# pylint: disable=missing-docstring
self.outfile.write("\n%s\n" % textwrap.fill(message, 80)) self.outfile.write("\n%s\n" % textwrap.fill(message, 80))
ans = raw_input("y/n: ") ans = raw_input("y/n: ")
return ans.startswith('y') or ans.startswith('Y') return ans.startswith('y') or ans.startswith('Y')
@@ -211,7 +219,8 @@ class FileDisplay(CommonDisplayMixin):
return code, selection return code, selection
def success_installation(self, domains): # pylint: disable=missing-docstring def success_installation(self, domains):
# pylint: disable=missing-docstring
side_frame = '*' * 79 side_frame = '*' * 79
msg = textwrap.fill("Congratulations! You have successfully " msg = textwrap.fill("Congratulations! You have successfully "
"enabled %s!" % gen_https_names(domains)) "enabled %s!" % gen_https_names(domains))
+1 -2
View File
@@ -118,8 +118,7 @@ class Revoker(object):
else: else:
exit(0) exit(0)
# pylint: disable=no-self-use def remove_cert_key(self, cert): # pylint: disable=no-self-use
def remove_cert_key(self, cert):
"""Remove certificate and key. """Remove certificate and key.
:param dict cert: Cert dict used throughout revocation :param dict cert: Cert dict used throughout revocation
@@ -42,8 +42,7 @@ class ApacheParserTest(util.ApacheTest):
file_path = os.path.join( file_path = os.path.join(
self.config_path, "sites-available", "letsencrypt.conf") self.config_path, "sites-available", "letsencrypt.conf")
# pylint: disable=protected-access self.parser._parse_file(file_path) # pylint: disable=protected-access
self.parser._parse_file(file_path)
# search for the httpd incl # search for the httpd incl
matches = self.parser.aug.match( matches = self.parser.aug.match(
@@ -17,7 +17,6 @@ TRANSLATE = {
} }
# pylint: disable=protected-access
class SatisfyChallengesTest(unittest.TestCase): class SatisfyChallengesTest(unittest.TestCase):
"""verify_identities test.""" """verify_identities test."""
@@ -42,7 +41,7 @@ class SatisfyChallengesTest(unittest.TestCase):
msg = acme_util.get_chall_msg(dom, "nonce0", challenge) msg = acme_util.get_chall_msg(dom, "nonce0", challenge)
self.handler.add_chall_msg(dom, msg, "dummy_key") self.handler.add_chall_msg(dom, msg, "dummy_key")
self.handler._satisfy_challenges() self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 1) self.assertEqual(len(self.handler.responses), 1)
self.assertEqual(len(self.handler.responses[dom]), 1) self.assertEqual(len(self.handler.responses[dom]), 1)
@@ -61,7 +60,7 @@ class SatisfyChallengesTest(unittest.TestCase):
acme_util.get_chall_msg(str(i), "nonce%d" % i, challenge), acme_util.get_chall_msg(str(i), "nonce%d" % i, challenge),
"dummy_key") "dummy_key")
self.handler._satisfy_challenges() self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 5) self.assertEqual(len(self.handler.responses), 5)
self.assertEqual(len(self.handler.dv_c), 5) self.assertEqual(len(self.handler.dv_c), 5)
@@ -90,7 +89,7 @@ class SatisfyChallengesTest(unittest.TestCase):
path = gen_path(["simpleHttps"], challenges) path = gen_path(["simpleHttps"], challenges)
mock_chall_path.return_value = path mock_chall_path.return_value = path
self.handler._satisfy_challenges() self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 1) self.assertEqual(len(self.handler.responses), 1)
self.assertEqual(len(self.handler.responses[dom]), len(challenges)) self.assertEqual(len(self.handler.responses[dom]), len(challenges))
@@ -120,7 +119,7 @@ class SatisfyChallengesTest(unittest.TestCase):
path = gen_path(["simpleHttps", "recoveryToken"], challenges) path = gen_path(["simpleHttps", "recoveryToken"], challenges)
mock_chall_path.return_value = path mock_chall_path.return_value = path
self.handler._satisfy_challenges() self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 1) self.assertEqual(len(self.handler.responses), 1)
self.assertEqual(len(self.handler.responses[dom]), len(challenges)) self.assertEqual(len(self.handler.responses[dom]), len(challenges))
@@ -151,7 +150,7 @@ class SatisfyChallengesTest(unittest.TestCase):
path = gen_path(["dvsni", "recoveryContact"], challenges) path = gen_path(["dvsni", "recoveryContact"], challenges)
mock_chall_path.return_value = path mock_chall_path.return_value = path
self.handler._satisfy_challenges() self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 5) self.assertEqual(len(self.handler.responses), 5)
for i in range(5): for i in range(5):
@@ -200,7 +199,7 @@ class SatisfyChallengesTest(unittest.TestCase):
mock_chall_path.side_effect = paths mock_chall_path.side_effect = paths
self.handler._satisfy_challenges() self.handler._satisfy_challenges() # pylint: disable=protected-access
self.assertEqual(len(self.handler.responses), 5) self.assertEqual(len(self.handler.responses), 5)
self.assertEqual(len(self.handler.dv_c), 5) self.assertEqual(len(self.handler.dv_c), 5)
@@ -12,8 +12,9 @@ from letsencrypt.client import client
from letsencrypt.client import CONFIG from letsencrypt.client import CONFIG
from letsencrypt.client import le_util from letsencrypt.client import le_util
# pylint: disable=too-few-public-methods
class DvsniGenCertTest(unittest.TestCase): class DvsniGenCertTest(unittest.TestCase):
# pylint: disable=too-few-public-methods
"""Tests for letsencrypt.client.challenge_util.dvsni_gen_cert.""" """Tests for letsencrypt.client.challenge_util.dvsni_gen_cert."""
def test_standard(self): def test_standard(self):