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

Bump python-consul version to 0.7.0 #16

Merged
merged 1 commit into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ language: python
install: pip install tox
env:
matrix:
# consul 0.4.1
- TOX_ENV=py27 CONSUL_VERSION=0.4.1
- TOX_ENV=py33 CONSUL_VERSION=0.4.1
- TOX_ENV=py34 CONSUL_VERSION=0.4.1
- TOX_ENV=py35 CONSUL_VERSION=0.4.1
# consul 0.7.5
- TOX_ENV=py27 CONSUL_VERSION=0.7.5
- TOX_ENV=py33 CONSUL_VERSION=0.7.5
- TOX_ENV=py34 CONSUL_VERSION=0.7.5
- TOX_ENV=py35 CONSUL_VERSION=0.7.5

# consul 0.5.2
- TOX_ENV=py27 CONSUL_VERSION=0.5.2
- TOX_ENV=py33 CONSUL_VERSION=0.5.2
- TOX_ENV=py34 CONSUL_VERSION=0.5.2
- TOX_ENV=py35 CONSUL_VERSION=0.5.2
# consul 0.8.5
- TOX_ENV=py27 CONSUL_VERSION=0.8.5
- TOX_ENV=py33 CONSUL_VERSION=0.8.5
- TOX_ENV=py34 CONSUL_VERSION=0.8.5
- TOX_ENV=py35 CONSUL_VERSION=0.8.5

# consul 0.6.4
- TOX_ENV=py27 CONSUL_VERSION=0.6.4
- TOX_ENV=py33 CONSUL_VERSION=0.6.4
- TOX_ENV=py34 CONSUL_VERSION=0.6.4
- TOX_ENV=py35 CONSUL_VERSION=0.6.4
# consul 0.9.0
- TOX_ENV=py27 CONSUL_VERSION=0.9.0
- TOX_ENV=py33 CONSUL_VERSION=0.9.0
- TOX_ENV=py34 CONSUL_VERSION=0.9.0
- TOX_ENV=py35 CONSUL_VERSION=0.9.0

# coverage and style checks
- TOX_ENV=pep8 CONSUL_VERSION=0.4.1
- TOX_ENV=coverage CONSUL_VERSION=0.4.1
- TOX_ENV=pep8 CONSUL_VERSION=0.9.0
- TOX_ENV=coverage CONSUL_VERSION=0.9.0

before_script:
- wget https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-consul==0.4.0
python-consul>=0.7.0,<0.8.0
6 changes: 4 additions & 2 deletions src/ianitor/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging
from requests import ConnectionError

from consul import Check
from consul import Check, ConsulException


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -122,7 +122,9 @@ def keep_alive(self):
:return: None
"""
with ignore_connection_errors("ttl_pass"):
if not self.session.agent.check.ttl_pass(self.check_id):
try:
self.session.agent.check.ttl_pass(self.check_id)
except ConsulException:
# register and ttl_pass again if it failed
logger.warning("service keep-alive failed, re-registering")
self.register()
Expand Down
3 changes: 1 addition & 2 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_remove_services():
if description["ID"] != 'consul':
agent.service.deregister(description["ID"])

# this is consul 0.4.1 behavior - consul is one of services
# this is consul behavior - consul is one of services
services = agent.services()
if 'consul' in services:
services.pop('consul')
Expand Down Expand Up @@ -142,7 +142,6 @@ def _get_service_status(session, service_obj):
# return none because check does not even exist
return

# from pprint import pprint; pprint(checks)
service_check = list(filter(
lambda check: check["ServiceName"] == service_obj.service_name, checks
)).pop()
Expand Down