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

Support for Ansible running Python3 on a Mac #5

Closed
WaffleSouffle opened this issue Oct 20, 2017 · 5 comments
Closed

Support for Ansible running Python3 on a Mac #5

WaffleSouffle opened this issue Oct 20, 2017 · 5 comments

Comments

@WaffleSouffle
Copy link

Macbook
System Version: macOS 10.12.6 (16G29)
Kernel Version: Darwin 16.7.0

brew install python3
python3 --version
Python 3.6.3
  • pip3 installed ansible
sudo -H pip3 install ansible
  • Install tecris.maven
ansible-galaxy install tecris.maven -vvv

Error reported:

ansible-galaxy 2.4.0.0
  config file = None
  configured module search path = ['/Users/bob/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible-galaxy
  python version = 3.6.3 (default, Oct 13 2017, 15:50:37) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
No config file found; using defaults
Opened /Users/bob/.ansible_galaxy
Processing role tecris.maven
Opened /Users/bob/.ansible_galaxy
- downloading role 'maven', owned by tecris
https://galaxy.ansible.com/api/v1/roles/?owner__username=tecris&name=maven
https://galaxy.ansible.com/api/v1/roles/7576/versions/?page_size=50
ERROR! Unexpected Exception, this is probably a bug: '<' not supported between instances of 'int' and 'str'
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-galaxy", line 106, in <module>
    exit_code = cli.run()
  File "/usr/local/lib/python3.6/site-packages/ansible/cli/galaxy.py", line 150, in run
    self.execute()
  File "/usr/local/lib/python3.6/site-packages/ansible/cli/__init__.py", line 154, in execute
    fn()
  File "/usr/local/lib/python3.6/site-packages/ansible/cli/galaxy.py", line 392, in execute_install
    installed = role.install()
  File "/usr/local/lib/python3.6/site-packages/ansible/galaxy/role.py", line 236, in install
    loose_versions.sort()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'int' and 'str'
@WaffleSouffle
Copy link
Author

Looks like this is a non-Mac specific issue.
The distutils for Python3 version match by taking the version name, splitting it (on .), and then comparing.
This role has version names beginning from v, deriving presumably from git tag names.
e.g. v3.5.2, v3.5.1, v3.5.0

When the distutils version comparison code compares these, it triggers an exception because it can't compare the character 'v' with a number e.g. 3.
I expect the fix is to remove the v, if that's possible.

@tecris
Copy link
Owner

tecris commented Oct 21, 2017

Can you please let me know if you have any problems with the last version, 17.08.02?

@WaffleSouffle
Copy link
Author

ansible_galaxy retrieves all the version numbers in order to compare them, so yes.
You'd need to rename the tags to drop the v prefix, or patch ansible_galaxy to strip them out before it returned them.

@tecris
Copy link
Owner

tecris commented Oct 28, 2017

Can you please try
ansible-galaxy install -f tecris.maven,17.10.28 and let me know if it works?

@tecris
Copy link
Owner

tecris commented Nov 28, 2017

Closing as no reply for 1 month.
Can be re-opened if problem persists.

@tecris tecris closed this as completed Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants