From 002ce4b3520167a8e70a3eefea061c85c4f70491 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Mon, 25 Apr 2016 10:09:15 +0200 Subject: [PATCH] consul: add docs, fix typos, minor style fix --- lib/ansible/modules/extras/clustering/consul.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/extras/clustering/consul.py b/lib/ansible/modules/extras/clustering/consul.py index 4d05ebc4acc..e96e7524aeb 100644 --- a/lib/ansible/modules/extras/clustering/consul.py +++ b/lib/ansible/modules/extras/clustering/consul.py @@ -98,6 +98,8 @@ options: - the address on which the service is serving required for registration of a service required: false + default: localhost + version_added: "2.1" tags: description: - a list of tags that will be attached to the service registration. @@ -188,7 +190,7 @@ EXAMPLES = ''' service_name: nginx service_port: 80 service_address: 127.0.0.1 - + - name: register nginx with some service tags consul: service_name: nginx @@ -211,8 +213,6 @@ EXAMPLES = ''' ''' -import sys - try: import consul from requests.exceptions import ConnectionError @@ -298,8 +298,8 @@ def add_service(module, service): consul_api = get_consul_api(module) 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 - # in the service it must be reregistered + # there is no way to retrieve the details of checks so if a check is present + # in the service it must be re-registered if service.has_checks() or not existing or not existing == service: service.register(consul_api) @@ -472,7 +472,7 @@ class ConsulCheck(): self.check = consul.Check.ttl(self.ttl) if http: - if interval == None: + if interval is None: raise Exception('http check must specify interval') self.check = consul.Check.http(http, self.interval, self.timeout) @@ -517,7 +517,7 @@ class ConsulCheck(): def _add(self, data, key, attr=None): try: - if attr == None: + if attr is None: attr = key data[key] = getattr(self, attr) except: