Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validating arguments against arg spec 'main' fails for some roles #986

Open
cmasopust opened this issue Nov 26, 2024 · 5 comments
Open

Validating arguments against arg spec 'main' fails for some roles #986

cmasopust opened this issue Nov 26, 2024 · 5 comments
Labels
blocked - upstream bug Something isn't working

Comments

@cmasopust
Copy link

Summary

When dispatching all the roles, some are failing with the at "Validating arguments against arg spec 'main'" with the following error message (e.g. for inventory_sources):

TASK [infra.aap_configuration.controller_inventory_sources : Validating arguments against arg spec 'main' - An Ansible Role to create inventory sources on Ansible Controller.] ***
fatal: [localhost]: FAILED! => {"msg": "the field 'tags' should be a list of ((<class 'str'>,), <class 'int'>), but the item '['inventories', 'inventory_sources']' is a <class 'list'>"}

Pretty sure I'm doing something wrong, but.... what?

Issue Type

  • Bug Report

Ansible, Collection, Controller details

AAP version is 2.5
infra.aap_configuration version is 3.1.0

$ ansible --version
ansible [core 2.14.17]
  config file = /home/cmaso/.ansible.cfg
  configured module search path = ['/home/cmaso/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /home/cmaso/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.19 (main, Sep 11 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

OS / ENVIRONMENT

RHEL 9

Thanks for your help!

@cmasopust cmasopust added bug Something isn't working new New issue, this should be removed once reviewed labels Nov 26, 2024
@djdanielsson
Copy link
Collaborator

can you provide an example of the inventory source you are attempting to pass?

@cmasopust
Copy link
Author

cmasopust commented Dec 9, 2024

it happens for any role that is configured in roles/dispatch/defaults/main.yml with a list of tags instead of a single tag.

e.g. for controller_projects:

  - role: controller_projects
    var: controller_projects
    tags:
      - inventories
      - projects

it results in the following error when dispatching:

TASK [infra.aap_configuration.meta_dependency_check : Print dependency check status] **********************************************************************
fatal: [localhost]: FAILED! => {"msg": "the field 'tags' should be a list of ((<class 'str'>,), <class 'int'>), but the item '['inventories', 'projects']' is a <class 'list'>\n\nThe error appears to be in '/home/cmaso/.ansible/collections/ansible_collections/infra/aap_configuration/roles/meta_dependency_check/tasks/main.yml': line 4, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Print dependency check status\n  ^ here\n"}

no matter what content is in the inventory.

and if I overwrite (or modify) the configuration of role controller_projects to:

  - role: controller_projects
    var: controller_projects
    tags: projects

dispatching the role works as expected:

TASK [infra.aap_configuration.meta_dependency_check : Print dependency check status] **********************************************************************
ok: [localhost] => {
    "msg": "Dependency check is deactivated. Required collections presence will not be verified. This might cause failure in the next tasks."
}

TASK [infra.aap_configuration.meta_dependency_check : Check awx.awx is installed] *************************************************************************
skipping: [localhost]

TASK [infra.aap_configuration.meta_dependency_check : Check ansible.controller is installed] **************************************************************
skipping: [localhost]

TASK [infra.aap_configuration.meta_dependency_check : Ensure one is installed] ****************************************************************************
skipping: [localhost]

TASK [infra.aap_configuration.controller_projects : Validating arguments against arg spec 'main' - An Ansible Role to create projects on Ansible Controller.] ***
ok: [localhost]

@Tompage1994
Copy link
Collaborator

I've done some digging. This is caused by providing a list via a variable to the include_roles apply.tags option which seems to have been a longstanding ansible core bug. ansible/ansible#69903

@Tompage1994
Copy link
Collaborator

I don't really see a workaround here short of removing all the multiple tags

@djdanielsson djdanielsson added blocked - upstream and removed new New issue, this should be removed once reviewed labels Dec 16, 2024
@cmasopust
Copy link
Author

No worries, at least we know that we are not alone :) Thanks for finding this out and updating me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked - upstream bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants