consul: add docs, fix typos, minor style fix

pull/18777/head
Rene Moser 9 years ago committed by Matt Clay
parent f7b6523ff5
commit 002ce4b352

@ -98,6 +98,8 @@ options:
- the address on which the service is serving required for - the address on which the service is serving required for
registration of a service registration of a service
required: false required: false
default: localhost
version_added: "2.1"
tags: tags:
description: description:
- a list of tags that will be attached to the service registration. - a list of tags that will be attached to the service registration.
@ -211,8 +213,6 @@ EXAMPLES = '''
''' '''
import sys
try: try:
import consul import consul
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
@ -298,8 +298,8 @@ def add_service(module, service):
consul_api = get_consul_api(module) consul_api = get_consul_api(module)
existing = get_service_by_id(consul_api, service.id) existing = get_service_by_id(consul_api, service.id)
# there is no way to retreive the details of checks so if a check is present # there is no way to retrieve the details of checks so if a check is present
# in the service it must be reregistered # in the service it must be re-registered
if service.has_checks() or not existing or not existing == service: if service.has_checks() or not existing or not existing == service:
service.register(consul_api) service.register(consul_api)
@ -472,7 +472,7 @@ class ConsulCheck():
self.check = consul.Check.ttl(self.ttl) self.check = consul.Check.ttl(self.ttl)
if http: if http:
if interval == None: if interval is None:
raise Exception('http check must specify interval') raise Exception('http check must specify interval')
self.check = consul.Check.http(http, self.interval, self.timeout) self.check = consul.Check.http(http, self.interval, self.timeout)
@ -517,7 +517,7 @@ class ConsulCheck():
def _add(self, data, key, attr=None): def _add(self, data, key, attr=None):
try: try:
if attr == None: if attr is None:
attr = key attr = key
data[key] = getattr(self, attr) data[key] = getattr(self, attr)
except: except:

Loading…
Cancel
Save