From 9f05a3ee153ab3f078f8c56c16b3569b03c9d279 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sun, 30 Nov 2014 11:44:17 +0100 Subject: [PATCH 1/4] Fix apache_configurator docs --- letsencrypt/client/apache_configurator.py | 64 ++++++++++------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/letsencrypt/client/apache_configurator.py b/letsencrypt/client/apache_configurator.py index adacebdc3..e1c2d39e3 100644 --- a/letsencrypt/client/apache_configurator.py +++ b/letsencrypt/client/apache_configurator.py @@ -64,10 +64,10 @@ class VH(object): class ApacheConfigurator(augeas_configurator.AugeasConfigurator): - """ - State of Configurator: - This code has been tested under Ubuntu 12.04 Apache 2.2 - and this code works for Ubuntu 14.04 Apache 2.4. Further + """Apache configurator. + + State of Configurator: This code has been tested under Ubuntu 12.04 + Apache 2.2 and this code works for Ubuntu 14.04 Apache 2.4. Further notes below. This class was originally developed for Apache 2.2 and has not seen a @@ -87,6 +87,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): This class will eventually derive from a generic Configurator class so that other Configurators (like Nginx) can be developed and interoperate with the client. + """ def __init__(self, server_root=CONFIG.SERVER_ROOT): super(ApacheConfigurator, self).__init__() @@ -1252,13 +1253,16 @@ LogLevel warn \n\ def dvsni_perform(self, chall_dict): """Peform a DVSNI challenge. - Composed of - list_sni_tuple: List of tuples with form (addr, r, nonce) - addr (string), r (base64 string), nonce (hex string) - dvsni_key: string - File path to key + Composed of: - :param chall_dict: dvsni challenge - see documentation - :type chall_dict: dict + list_sni_tuple: + List of tuples with form `(addr, r, nonce)`, where + `addr` (`str`), `r` (base64 `str`), nonce (hex `str`) + + dvsni_key: + File path to key (str) + + :param dict chall_dict: dvsni challenge - see documentation """ # Save any changes to the configuration as a precaution @@ -1325,12 +1329,10 @@ LogLevel warn \n\ Result: Apache config includes virtual servers for issued challs - :param list_sni_tuple: list of tuples with the form (addr, y, nonce) - addr (string), y (byte array), nonce (hex str) - :type list_sni_tuple: list - + :param list list_sni_tuple: list of tuples with the form + `(addr, y, nonce)`, where `addr` is `str`, `y` is `bytearray`, + and nonce is hex `str` :param str dvsni_key: file path to key - :param list ll_addrs: list of list of addresses to apply """ @@ -1403,8 +1405,7 @@ def enable_mod(mod_name): Both enables and restarts Apache so module is active. - :param mod_name: Name of the module to enable - :type mod_name: str + :param str mod_name: Name of the module to enable """ try: @@ -1426,7 +1427,8 @@ def check_ssl_loaded(): """Checks to see if mod_ssl is loaded Currently uses apache2ctl to get loaded module list - TODO: This function is likely fragile to versions/distros + + .. todo:: This function is likely fragile to versions/distros :returns: If ssl_module is included and active in Apache :rtype: bool @@ -1483,8 +1485,7 @@ def get_file_path(vhost_path): Takes in Augeas path and returns the file name - :param vhost_path: Augeas virtual host path - :type vhost_path: str + :param str vhost_path: Augeas virtual host path :returns: filename of vhost :rtype: str @@ -1529,8 +1530,7 @@ def strip_dir(path): def dvsni_get_cert_file(nonce): """Returns standardized name for challenge certificate. - :param nonce: hex form of nonce - :type nonce: str + :param str nonce: hex form of nonce :returns: certificate file name :rtype: str @@ -1542,14 +1542,9 @@ def dvsni_get_cert_file(nonce): def get_config_text(nonce, ip_addrs, key): """Chocolate virtual server configuration text - :param nonce: hex form of nonce - :type nonce: str - - :param ip_addrs: addresses of challenged domain - :type ip_addrs: str - - :param key: file path to key - :type key: str + :param str nonce: hex form of nonce + :param str ip_addrs: addresses of challenged domain + :param str key: file path to key :returns: virtual host configuration text :rtype: str @@ -1573,11 +1568,8 @@ def get_config_text(nonce, ip_addrs, key): def dvsni_gen_ext(dvsni_r, dvsni_s): """Generates z extension to be placed in certificate extension. - :param dvsni_r: DVSNI r value - :type dvsni_r: byte array - - :param dvsni_s: DVSNI s value - :type dvsni_s: byte array + :param bytearray dvsni_r: DVSNI r value + :param bytearray dvsni_s: DVSNI s value result: returns z + CONFIG.INVALID_EXT @@ -1590,7 +1582,7 @@ def dvsni_gen_ext(dvsni_r, dvsni_s): def main(): - """ Main function used for quick testing purposes """ + """Main function used for quick testing purposes""" config = ApacheConfigurator() logger.setLogger(logger.FileLogger(sys.stdout)) From 72218f3dd32d0ababca523272180f1139442d031 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sun, 30 Nov 2014 13:10:23 +0100 Subject: [PATCH 2/4] script doc fix --- letsencrypt/scripts/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/letsencrypt/scripts/main.py b/letsencrypt/scripts/main.py index 78afabe4f..98b5587b6 100755 --- a/letsencrypt/scripts/main.py +++ b/letsencrypt/scripts/main.py @@ -105,8 +105,8 @@ def read_file(filename): :param str filename: Filename - :returns: File contents - :rtype: str + :returns: A tuple of filename and its contents + :rtype: tuple :raises argparse.ArgumentTypeError: File does not exist or is not readable. From b354c9caf607cff0db7bd92099e055c8d377c77a Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sun, 30 Nov 2014 13:23:20 +0100 Subject: [PATCH 3/4] Fix recent commits docs bugs --- letsencrypt/client/client.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/letsencrypt/client/client.py b/letsencrypt/client/client.py index 653b4b6c6..2bcecf527 100644 --- a/letsencrypt/client/client.py +++ b/letsencrypt/client/client.py @@ -37,11 +37,16 @@ class Client(object): def __init__(self, ca_server, cert_signing_request=CSR(None, None, None), private_key=Key(None, None), use_curses=True): - """ + """Initialize client. :param str ca_server: Certificate authority server - :param str cert_signing_request: Contents of the CSR - :param str private_key: Contents of the private key + + :param cert_signing_request: Certificate Signing Request + :type cert_signing_request: :class:`CSR` + + :param private_key: Private key + :type private_key: :class:`Key` + :param bool use_curses: Use curses UI """ From 924531341ea0d0a8cdf66ef878976306a201b488 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sun, 30 Nov 2014 18:28:14 +0100 Subject: [PATCH 4/4] Fix missing whitespace in todo --- letsencrypt/client/crypto_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/letsencrypt/client/crypto_util.py b/letsencrypt/client/crypto_util.py index 318dcd415..7419b674b 100644 --- a/letsencrypt/client/crypto_util.py +++ b/letsencrypt/client/crypto_util.py @@ -27,7 +27,7 @@ def create_sig(msg, key_str, nonce=None, nonce_len=CONFIG.NONCE_SIZE): .. todo:: Change this over to M2Crypto... PKey - .. todo::Protect against crypto unicode errors... is this sufficient? + .. todo:: Protect against crypto unicode errors... is this sufficient? Do I need to escape? :param str key_str: Key in string form. Accepted formats