Small docs improvements (#374)

* Small improvements.

* Document behavior changes.
This commit is contained in:
Felix Fontein
2022-01-10 13:05:09 +01:00
committed by GitHub
parent 1b0fcde862
commit 62272296da
40 changed files with 74 additions and 73 deletions

View File

@@ -118,10 +118,10 @@ class ACMEAccount(object):
self.client.set_account_uri(info['location'])
return False, result
elif info['status'] == 400 and result['type'] == 'urn:ietf:params:acme:error:accountDoesNotExist' and not allow_creation:
# Account does not exist (and we didn't try to create it)
# Account does not exist (and we did not try to create it)
return False, None
elif info['status'] == 403 and result['type'] == 'urn:ietf:params:acme:error:unauthorized' and 'deactivated' in (result.get('detail') or ''):
# Account has been deactivated; currently works for Pebble; hasn't been
# Account has been deactivated; currently works for Pebble; has not been
# implemented for Boulder (https://github.com/letsencrypt/boulder/issues/3971),
# might need adjustment in error detection.
if not allow_creation:

View File

@@ -192,7 +192,7 @@ class CryptographyBackend(CryptoBackend):
Parses an RSA or Elliptic Curve key file in PEM format and returns key_data.
Raises KeyParsingError in case of errors.
'''
# If key_content isn't given, read key_file
# If key_content is not given, read key_file
if key_content is None:
key_content = read_file(key_file)
else:

View File

@@ -52,7 +52,7 @@ class OpenSSLCLIBackend(CryptoBackend):
'''
if passphrase is not None:
raise KeyParsingError('openssl backend does not support key passphrases')
# If key_file isn't given, but key_content, write that to a temporary file
# If key_file is not given, but key_content, write that to a temporary file
if key_file is None:
fd, tmpsrc = tempfile.mkstemp()
self.module.add_cleanup_file(tmpsrc) # Ansible will delete the file on exit
@@ -221,7 +221,7 @@ class OpenSSLCLIBackend(CryptoBackend):
try:
return to_native(ipaddress.ip_address(to_text(ip)).compressed)
except ValueError:
# We don't want to error out on something IPAddress() can't parse
# We do not want to error out on something IPAddress() cannot parse
return ip
def get_csr_identifiers(self, csr_filename=None, csr_content=None):

View File

@@ -116,7 +116,7 @@ def cryptography_get_signature_algorithm_oid_from_crl(crl):
try:
return crl.signature_algorithm_oid
except AttributeError:
# Older cryptography versions don't have signature_algorithm_oid yet
# Older cryptography versions do not have signature_algorithm_oid yet
dotted = obj2txt(
crl._backend._lib,
crl._backend._ffi,

View File

@@ -79,7 +79,7 @@ DOTTED_OID = re.compile(r'^\d+(?:\.\d+)+$')
def cryptography_get_extensions_from_cert(cert):
result = dict()
try:
# Since cryptography won't give us the DER value for an extension
# Since cryptography will not give us the DER value for an extension
# (that is only stored for unrecognized extensions), we have to re-do
# the extension parsing outselves.
backend = default_backend()
@@ -131,7 +131,7 @@ def cryptography_get_extensions_from_cert(cert):
def cryptography_get_extensions_from_csr(csr):
result = dict()
try:
# Since cryptography won't give us the DER value for an extension
# Since cryptography will not give us the DER value for an extension
# (that is only stored for unrecognized extensions), we have to re-do
# the extension parsing outselves.
backend = default_backend()

View File

@@ -50,7 +50,7 @@ def quick_is_not_prime(n):
'''Does some quick checks to see if we can poke a hole into the primality of n.
A result of `False` does **not** mean that the number is prime; it just means
that we couldn't detect quickly whether it is not prime.
that we could not detect quickly whether it is not prime.
'''
if n <= 2:
return True

View File

@@ -219,7 +219,7 @@ class CertificateBackend(object):
if ext.value.digest != x509.SubjectKeyIdentifier.from_public_key(self.existing_certificate.public_key()).digest:
return False
else:
# If CSR had SKI and we didn't ignore it ('create_if_not_provided'), compare SKIs
# If CSR had SKI and we did not ignore it ('create_if_not_provided'), compare SKIs
if ext.value.digest != csr_ext.value.digest:
return False
return True
@@ -318,7 +318,7 @@ def select_backend(module, backend, provider):
# Fail if no backend has been found
if backend == 'auto':
module.fail_json(msg=("Can't detect the required Python library "
module.fail_json(msg=("Cannot detect the required Python library "
"cryptography (>= {0})").format(MINIMAL_CRYPTOGRAPHY_VERSION))
if backend == 'cryptography':

View File

@@ -382,7 +382,7 @@ def select_backend(module, backend, content):
# Success?
if backend == 'auto':
module.fail_json(msg=("Can't detect any of the required Python libraries "
module.fail_json(msg=("Cannot detect any of the required Python libraries "
"cryptography (>= {0})").format(MINIMAL_CRYPTOGRAPHY_VERSION))
if backend == 'cryptography':

View File

@@ -584,7 +584,7 @@ def select_backend(module, backend):
# Success?
if backend == 'auto':
module.fail_json(msg=("Can't detect any of the required Python libraries "
module.fail_json(msg=("Cannot detect any of the required Python libraries "
"cryptography (>= {0})").format(MINIMAL_CRYPTOGRAPHY_VERSION))
if backend == 'cryptography':

View File

@@ -321,7 +321,7 @@ def select_backend(module, backend, content, validate_signature=True):
# Success?
if backend == 'auto':
module.fail_json(msg=("Can't detect the required Python library "
module.fail_json(msg=("Cannot detect the required Python library "
"cryptography (>= {0})").format(MINIMAL_CRYPTOGRAPHY_VERSION))
if backend == 'cryptography':

View File

@@ -490,7 +490,7 @@ def select_backend(module, backend):
# Success?
if backend == 'auto':
module.fail_json(msg=("Can't detect the required Python library "
module.fail_json(msg=("Cannot detect the required Python library "
"cryptography (>= {0})").format(MINIMAL_CRYPTOGRAPHY_VERSION))
if backend == 'cryptography':
if not CRYPTOGRAPHY_FOUND:

View File

@@ -228,7 +228,7 @@ class PrivateKeyInfoRetrieval(object):
if self.check_consistency:
result['key_is_consistent'] = self._is_key_consistent(key_public_data, key_private_data)
if result['key_is_consistent'] is False:
# Only fail when it is False, to avoid to fail on None (which means "we don't know")
# Only fail when it is False, to avoid to fail on None (which means "we do not know")
msg = (
"Private key is not consistent! (See "
"https://blog.hboeck.de/archives/888-How-I-tricked-Symantec-with-a-Fake-Private-Key.html)"
@@ -273,7 +273,7 @@ def select_backend(module, backend, content, passphrase=None, return_private_key
# Success?
if backend == 'auto':
module.fail_json(msg=("Can't detect the required Python library "
module.fail_json(msg=("Cannot detect the required Python library "
"cryptography (>= {0})").format(MINIMAL_CRYPTOGRAPHY_VERSION))
if backend == 'cryptography':

View File

@@ -155,7 +155,7 @@ def select_backend(module, backend, content=None, key=None):
# Success?
if backend == 'auto':
module.fail_json(msg=("Can't detect any of the required Python libraries "
module.fail_json(msg=("Cannot detect any of the required Python libraries "
"cryptography (>= {0})").format(MINIMAL_CRYPTOGRAPHY_VERSION))
if backend == 'cryptography':

View File

@@ -162,13 +162,13 @@ def load_privatekey(path, passphrase=None, check_passphrase=True, content=None,
to_bytes('y' if passphrase == 'x' else 'x'))
if passphrase is not None:
# Since we can load the key without an exception, the
# key isn't password-protected
# key is not password-protected
raise OpenSSLBadPassphraseError('Passphrase provided, but private key is not password-protected!')
except crypto.Error as e:
if passphrase is None and len(e.args) > 0 and len(e.args[0]) > 0:
if e.args[0][0][2] in ('bad decrypt', 'bad password read'):
# The key is obviously protected by the empty string.
# Don't do this at home (if it's possible at all)...
# Do not do this at home (if it's possible at all)...
raise OpenSSLBadPassphraseError('No passphrase provided, but private key is password-protected!')
elif backend == 'cryptography':
try:

View File

@@ -105,7 +105,7 @@ def bind(instance, method, operation_spec):
def binding_scope_fn(*args, **kwargs):
return method(instance, *args, **kwargs)
# Make sure we don't confuse users; add the proper name and documentation to the function.
# Make sure we do not confuse users; add the proper name and documentation to the function.
# Users can use !help(<function>) to get help on the function from interactive python or pdb
operation_name = operation_spec.get("operationId").split("Using")[0]
binding_scope_fn.__name__ = str(operation_name)