Role import errors with "dependencies must be a list of strings"

Hey, so I’m having this issue where the role import is currently complaining about my list of dependencies (in my meta/main.yml as that’s the only place I even have them declared).

What I’m doing there should work according to Ansible docs:

Code:

dependencies:
  - role: geerlingguy.nodejs
    tags: ["nodejs"]
    vars:
      nodejs_version: "{{ wireguard_easy_nodejs_version }}"
    when: "not (wireguard_easy_skip_nodejs | bool)"
    ignore_errors: "{{ ansible_check_mode }}"

However when I run ansible-galaxy role import ... I get this error:

Successfully submitted import request 2052975251017006893475265785414423458
running
dependencies must be a list of strings
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 224, in legacy_role_import
    result = import_legacy_role(checkout_path, namespace.name, importer_config, logger)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 51, in import_legacy_role
    return _import_legacy_role(dirname, namespace, cfg, logger)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/legacy_role.py", line 57, in _import_legacy_role
    data = LegacyRoleLoader(dirname, namespace, cfg, logger).load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 41, in load
    self.metadata = self._load_metadata()
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/loaders/legacy_role.py", line 77, in _load_metadata
    return schema.LegacyMetadata.parse(meta_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/schema.py", line 536, in parse
    return cls(galaxy_info, dependencies)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<attrs generated init galaxy_importer.schema.LegacyMetadata>", line 10, in __init__
    __attr_validator_dependencies(self, __attr_dependencies, self.dependencies)
  File "/venv/lib64/python3.11/site-packages/galaxy_importer/schema.py", line 544, in _validate_dependencies
    raise exc.LegacyRoleSchemaError("dependencies must be a list of strings")

Ansible Info:

ansible-galaxy [core 2.12.10]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/yannick/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/yannick/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-galaxy
  python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
  jinja version = 3.0.3
  libyaml = True

What’s going on here? I’m aware that I’m not on the latest version, but that shouldn’t matter as according to the docs what I’m doing should work since at least 2.9

1 Like

Hello,
I’ve the same problem:

ansible-galaxy --version                                             git:(main|) 
ansible-galaxy [core 2.15.2]
  configured module search path = ['/Users/XXX/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/XXX/.pyenv/versions/3.10.6/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/XX/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/NVK/.pyenv/versions/3.10.6/bin/ansible-galaxy
  python version = 3.10.6 (main, Sep 19 2022, 15:39:33) [Clang 14.0.0 (clang-1400.0.29.102)] (/Users/XXX/.pyenv/versions/3.10.6/bin/python3.10)
  jinja version = 3.1.2
  libyaml = True

I’ve opened a jira to get this prioritized and fixed Loading...

2 Likes