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

Fix zabbix-template module error version comparison #39199

Conversation

amatellanes
Copy link
Contributor

SUMMARY

Fixes #39198

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

zabbix_template

ANSIBLE VERSION
ansible 2.5.1
  config file = None
  configured module search path = ['/Users/amatellanes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/amatellanes/.virtualenvs/pipeline-downloads_ansible3/lib/python3.6/site-packages/ansible
  executable location = /Users/amatellanes/.virtualenvs/pipeline-downloads_ansible3/bin/ansible
  python version = 3.6.5 (default, Mar 30 2018, 06:41:53) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
ADDITIONAL INFORMATION

Since integers and strings are non-comparable in Python 3, the following comparison will fail:

from distutils.version import LooseVersion

api_version = '3.2.10'
LooseVersion(api_version) < LooseVersion('3.2.x')

The traceback:

TypeError                                 Traceback (most recent call last)
<ipython-input-3-6897b32efdd1> in <module>()
      2 from distutils.version import LooseVersion
      3 api_version = '3.2.10'
----> 4 LooseVersion(api_version) < LooseVersion('3.2.x')

/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/version.py in __lt__(self, other)
     50
     51     def __lt__(self, other):
---> 52         c = self._cmp(other)
     53         if c is NotImplemented:
     54             return c

/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/version.py in _cmp(self, other)
    335         if self.version == other.version:
    336             return 0
--> 337         if self.version < other.version:
    338             return -1
    339         if self.version > other.version:

TypeError: '<' not supported between instances of 'int' and 'str'

By using pkg_resources module we can fix this error.

@ansibot
Copy link
Contributor

ansibot commented Apr 23, 2018

@ansibot ansibot added bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. python3 support:community This issue/PR relates to code supported by the Ansible community. labels Apr 23, 2018
@ansibot
Copy link
Contributor

ansibot commented Apr 23, 2018

The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/monitoring/zabbix/zabbix_template.py:205:0: ImportError: No module named pkg_resources

The test ansible-test sanity --test import --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/monitoring/zabbix/zabbix_template.py:205:0: ImportError: No module named pkg_resources

The test ansible-test sanity --test import --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/monitoring/zabbix/zabbix_template.py:205:0: ImportError: No module named 'pkg_resources'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/monitoring/zabbix/zabbix_template.py:205:0: ModuleNotFoundError: No module named 'pkg_resources'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/monitoring/zabbix/zabbix_template.py:205:0: ModuleNotFoundError: No module named 'pkg_resources'

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Apr 23, 2018
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Apr 24, 2018
@webknjaz webknjaz removed the needs_triage Needs a first human triage before being processed. label Apr 24, 2018
@eikef
Copy link
Contributor

eikef commented May 2, 2018

shipit

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 2, 2018
@ansibot ansibot added the affects_2.6 This issue/PR affects Ansible v2.6 label May 18, 2018
@ansibot
Copy link
Contributor

ansibot commented Jun 11, 2018

cc @D3DeFi
click here for bot help

@D3DeFi
Copy link
Contributor

D3DeFi commented Jun 12, 2018

Thanks for the fix,
shipit

@ansibot ansibot added shipit This PR is ready to be merged by Core needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. and removed community_review In order to be merged, this PR must follow the community review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. shipit This PR is ready to be merged by Core labels Jun 12, 2018
@D3DeFi
Copy link
Contributor

D3DeFi commented Jun 12, 2018

bot_status

@ansibot
Copy link
Contributor

ansibot commented Jun 12, 2018

Components

lib/ansible/modules/monitoring/zabbix/zabbix_template.py
support: community
maintainers: D3DeFi Logan2211 eikef logan2211 sookido

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 2
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 0
shipit_actors (maintainers or core team members): eikef D3DeFi
shipit_actors_other: []
automerge: automerge ci_stale test failed

click here for bot help

@amatellanes
Copy link
Contributor Author

Hi @D3DeFi,

It seems that @ansibot merged it successfully

@D3DeFi
Copy link
Contributor

D3DeFi commented Jun 12, 2018

I am not sure, looks like it is rerunning builds over and over again:
https://app.shippable.com/github/ansible/ansible/runs?branchName=devel

@resmo a little bit of help will be appreciated here :) Should we close & open a new one?

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. shipit This PR is ready to be merged by Core and removed shipit This PR is ready to be merged by Core needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jun 12, 2018
@D3DeFi
Copy link
Contributor

D3DeFi commented Jun 13, 2018

bot_status

@ansibot
Copy link
Contributor

ansibot commented Jun 13, 2018

Components

lib/ansible/modules/monitoring/zabbix/zabbix_template.py
support: community
maintainers: D3DeFi Logan2211 eikef logan2211 sookido

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 2
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 0
shipit_actors (maintainers or core team members): eikef D3DeFi
shipit_actors_other: []
automerge: automerge ci_stale test failed

click here for bot help

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. shipit This PR is ready to be merged by Core and removed shipit This PR is ready to be merged by Core needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jun 13, 2018
@ansibot ansibot added the automerge This PR was automatically merged by ansibot. label Jul 27, 2018
@ansibot ansibot merged commit c62d9a0 into ansible:devel Jul 27, 2018
@amatellanes amatellanes deleted the feature/fix-zabbix-template-module-typeerror-versions branch July 30, 2018 22:01
@dagwieers dagwieers added the zabbix Zabbix community label Jan 28, 2019
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 automerge This PR was automatically merged by ansibot. bug This issue/PR relates to a bug. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. python3 shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community. zabbix Zabbix community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zabbix_template module error: TypeError: '<' not supported between instances of 'int' and 'str'
6 participants