1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove elements= from arg_spec when type is not 'list'. (#50484)

This commit is contained in:
Felix Fontein 2019-01-09 15:10:17 +01:00 committed by Ganesh Nalawade
parent 4902306dd8
commit 41de2855ae
4 changed files with 9 additions and 7 deletions

View file

@ -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'),

View file

@ -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']),

View file

@ -507,13 +507,15 @@ class ManageIQgroup(object):
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)
@ -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'),
@ -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,

View file

@ -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,