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

TypeError: join() missing 1 required positional argument: 'a' in ansible-galaxy #81965

Closed
1 task done
nomike opened this issue Oct 13, 2023 · 2 comments · Fixed by #82165 · May be fixed by #82052
Closed
1 task done

TypeError: join() missing 1 required positional argument: 'a' in ansible-galaxy #81965

nomike opened this issue Oct 13, 2023 · 2 comments · Fixed by #82165 · May be fixed by #82052
Labels
affects_2.15 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. P3 Priority 3 - Approved, No Time Limitation

Comments

@nomike
Copy link

nomike commented Oct 13, 2023

Summary

# ansible-galaxy install willshersystems.sshd --force -vvv
ansible-galaxy [core 2.15.5]
 config file = None
 configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
 ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
 ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
 executable location = /usr/local/bin/ansible-galaxy
 python version = 3.9.16 (main, Sep  8 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
 jinja version = 3.1.2
 libyaml = True
No config file found; using defaults
Starting galaxy role install process
Processing role willshersystems.sshd
Opened /root/.ansible/galaxy_token
- downloading role 'sshd', owned by willshersystems
- downloading role from https://github.com/willshersystems/ansible-sshd/archive/v0.21.0.tar.gz
- extracting willshersystems.sshd to /root/.ansible/roles/willshersystems.sshd
[WARNING]: Illegal filename '..': '..' is not allowed
ERROR! Unexpected Exception, this is probably a bug: join() missing 1 required positional argument: 'a'
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 1370, in execute_install
   self._execute_install_role(role_requirements)
 File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 1469, in _execute_install_role
   installed = role.install()
 File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/role.py", line 426, in install
   setattr(member, attr, os.path.join(*n_final_parts))
TypeError: join() missing 1 required positional argument: 'a'

For some reason, the list n_final_parts doesn't contain any entries which makes this call crash:

os.path.join(*n_final_parts)

Issue Type

Bug Report

Component Name

ansible-galaxy

Ansible Version

$ ansible --version
ansible [core 2.15.5]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.16 (main, Feb 23 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = None
EDITOR(env: EDITOR) = vim
PAGER(env: PAGER) = less

OS / Environment

Amazon Linux 2023

Steps to Reproduce

not applicable

Expected Results

I expect the ansible role to be installed

Actual Results

The installation process crashes, as mentioned above.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Oct 13, 2023

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

@ansibot ansibot added the has_pr This issue has an associated PR. label Oct 13, 2023
@bcoca bcoca added P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Oct 17, 2023
@jbertolotti84
Copy link

This is also happening in ansible 2.14.11:

root@68b475171cc7:~/project/tests# ansible-galaxy install -r ansible_requirements.yml -vvv
ansible-galaxy [core 2.14.11]
  config file = /root/project/tests/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/project/tests/collections:/root/.ansible/collections:/usr/share/ansible/collections:/etc/ansible/collections
  executable location = /usr/bin/ansible-galaxy
  python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /root/project/tests/ansible.cfg as config file
Reading requirement file at '/root/project/tests/ansible_requirements.yml'
found role {'name': 'redacted', 'scm': 'git', 'src': 'git@redacted', 'version': '8.6.0'} in yaml file
found role {'name': 'redacted', 'scm': 'git', 'src': 'git@redacted', 'version': '8.7.0'} in yaml file
Starting galaxy role install process
Processing role redacted
archiving ['/usr/bin/git', 'archive', '--prefix=redacted/', '--output=/root/.ansible/tmp/ansible-local-2106mlvm739z/tmpm5mlcdg4.tar', '8.6.0']
- extracting tvision.python to /root/project/tests/roles/redacted
- [WARNING]: Illegal filename '..': '..' is not allowed
ERROR! Unexpected Exception, this is probably a bug: join() missing 1 required positional argument: 'a'
the full traceback was:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ansible/cli/__init__.py", line 647, in cli_executor
    exit_code = cli.run()
  File "/usr/lib/python3/dist-packages/ansible/cli/galaxy.py", line 718, in run
    return context.CLIARGS['func']()
  File "/usr/lib/python3/dist-packages/ansible/cli/galaxy.py", line 117, in method_wrapper
    return wrapped_method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/ansible/cli/galaxy.py", line 1364, in execute_install
    self._execute_install_role(role_requirements)
  File "/usr/lib/python3/dist-packages/ansible/cli/galaxy.py", line 1450, in _execute_install_role
    installed = role.install()
  File "/usr/lib/python3/dist-packages/ansible/galaxy/role.py", line 426, in install
    setattr(member, attr, os.path.join(*n_final_parts))
TypeError: join() missing 1 required positional argument: 'a'

OS:

root@68b475171cc7:~/project/tests# cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu

t2d added a commit to systemli/github-ansible-workflow that referenced this issue Nov 2, 2023
@ansible ansible locked and limited conversation to collaborators Dec 14, 2023
s-hertel added a commit that referenced this issue Apr 24, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes #82702
Fixes #81965
Fixes #82051
s-hertel added a commit to s-hertel/ansible that referenced this issue Apr 24, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes ansible#82702
Fixes ansible#81965
Fixes ansible#82051

(cherry picked from commit e84240d)
s-hertel added a commit to s-hertel/ansible that referenced this issue Apr 24, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes ansible#82702
Fixes ansible#81965
Fixes ansible#82051

(cherry picked from commit e84240d)
s-hertel added a commit to s-hertel/ansible that referenced this issue Apr 24, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes ansible#82702
Fixes ansible#81965
Fixes ansible#82051

(cherry picked from commit e84240d)
s-hertel added a commit to s-hertel/ansible that referenced this issue Apr 24, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes ansible#82702
Fixes ansible#81965
Fixes ansible#82051

(cherry picked from commit e84240d)
sivel pushed a commit that referenced this issue Apr 25, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes #82702
Fixes #81965
Fixes #82051

(cherry picked from commit e84240d)
nitzmahone pushed a commit that referenced this issue May 9, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes #82702
Fixes #81965
Fixes #82051

(cherry picked from commit e84240d)
nitzmahone pushed a commit that referenced this issue May 9, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes #82702
Fixes #81965
Fixes #82051

(cherry picked from commit e84240d)
nitzmahone pushed a commit that referenced this issue May 9, 2024
* Fix installing roles containing symlinks

Fix sanitizing tarfile symlinks relative to the link directory instead of the archive

For example:

role
├── handlers
│   └── utils.yml -> ../tasks/utils/suite.yml

The link ../tasks/utils/suite.yml will resolve to a path outside of the link's directory, but within the role

role/handlers/../tasks/utils/suite.yml

the resolved path relative to the role is tasks/utils/suite.yml, but if the symlink is set to that value, tarfile would extract it from role/handlers/tasks/utils/suite.yml

* Replace overly forgiving test case with tests for a symlink in a subdirectory of the archive and a symlink in the archive dir when these are not equivalent.

* Build test case from role files to make it easier to add test cases

Fixes #82702
Fixes #81965
Fixes #82051

(cherry picked from commit e84240d)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.15 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. P3 Priority 3 - Approved, No Time Limitation
Projects
None yet
4 participants