Comments (17)
This issue came up when running playbooks requiring differing versions of ansible and ansible-core. When ansible-core is installed first and then later ansible 2.9 is installed without doing a full unistall of ansible-core, attempting to install ansible-galaxy dependencies fails. A work around is to run ansible in a virtual environment (venv or fresh docker image) for each playbook or to add logic to uninstall ansible and ansible-core and then reinstall the specific version needed for the playbook.
sudo python3 -m pip uninstall ansible ansible-core -y
sudo python3 -m pip --proxy "$HTTPS_PROXY" install ansible==2.9.26
from ansible-lint-action.
Any update in this?
I'm using solution from mr @iranzo and everything works for me. However, I can't find an explanation for why the problem has not been resolved yet and there is no answer from the developers ...
from ansible-lint-action.
The problem is 4 months old, can someone have a temporary solution?
from ansible-lint-action.
I have the same problem if using override-deps: ansible==<other_ansible_version>
https://github.com/vitabaks/postgresql_cluster/runs/1264526883
https://github.com/vitabaks/postgresql_cluster/blob/master/.github/workflows/ansible-lint.yml
from ansible-lint-action.
ImportError: cannot import name 'AnsibleCollectionLoader' from 'ansible.utils.collection_loader' (/usr/local/lib/python3.8/site-packages/ansible/utils/collection_loader/__init__.py)
It looks like this project is dead. Maybe there are some alternatives?
from ansible-lint-action.
I ended up forking the repo and merging there the patch for it that's still pending at https://github.com/iranzo/ansible-lint-action/ and added also tagging...
https://github.com/iranzo/ansible-lint-action/releases/tag/v4.1.1 is the one containing that change if you want to give it a try
from ansible-lint-action.
Any update in this?
from ansible-lint-action.
Bumped into this while trying to use ansible-vault
or ansible-lint
.
I have Ansible 2.9 locked in dependency manager (because of mitogen) but ansible-lint
was not locked to a specific version. When ansible-lint
was updated to v6*
(which is not compatible with ansible 2.9) - it pulled in ansible-core
which broke everything. Solved my locking ansible-lint
to v5 (and making sure dependency manager removes unneeded packages).
from ansible-lint-action.
I am still using Ansible v2.9 and can report that I am affected by this bug, too. I'm just using the defaults in the ansible-lint.yml
file, too; no overriding going on of which I am aware.
I just went ahead and deleted the action until I have time to learn v2.10 and upgrade to it.
from ansible-lint-action.
I'm running into the same issue, so I've done a bit of testing.
- Do not specify an ansible version: Works, uses 2.10.4 from initial setup
- Do not specify an ansible version with ubuntu-20.04: Works, uses 2.10.4 from initial setup
- Specify ansible 2.10.4: Works, uses 2.10.4 from initial setup, override says it's satisfied
- Specify ansible 2.10.3: Works, uses 2.10.3
- Specify ansible 2.10.2: Works, uses 2.10.2
- Specify ansible 2.10.1: Works, uses 2.10.1
- Specify ansible 2.10.0: Works, uses 2.10.0
- Specify ansible 2.10: Works, uses 2.10.0
- Specify ansible 2.9.6: Fails with ImportError: cannot import name 'AnsibleCollectionLoader' from 'ansible.utils.collection_loader', uses 2.9.6
- Specify ansible 2.9: Fails with ImportError: cannot import name 'AnsibleCollectionLoader' from 'ansible.utils.collection_loader', uses 2.9.0
- Specify ansible 2.9.6 with ubuntu-20.04: Fails with ImportError: cannot import name 'AnsibleCollectionLoader' from 'ansible.utils.collection_loader', uses 2.9.6
- Specify ansible 2.9.6 and ansible-lint 4.3.6: Fails with ImportError: cannot import name 'AnsibleCollectionLoader' from 'ansible.utils.collection_loader', uses ansible 2.9.6 and ansible-lint 4.3.6
- Specify ansible 2.9.6 on a fork of ansible-lint-action that installs ansible 2.9.6: Works, uses ansible 2.9.6
- Specify ansible 2.10.4 on a fork of ansible-lint-action that installs ansible 2.9.6: Quiet failure. Appears to 'work', but the ansible 2.10.4 install fails due to an error shown below. Still runs the ansible-lint, but using ansible 2.9.6.
Conclusions:
- Specifying 2.10.x works, so the override-deps isn't completely broken.
- I didn't expect ubuntu-20.04 to fix it, but at least the behavior hasn't changed. This is important due to actions/runner-images#1816, but since everything is done in a python:3.8slim container, this is insulated.
- Downgrading ansible-lint doesn't fix it - which implies that it's not just some minor reference from ansible-lint to ansible.
- A fork of the action specifying 2.9.6 in the Dockerfile FIXES the issue, but then breaks 2.10.x, so that's not a great solution.
Idea:
I'm wondering if a better solution might be to not install ansible or ansible-lint in the Dockerfile, and only install them at run time. This sounds silly, but it would be the least-breaking change; if there is no override dep specified, add one in for 'the latest'. This would also speed up the build a good chunk for non-default versions, since you aren't installing and uninstalling the default.
That said, though I'm very experienced with Docker and not bad with Python, I'm an absolute ansible neophyte. I just started using ansible yesterday. I can try to make this change (I might also sneak in a python version upgrade, which would improve performance), but it would probably be better if someone more versed in ansible does this.
Upgrade from 2.9.x to 2.10.x error:
Collecting ansible==2.10.4
Downloading ansible-2.10.4.tar.gz (28.6 MB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_8tmb6pm/ansible_b6913abd93f741afa2a75f7673431b85/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_8tmb6pm/ansible_b6913abd93f741afa2a75f7673431b85/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-8ib71dlr
cwd: /tmp/pip-install-_8tmb6pm/ansible_b6913abd93f741afa2a75f7673431b85/
Complete output (31 lines):
### ERROR ###
Upgrading directly from ansible-2.9 or less to ansible-2.10 or greater with pip is
known to cause problems. Please uninstall the old version found at:
/usr/local/lib/python3.8/site-packages/ansible/__init__.py
and install the new version:
pip uninstall ansible
pip install ansible
If you have a broken installation, perhaps because ansible-base was installed before
ansible was upgraded, try this to resolve it:
pip install --force-reinstall ansible ansible-base
If ansible is installed in a different location than you will be installing it now
(for example, if the old version is installed by a system package manager to
/usr/lib/python3.8/site-packages/ansible but you are installing the new version into
~/.local/lib/python3.8/site-packages/ansible with `pip install --user ansible`)
or you want to install anyways and cleanup any breakage afterwards, then you may set
the ANSIBLE_SKIP_CONFLICT_CHECK environment variable to ignore this check:
ANSIBLE_SKIP_CONFLICT_CHECK=1 pip install --user ansible
### END ERROR ###
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
from ansible-lint-action.
Facing same issue :/
from ansible-lint-action.
@iranzo Thank you so much! I will definitely try in a couple of days.
from ansible-lint-action.
Same problem here, with ansible 2.9.25
from ansible-lint-action.
thestevenbell -- thanks! that was exactly the thing I was hitting.
from ansible-lint-action.
For me it was solved by uninstalling ansible-base, and afterwards installing the target version. I did not have ansible-core installed. So: for anybody looking for somebody to copy paste in their terminal; this is what I would recommend:
sudo python3 -m pip uninstall ansible ansible-base ansible-core
Followed by whatever version you want to install. In my case:
sudo python3 -m pip install ansible==2.8
from ansible-lint-action.
Dear maintainers, please merge the patch proposed earlier in the thread or tell us why you can't merge it.
Thanks!
Ping @ssbarnea
from ansible-lint-action.
We have no plans to support more than latest version of ansible-lint and ansible-core with this action.
The newer version of this action does not allow user to install a custom version of ansible or linter because we are using a pre-compiled container image with the tools. We have no container image building here.
I will close this thread because it is too old and loaded with information that no longer applies.
from ansible-lint-action.
Related Issues (20)
- (Ability to) disable verbose output HOT 2
- Couldn't resolve module/action in ansible-lint action HOT 8
- Repository not found: ansible-community/ansible-lint-action HOT 1
- Failed to discover lintable files using git: (Warning and Error) HOT 5
- fatal: detected dubious ownership in repository at '/github/workspace' HOT 10
- Please update the action with ansible-lint 6.9.0 or later HOT 2
- Warning on every run HOT 1
- The action cannot be used as a status check in a branch protection rule HOT 1
- Ansible lint not been able to use community.general.system.timezone HOT 5
- Some ansible lint rule are not checked for the playbook HOT 1
- Update to 6.14.6
- Couldn't resolve module/action error in action but not on system HOT 1
- config ignored ? HOT 2
- Link to github marketplace is broken HOT 2
- `uses: ansible/ansible-lint@v6` yields error "unable to find version `v6`" HOT 1
- Ansible-lint-action is not returning the same result as local ansible-lint HOT 1
- `ansible-lint` outdated HOT 1
- requirements.yml not loaded from given path HOT 3
- ansible-lint fails validating the .github/workflows/ansible-lint.yml HOT 3
- Update to ansible-lint 6.17.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-lint-action.