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

Installing collections - Unexpected Exception, this is probably a bug: stat: path should be string, bytes, os.PathLike or integer, not GalaxyAPI #15395

Open
6 of 11 tasks
Ruud-cb opened this issue Jul 23, 2024 · 1 comment
Labels

Comments

@Ruud-cb
Copy link

Ruud-cb commented Jul 23, 2024

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

Bug Summary

Having a simple requirements.yml added to the project results in an error during git syncing the Project.

AWX version

2.19.1

Select the relevant components

  • UI
  • UI (tech preview)
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

minikube

Modifications

no

Ansible version

v24.6.1

Operating system

macOS

Web browser

Chrome

Steps to reproduce

  • Setup a Project like usual that syncs with a git repo, make sure that succeeds.
  • Add the following requirements.yml to the project, try to sync again.
collections:
  # Install a collection from Ansible Galaxy.
  - name: community.general.homebrew
    version: latest
    source: https://galaxy.ansible.com

Expected results

Would expect that the homebrew collection can be used.

Actual results

Got an error during sync

Standard error: ERROR! Unexpected Exception, this is probably a bug: stat: path should be string, bytes, os.PathLike or integer, not GalaxyAPI

{
  "changed": true,
  "stdout": "ansible-galaxy [core 2.15.12]\n  config file = /var/lib/awx/projects/_8__flushing/ansible.cfg\n  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']\n  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible\n  ansible collection location = /var/lib/awx/projects/.__awx_cache/_8__flushing/stage/requirements_collections\n  executable location = /usr/local/bin/ansible-galaxy\n  python version = 3.9.19 (main, Jun 11 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)\n  jinja version = 3.1.4\n  libyaml = True\nUsing /var/lib/awx/projects/_8__flushing/ansible.cfg as config file\nReading requirement file at '/var/lib/awx/projects/_8__flushing/requirements.yml'\nthe full traceback was:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/__init__.py\", line 659, in cli_executor\n    exit_code = cli.run()\n  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 719, in run\n    return context.CLIARGS['func']()\n  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 119, in method_wrapper\n    return wrapped_method(*args, **kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 1341, in execute_install\n    requirements = self._parse_requirements_file(\n  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 818, in _parse_requirements_file\n    requirements['collections'] = [\n  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 819, in <listcomp>\n    Requirement.from_requirement_dict(\n  File \"/usr/local/lib/python3.9/site-packages/ansible/galaxy/dependency_resolution/dataclasses.py\", line 352, in from_requirement_dict\n    if req_source is not None and os.path.isdir(req_source):\n  File \"/usr/lib64/python3.9/genericpath.py\", line 42, in isdir\n    st = os.stat(s)\nTypeError: stat: path should be string, bytes, os.PathLike or integer, not GalaxyAPI",
  "stderr": "ERROR! Unexpected Exception, this is probably a bug: stat: path should be string, bytes, os.PathLike or integer, not GalaxyAPI",
  "rc": 250,
  "cmd": [
    "ansible-galaxy",
    "install",
    "-r",
    "/var/lib/awx/projects/_8__flushing/requirements.yml",
    "-vvv"
  ],
  "start": "2024-07-23 06:16:57.156604",
  "end": "2024-07-23 06:16:57.322592",
  "delta": "0:00:00.165988",
  "msg": "non-zero return code",
  "invocation": {
    "module_args": {
      "chdir": "/var/lib/awx/projects/_8__flushing",
      "_raw_params": "ansible-galaxy install -r /var/lib/awx/projects/_8__flushing/requirements.yml -vvv",
      "_uses_shell": false,
      "stdin_add_newline": true,
      "strip_empty_ends": true,
      "argv": null,
      "executable": null,
      "creates": null,
      "removes": null,
      "stdin": null
    }
  },
  "stdout_lines": [
    "ansible-galaxy [core 2.15.12]",
    "  config file = /var/lib/awx/projects/_8__flushing/ansible.cfg",
    "  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']",
    "  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible",
    "  ansible collection location = /var/lib/awx/projects/.__awx_cache/_8__flushing/stage/requirements_collections",
    "  executable location = /usr/local/bin/ansible-galaxy",
    "  python version = 3.9.19 (main, Jun 11 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)",
    "  jinja version = 3.1.4",
    "  libyaml = True",
    "Using /var/lib/awx/projects/_8__flushing/ansible.cfg as config file",
    "Reading requirement file at '/var/lib/awx/projects/_8__flushing/requirements.yml'",
    "the full traceback was:",
    "",
    "Traceback (most recent call last):",
    "  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/__init__.py\", line 659, in cli_executor",
    "    exit_code = cli.run()",
    "  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 719, in run",
    "    return context.CLIARGS['func']()",
    "  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 119, in method_wrapper",
    "    return wrapped_method(*args, **kwargs)",
    "  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 1341, in execute_install",
    "    requirements = self._parse_requirements_file(",
    "  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 818, in _parse_requirements_file",
    "    requirements['collections'] = [",
    "  File \"/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py\", line 819, in <listcomp>",
    "    Requirement.from_requirement_dict(",
    "  File \"/usr/local/lib/python3.9/site-packages/ansible/galaxy/dependency_resolution/dataclasses.py\", line 352, in from_requirement_dict",
    "    if req_source is not None and os.path.isdir(req_source):",
    "  File \"/usr/lib64/python3.9/genericpath.py\", line 42, in isdir",
    "    st = os.stat(s)",
    "TypeError: stat: path should be string, bytes, os.PathLike or integer, not GalaxyAPI"
  ],
  "stderr_lines": [
    "ERROR! Unexpected Exception, this is probably a bug: stat: path should be string, bytes, os.PathLike or integer, not GalaxyAPI"
  ],
  "_ansible_no_log": false
}

Additional information

My ansible.cfg is not very special:

inventory = hosts.ini
retry_files_enabled = False

hosts.ini

[workstation]
localhost ansible_connection=local

[androidconnector]
localhost ansible_connection=local
@github-actions github-actions bot added component:api component:awx_collection issues related to the collection for controlling AWX needs_triage type:bug community labels Jul 23, 2024
@djyasin
Copy link
Member

djyasin commented Jul 24, 2024

Hello, this particular issue looks like it may be configuration-related. Could you please ask this on the Ansible Community Forum? Someone in the community may have encountered this issue and be better able to assist you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants