Skip to content

Commit

Permalink
Remove elements= from arg_spec when type is not 'list'. (ansible#50484)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored and knumskull committed Jan 21, 2019
1 parent a6fa333 commit e6b13bd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/ansible/modules/crypto/openssl_csr.py
Expand Up @@ -544,8 +544,8 @@ def main():
subjectAltName_critical=dict(aliases=['subject_alt_name_critical'], default=False, type='bool'),
keyUsage=dict(aliases=['key_usage'], type='list', elements='str'),
keyUsage_critical=dict(aliases=['key_usage_critical'], default=False, type='bool'),
extendedKeyUsage=dict(aliases=['extKeyUsage', 'extended_key_usage'], type='list'),
extendedKeyUsage_critical=dict(aliases=['extKeyUsage_critical', 'extended_key_usage_critical'], default=False, type='bool', elements='str'),
extendedKeyUsage=dict(aliases=['extKeyUsage', 'extended_key_usage'], type='list', elements='str'),
extendedKeyUsage_critical=dict(aliases=['extKeyUsage_critical', 'extended_key_usage_critical'], default=False, type='bool'),
basicConstraints=dict(aliases=['basic_constraints'], type='list', elements='str'),
basicConstraints_critical=dict(aliases=['basic_constraints_critical'], default=False, type='bool'),
ocspMustStaple=dict(aliases=['ocsp_must_staple'], default=False, type='bool'),
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/ios/ios_user.py
Expand Up @@ -456,7 +456,7 @@ def main():
name=dict(),

configured_password=dict(no_log=True),
hashed_password=dict(no_log=True, elements='dict', options=hashed_password_spec),
hashed_password=dict(no_log=True, type='dict', options=hashed_password_spec),
nopassword=dict(type='bool'),
update_password=dict(default='always', choices=['on_create', 'always']),
password_type=dict(default='secret', choices=['secret', 'password']),
Expand Down
Expand Up @@ -507,13 +507,15 @@ def manageiq_filters_to_sorted_dict(current_filters):
return res

@staticmethod
def normalize_user_managed_filters_to_sorted_dict(managed_filters):
def normalize_user_managed_filters_to_sorted_dict(managed_filters, module):
if not managed_filters:
return None

res = {}
for cat_key in managed_filters:
cat_array = []
if not isinstance(managed_filters[cat_key], list):
module.fail_json(msg='Entry "{0}" of managed_filters must be a list!'.format(cat_key))
for tags in managed_filters[cat_key]:
miq_managed_tag = "/managed/" + cat_key + "/" + tags
cat_array.append(miq_managed_tag)
Expand Down Expand Up @@ -571,7 +573,7 @@ def main():
role=dict(required=False, type='str'),
tenant_id=dict(required=False, type='int'),
tenant=dict(required=False, type='str'),
managed_filters=dict(required=False, type='dict', elements='list'),
managed_filters=dict(required=False, type='dict'),
managed_filters_merge_mode=dict(required=False, choices=['merge', 'replace'], default='replace'),
belongsto_filters=dict(required=False, type='list', elements='str'),
belongsto_filters_merge_mode=dict(required=False, choices=['merge', 'replace'], default='replace'),
Expand Down Expand Up @@ -615,7 +617,7 @@ def main():

tenant = manageiq_group.tenant(tenant_id, tenant_name)
role = manageiq_group.role(role_id, role_name)
norm_managed_filters = manageiq_group.normalize_user_managed_filters_to_sorted_dict(managed_filters)
norm_managed_filters = manageiq_group.normalize_user_managed_filters_to_sorted_dict(managed_filters, module)
# if we have a group, edit it
if group:
res_args = manageiq_group.edit_group(group, description, role, tenant,
Expand Down
Expand Up @@ -387,7 +387,7 @@ def main():
min_drive_size=dict(type='str', default='unspecified'),
manual_disks=dict(type='list', elements='dict', options=manual_disk),
state=dict(type='str', default='present', choices=['present', 'absent']),
virtual_drive=dict(type='dict', elements='dict', options=_virtual_drive_argument_spec()),
virtual_drive=dict(type='dict', options=_virtual_drive_argument_spec()),
)
module = AnsibleModule(
argument_spec,
Expand Down

0 comments on commit e6b13bd

Please sign in to comment.