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: Runtime.prepare_environment() got an unexpected keyword argument 'offline' #2183

Closed
githubixx opened this issue May 31, 2022 · 2 comments · Fixed by #2199
Closed
Labels

Comments

@githubixx
Copy link

Summary

Running ansible-lint . for https://github.com/githubixx/ansible-role-cni e.g. causes this error:

Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
  File "/usr/lib/python3.10/site-packages/ansiblelint/__main__.py", line 252, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
  File "/usr/lib/python3.10/site-packages/ansiblelint/__main__.py", line 165, in main
    app = get_app(offline=options.offline)
  File "/usr/lib/python3.10/site-packages/ansiblelint/app.py", line 251, in get_app
    app.runtime.prepare_environment(offline=offline)
TypeError: Runtime.prepare_environment() got an unexpected keyword argument 'offline'
Issue Type
  • Bug Report
Ansible and Ansible Lint details
ansible --version
ansible [core 2.13.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/xxxxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/xxxxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]
  jinja version = 3.1.2
  libyaml = True


ansible-lint --version
ansible-lint 6.2.2 using ansible 2.13.0
  • ansible installation method: Archlinux OS package
  • ansible-lint installation method: Archlinux OS package
OS / ENVIRONMENT

Archlinux (updated yesterday) but issue already exits since at least 2-3 weeks

STEPS TO REPRODUCE
git clone https://github.com/githubixx/ansible-role-cni
cd ansible-role-cni
ansible-lint .
Desired Behavior

No TypeError exception should be thrown.

Seems it was introduced here: https://github.com/ansible/ansible-lint/pull/2115/files#diff-16e01f8d036f46620401c93e06e17287bdac89543238bcaa029fc185ed8d5f42R251

If I change app.runtime.prepare_environment(offline=offline) back to app.runtime.prepare_environment() everything is 🆒 again.

@githubixx githubixx added bug new Triage required labels May 31, 2022
@ssbarnea
Copy link
Member

ssbarnea commented Jun 8, 2022

Can you run a pip check and report if it reports success? I am curious which version of ansible-compat are you using? Can you try to upgrade it?

offline switch was added in compat v2.1.0 via ansible/ansible-compat@1d53bc9

ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Jun 8, 2022
@cidrblock cidrblock removed the new Triage required label Jun 8, 2022
ssbarnea added a commit that referenced this issue Jun 8, 2022
@githubixx
Copy link
Author

Thanks for the hint! I finally got it working. So just in case some comes along: pip check showed this:

terminator 2.1.1 requires dbus-python, which is not installed.
py7zr 0.18.5 requires pybcj, which is not installed.
cephfs-shell 0.0.1 requires cmd2, which is not installed.
ansible-lint 6.2.2 has requirement ansible-compat>=2.0.4, but you have ansible-compat 2.0.2.
ansible-lint 6.2.2 has requirement jsonschema>=4.5.1, but you have jsonschema 3.2.0.
ansible 5.8.0 has requirement ansible-core~=2.12.5, but you have ansible-core 2.13.0.
sphinx-rtd-theme 1.0.0 has requirement docutils<0.18, but you have docutils 0.18.1.
pipx 0.16.4 has requirement argcomplete<2.0,>=1.9.4, but you have argcomplete 2.0.0.

Looks like it was a "mixup" of different versions. While I had python-ansible-compat-2.1.0-1 installed via pacman (system wide) there was an additional version installed in $HOME/.local/lib/python3.10/site-packages and that one was 2.0.2. After getting rid of that one it now works 😃

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

Successfully merging a pull request may close this issue.

3 participants