Updating argument_spec for type='list' options by elements value. (#48485)

This commit is contained in:
Felix Fontein 2018-11-26 16:17:25 +01:00 committed by ansibot
parent 7287d396e2
commit 3a9eadb22f
5 changed files with 14 additions and 13 deletions

View file

@ -136,7 +136,7 @@ def main():
terms_agreed=dict(required=False, default=False, type='bool'), terms_agreed=dict(required=False, default=False, type='bool'),
state=dict(required=True, choices=['absent', 'present', 'changed_key'], type='str'), state=dict(required=True, choices=['absent', 'present', 'changed_key'], type='str'),
allow_creation=dict(required=False, default=True, type='bool'), allow_creation=dict(required=False, default=True, type='bool'),
contact=dict(required=False, type='list', default=[]), contact=dict(required=False, type='list', elements='str', default=[]),
new_account_key_src=dict(type='path'), new_account_key_src=dict(type='path'),
new_account_key_content=dict(type='str', no_log=True), new_account_key_content=dict(type='str', no_log=True),
select_crypto_backend=dict(required=False, choices=['auto', 'openssl', 'cryptography'], default='auto', type='str'), select_crypto_backend=dict(required=False, choices=['auto', 'openssl', 'cryptography'], default='auto', type='str'),
@ -192,7 +192,8 @@ def main():
module.exit_json(changed=False, account_uri=account.uri) module.exit_json(changed=False, account_uri=account.uri)
elif state == 'present': elif state == 'present':
allow_creation = module.params.get('allow_creation') allow_creation = module.params.get('allow_creation')
contact = module.params.get('contact') # Make sure contact is a list of strings (unfortunately, Ansible doesn't do that for us)
contact = [str(v) for v in module.params.get('contact')]
terms_agreed = module.params.get('terms_agreed') terms_agreed = module.params.get('terms_agreed')
changed = account.init_account( changed = account.init_account(
contact, contact,

View file

@ -281,8 +281,8 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
input_chain=dict(required=True, type='str'), input_chain=dict(required=True, type='str'),
root_certificates=dict(required=True, type='list'), root_certificates=dict(required=True, type='list', elements='path'),
intermediate_certificates=dict(required=False, type='list', default=[]), intermediate_certificates=dict(required=False, type='list', elements='path', default=[]),
), ),
supports_check_mode=True, supports_check_mode=True,
) )

View file

@ -987,18 +987,18 @@ def main():
# General properties of a certificate # General properties of a certificate
privatekey_path=dict(type='path'), privatekey_path=dict(type='path'),
privatekey_passphrase=dict(type='str', no_log=True), privatekey_passphrase=dict(type='str', no_log=True),
signature_algorithms=dict(type='list'), signature_algorithms=dict(type='list', elements='str'),
subject=dict(type='dict'), subject=dict(type='dict'),
subject_strict=dict(type='bool', default=False), subject_strict=dict(type='bool', default=False),
issuer=dict(type='dict'), issuer=dict(type='dict'),
issuer_strict=dict(type='bool', default=False), issuer_strict=dict(type='bool', default=False),
has_expired=dict(type='bool', default=False), has_expired=dict(type='bool', default=False),
version=dict(type='int'), version=dict(type='int'),
keyUsage=dict(type='list', aliases=['key_usage']), keyUsage=dict(type='list', aliases=['key_usage'], elements='str'),
keyUsage_strict=dict(type='bool', default=False, aliases=['key_usage_strict']), keyUsage_strict=dict(type='bool', default=False, aliases=['key_usage_strict']),
extendedKeyUsage=dict(type='list', aliases=['extended_key_usage'], ), extendedKeyUsage=dict(type='list', aliases=['extended_key_usage'], elements='str'),
extendedKeyUsage_strict=dict(type='bool', default=False, aliases=['extended_key_usage_strict']), extendedKeyUsage_strict=dict(type='bool', default=False, aliases=['extended_key_usage_strict']),
subjectAltName=dict(type='list', aliases=['subject_alt_name']), subjectAltName=dict(type='list', aliases=['subject_alt_name'], elements='str'),
subjectAltName_strict=dict(type='bool', default=False, aliases=['subject_alt_name_strict']), subjectAltName_strict=dict(type='bool', default=False, aliases=['subject_alt_name_strict']),
notBefore=dict(type='str', aliases=['not_before']), notBefore=dict(type='str', aliases=['not_before']),
notAfter=dict(type='str', aliases=['not_after']), notAfter=dict(type='str', aliases=['not_after']),

View file

@ -529,13 +529,13 @@ def main():
organizationalUnitName=dict(aliases=['OU', 'organizational_unit_name'], type='str'), organizationalUnitName=dict(aliases=['OU', 'organizational_unit_name'], type='str'),
commonName=dict(aliases=['CN', 'common_name'], type='str'), commonName=dict(aliases=['CN', 'common_name'], type='str'),
emailAddress=dict(aliases=['E', 'email_address'], type='str'), emailAddress=dict(aliases=['E', 'email_address'], type='str'),
subjectAltName=dict(aliases=['subject_alt_name'], type='list'), subjectAltName=dict(aliases=['subject_alt_name'], type='list', elements='str'),
subjectAltName_critical=dict(aliases=['subject_alt_name_critical'], default=False, type='bool'), subjectAltName_critical=dict(aliases=['subject_alt_name_critical'], default=False, type='bool'),
keyUsage=dict(aliases=['key_usage'], type='list'), keyUsage=dict(aliases=['key_usage'], type='list', elements='str'),
keyUsage_critical=dict(aliases=['key_usage_critical'], default=False, type='bool'), keyUsage_critical=dict(aliases=['key_usage_critical'], default=False, type='bool'),
extendedKeyUsage=dict(aliases=['extKeyUsage', 'extended_key_usage'], type='list'), extendedKeyUsage=dict(aliases=['extKeyUsage', 'extended_key_usage'], type='list'),
extendedKeyUsage_critical=dict(aliases=['extKeyUsage_critical', 'extended_key_usage_critical'], default=False, type='bool'), extendedKeyUsage_critical=dict(aliases=['extKeyUsage_critical', 'extended_key_usage_critical'], default=False, type='bool', elements='str'),
basicConstraints=dict(aliases=['basic_constraints'], type='list'), basicConstraints=dict(aliases=['basic_constraints'], type='list', elements='str'),
basicConstraints_critical=dict(aliases=['basic_constraints_critical'], default=False, type='bool'), basicConstraints_critical=dict(aliases=['basic_constraints_critical'], default=False, type='bool'),
ocspMustStaple=dict(aliases=['ocsp_must_staple'], default=False, type='bool'), ocspMustStaple=dict(aliases=['ocsp_must_staple'], default=False, type='bool'),
ocspMustStaple_critical=dict(aliases=['ocsp_must_staple_critical'], default=False, type='bool'), ocspMustStaple_critical=dict(aliases=['ocsp_must_staple_critical'], default=False, type='bool'),

View file

@ -278,7 +278,7 @@ def main():
argument_spec = dict( argument_spec = dict(
action=dict(type='str', default='export', action=dict(type='str', default='export',
choices=['parse', 'export']), choices=['parse', 'export']),
ca_certificates=dict(type='list'), ca_certificates=dict(type='list', elements='path'),
certificate_path=dict(type='path'), certificate_path=dict(type='path'),
force=dict(type='bool', default=False), force=dict(type='bool', default=False),
friendly_name=dict(type='str', aliases=['name']), friendly_name=dict(type='str', aliases=['name']),