You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If ansible-lint is installed in separate virtual environment via pipx, I got warning:
# ansible-lint
WARNING: PATH altered to include /opt/pipx/venvs/ansible-lint/bin :: This is usually a sign of broken local setup, which can cause unexpected behaviors.
I think, separate virtual environment is a good way to install and update Python apps, because there will be no issues with dependencies and versions, so there should be no warning in this case.
# ls -al /opt/pipx/venvs/ansible-lint/bin
total 96
-rw-r--r-- 1 root root 1911 Aug 23 23:16 activate
-rw-r--r-- 1 root root 860 Aug 23 23:16 activate.csh
-rw-r--r-- 1 root root 2000 Aug 23 23:16 activate.fish
-rw-r--r-- 1 root root 8834 Aug 23 23:16 Activate.ps1
-rwxr-xr-x 1 root root 239 Aug 23 23:16 ansible
-rwxr-xr-x 1 root root 240 Aug 23 23:16 ansible-config
-rwxr-xr-x 1 root root 269 Aug 23 23:16 ansible-connection
-rwxr-xr-x 1 root root 241 Aug 23 23:16 ansible-console
-rwxr-xr-x 1 root root 237 Aug 23 23:16 ansible-doc
-rwxr-xr-x 1 root root 240 Aug 23 23:16 ansible-galaxy
-rwxr-xr-x 1 root root 243 Aug 23 23:16 ansible-inventory
-rwxr-xr-x 1 root root 272 Sep 26 13:20 ansible-lint
-rwxr-xr-x 1 root root 242 Aug 23 23:16 ansible-playbook
-rwxr-xr-x 1 root root 238 Aug 23 23:16 ansible-pull
-rwxr-xr-x 1 root root 1723 Aug 23 23:16 ansible-test
-rwxr-xr-x 1 root root 239 Aug 23 23:16 ansible-vault
-rwxr-xr-x 1 root root 243 Sep 2 15:35 black
-rwxr-xr-x 1 root root 244 Sep 2 15:35 blackd
-rwxr-xr-x 1 root root 238 Aug 23 23:16 cmark
-rwxr-xr-x 1 root root 236 Aug 23 23:16 jsonschema
-rwxr-xr-x 1 root root 238 Aug 23 23:16 pygmentize
lrwxrwxrwx 1 root root 9 Aug 23 23:16 python -> python3.9
lrwxrwxrwx 1 root root 9 Aug 23 23:16 python3 -> python3.9
lrwxrwxrwx 1 root root 18 Aug 23 23:16 python3.9 -> /usr/bin/python3.9
-rwxr-xr-x 1 root root 232 Aug 23 23:16 yamllint
The text was updated successfully, but these errors were encountered:
That warning was added on purpose because we do rely on a lot of code from Ansible itself and calling without activating virtualenvs might make us call two different versions of ansible, only via command line and one via python imports.
This warning is there to stay, it just reminds you that it will only look for ansible installed from inside the same environment, so you do get surprised that... is not the same ansible as the one you call directly.
And, yep, you are right that using pipx and venvs is a good practice, at least for most cases.
Out of curiosity: Why is ansible-lint calling ansible via command line? What is the use cases to do so? And even if there are these use cases, it is not a big deal to call ansible runs programmatically:
@stefan-as Most reasons are historical and I wanted to switch to do the same as you. Officially using python is not endorsed, but we already did private imports from Ansible, so that would be the worst part.
Still, I am confident that using python could introduce a huge speed boosts. Are you willing to try a PR that adds this? I am sure you will make many happy.
If
ansible-lint
is installed in separate virtual environment viapipx
, I got warning:I think, separate virtual environment is a good way to install and update Python apps, because there will be no issues with dependencies and versions, so there should be no warning in this case.
The text was updated successfully, but these errors were encountered: