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

py3.6 error with ansible galaxy #32301

Closed
retr0h opened this issue Oct 29, 2017 · 4 comments · Fixed by #34427
Closed

py3.6 error with ansible galaxy #32301

retr0h opened this issue Oct 29, 2017 · 4 comments · Fixed by #34427
Assignees
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@retr0h
Copy link
Contributor

retr0h commented Oct 29, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible-galaxy

ANSIBLE VERSION
ansible 2.4.1.0
CONFIGURATION
$ ansible-config dump --only-changed
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /Users/jodewey/.config/ansible-systems/vault-proxmox.pass
OS / ENVIRONMENT

Mac OS

SUMMARY

Python 3.6 issue with ansible-galaxy.

STEPS TO REPRODUCE
$ cat requirements.yml
---
- name: timezone
  src: yatesr.timezone
$ python --version
Python 3.6.1
$ ansible-galaxy install --force --role-file=requirements.yml --roles-path=roles -vvv
ansible-galaxy 2.4.1.0
  config file = None
  configured module search path = ['/Users/jodewey/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/jodewey/.pyenv/versions/3.6.1/lib/python3.6/site-packages/ansible
  executable location = /Users/jodewey/.pyenv/versions/3.6.1/bin/ansible-galaxy
  python version = 3.6.1 (default, May  4 2017, 15:46:43) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
No config file found; using defaults
Opened /Users/jodewey/.ansible_galaxy
found role {'name': 'timezone', 'src': 'yatesr.timezone', 'version': '', 'scm': None} in yaml file
Processing role timezone
Opened /Users/jodewey/.ansible_galaxy
- downloading role 'timezone', owned by yatesr
https://galaxy.ansible.com/api/v1/roles/?owner__username=yatesr&name=timezone
https://galaxy.ansible.com/api/v1/roles/1429/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 "/Users/jodewey/.pyenv/versions/3.6.1/bin/ansible-galaxy", line 106, in <module>
    exit_code = cli.run()
  File "/Users/jodewey/.pyenv/versions/3.6.1/lib/python3.6/site-packages/ansible/cli/galaxy.py", line 150, in run
    self.execute()
  File "/Users/jodewey/.pyenv/versions/3.6.1/lib/python3.6/site-packages/ansible/cli/__init__.py", line 154, in execute
    fn()
  File "/Users/jodewey/.pyenv/versions/3.6.1/lib/python3.6/site-packages/ansible/cli/galaxy.py", line 392, in execute_install
    installed = role.install()
  File "/Users/jodewey/.pyenv/versions/3.6.1/lib/python3.6/site-packages/ansible/galaxy/role.py", line 236, in install
    loose_versions.sort()
  File "/Users/jodewey/.pyenv/versions/3.6.1/lib/python3.6/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/Users/jodewey/.pyenv/versions/3.6.1/lib/python3.6/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'int' and 'str'

EXPECTED RESULTS

Role downloads

ACTUAL RESULTS

Exception raised

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bug_report needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 29, 2017
@akshay196
Copy link
Contributor

It is problem with Python 3.x.
In Python 3, distutils.LooseVersion fails to compare number and a word.
Bug already reported here. https://bugs.python.org/issue14894

@retr0h
Copy link
Contributor Author

retr0h commented Oct 29, 2017

If Ansible were to claim py3 support wouldn't galaxy work-a-round the issue then? Waiting on an upstream py3 fix seems to be some time away.

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 30, 2017
@retr0h
Copy link
Contributor Author

retr0h commented Dec 28, 2017

Any update on this? Not being able to use galaxy on py36 seems like an important bug.

@sivel
Copy link
Member

sivel commented Jan 3, 2018

I've created a pull request which should address this issue in a safe way with galaxy. Due to galaxy having no guarantees on version formatting, I think the solution in that PR is the best way to go.

@sivel sivel self-assigned this Jan 3, 2018
sivel added a commit to sivel/ansible that referenced this issue Jan 11, 2018
sivel added a commit that referenced this issue Jan 11, 2018
sivel added a commit to sivel/ansible that referenced this issue Jan 30, 2018
abadger pushed a commit that referenced this issue Feb 1, 2018
@abadger abadger moved this from TODO to Done in Python 3 compatibility Mar 5, 2018
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants