Apply suggestions from code review

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
This commit is contained in:
Felix Fontein
2021-10-31 14:22:14 +01:00
committed by GitHub
parent b710450621
commit a6c64329d3
2 changed files with 4 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
minor_changes:
- "acme_certificate - the ``subject`` and ``issuer`` fields in in the ``select_chain`` entries are now stricter validated (https://github.com/ansible-collections/community.crypto/pull/316)."
- "acme_certificate - the ``subject`` and ``issuer`` fields in in the ``select_chain`` entries are now more strictly validated (https://github.com/ansible-collections/community.crypto/pull/316)."
- "openssl_csr, openssl_csr_pipe - there is now stricter validation of the values of the ``subject`` option (https://github.com/ansible-collections/community.crypto/pull/316)."
- "openssl_csr, openssl_csr_pipe - provide a new ``subject_ordered`` option if the order of the components in the subject is of importance (https://github.com/ansible-collections/community.crypto/issues/291, https://github.com/ansible-collections/community.crypto/pull/316)."
- "x509_crl - there is now stricter validation of the values of the ``issuer`` option (https://github.com/ansible-collections/community.crypto/pull/316)."

View File

@@ -253,9 +253,9 @@ def parse_name_field(input_dict, name_field_name=None):
result.append((key, value))
else:
if name_field_name:
raise ValueError(
raise TypeError(
'Value for {key} in {name} must be either a string or a list of strings'.format(key=key, name=name_field_name))
raise ValueError('Value for {key} must be either a string or a list of strings'.format(key=key))
raise TypeError('Value for {key} must be either a string or a list of strings'.format(key=key))
return result
@@ -270,7 +270,7 @@ def parse_ordered_name_field(input_list, name_field_name):
name=name_field_name, index=index + 1))
try:
result.extend(parse_name_field(entry, name_field_name=name_field_name))
except ValueError as exc:
except (TypeError, ValueError) as exc:
raise ValueError(
'Error while processing entry #{index} in {name}: {error}'.format(
name=name_field_name, index=index + 1, error=exc))