Skip to content

Instantly share code, notes, and snippets.

@cben
Created April 18, 2018 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cben/14de325ceec502d86c1edbcd082be9c2 to your computer and use it in GitHub Desktop.
Save cben/14de325ceec502d86c1edbcd082be9c2 to your computer and use it in GitHub Desktop.
ansible test/sanity/validate-modules/main.py spurious E324 with suboptions

ansible-test sanity --test validate-modules manageiq_dynamic_resource_definition

doc dict is:

{'author': 'Ahmed Bashir (@ahmbas)',
 'description': ['The manageiq_dynamic_resource_definition module supports adding, updating and deleting dynamic resource definitions in ManageIQ.'],
 'module': 'manageiq_dynamic_resource_definition',
 'options': {u'manageiq_connection': {u'description': [u'ManageIQ connection configuration information.'],
                                      u'required': True,
                                      u'suboptions': {u'ca_bundle_path': {u'description': [u'The path to a CA bundle file or directory with certificates. defaults to None.']},
                                                      u'password': {u'description': [u'ManageIQ password. C(MIQ_PASSWORD) env var if set. otherwise, required if no token is passed in.']},
                                                      u'token': {u'description': [u'ManageIQ token. C(MIQ_TOKEN) env var if set. otherwise, required if no username or password is passed in.']},
                                                      u'url': {u'description': [u'ManageIQ environment url. C(MIQ_URL) env var if set. otherwise, it is required to pass it.'],
                                                               u'required': True},
                                                      u'username': {u'description': [u'ManageIQ username. C(MIQ_USERNAME) env var if set. otherwise, required if no token is passed in.']},
                                                      u'verify_ssl': {u'default': True,
                                                                      u'description': [u'Whether SSL certificates should be verified for HTTPS requests. defaults to True.']}}},
             'name': {'description': ["The dynamic resource definition's name."]},
             'properties': {'description': ["The dynamic resource definition's properties."],
                            'suboptions': {'associations': {'description': 'dictionary with service and provider class.'},
                                           'attributes': {'description': 'dictionary of attributes consists of name and type.'},
                                           'methods': {'description': 'list of methods to add to dynamic resource definition.'}}},
             'state': {'choices': ['absent', 'present'],
                       'default': 'present',
                       'description': ['absent - dynamic resource definitions should not exist, present - dynamic resource definitions should be.']}},
 u'requirements': [u'manageiq-client U(https://github.com/ManageIQ/manageiq-api-client-python/)'],
 'short_description': 'Management of dynamic resource definitions in ManageIQ.',
 'version_added': '2.6'}

spec dict is:

{'manageiq_connection': {'default': {'verify_ssl': True},
                         'options': {'ca_bundle_path': {'default': None,
                                                        'required': False},
                                     'password': {'default': None,
                                                  'no_log': True},
                                     'token': {'default': None,
                                               'no_log': True},
                                     'url': {'default': None},
                                     'username': {'default': None},
                                     'verify_ssl': {'default': True,
                                                    'type': 'bool'}},
                         'type': 'dict'},
 'name': {'required': True, 'type': 'str'},
 'properties': {'type': 'dict'},
 'state': {'choices': ['absent', 'present'], 'default': 'present'}}

Note that beside each sub-option having a default key, whole 'manageiq_connection' got 'default': {'verify_ssl': True}.

If you look closely at error, this {'verify_ssl': True} is exactly what confuses it:

ERROR: lib/ansible/modules/remote_management/manageiq/manageiq_dynamic_resource_definition.py:0:0: E324 Value for "default" from the argument_spec ({'verify_ssl': True}) for "manageiq_connection" does not match the documentation (None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment