mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-28 15:41:22 -07:00
Fix undefined variables, basestring usage, and some associated python3 issues
This commit is contained in:
parent
9f7b0dfc30
commit
225fa5d092
84 changed files with 652 additions and 963 deletions
|
@ -242,6 +242,8 @@ try:
|
|||
except ImportError:
|
||||
python_consul_installed = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def register_with_consul(module):
|
||||
state = module.params.get('state')
|
||||
|
@ -285,7 +287,7 @@ def add_check(module, check):
|
|||
retrieve the full metadata of an existing check through the consul api.
|
||||
Without this we can't compare to the supplied check and so we must assume
|
||||
a change. '''
|
||||
if not check.name and not service_id:
|
||||
if not check.name and not check.service_id:
|
||||
module.fail_json(msg='a check name is required for a node level check, one not attached to a service')
|
||||
|
||||
consul_api = get_consul_api(module)
|
||||
|
@ -425,7 +427,7 @@ class ConsulService():
|
|||
optional['port'] = self.port
|
||||
|
||||
if len(self.checks) > 0:
|
||||
optional['check'] = checks[0].check
|
||||
optional['check'] = self.checks[0].check
|
||||
|
||||
consul_api.agent.service.register(
|
||||
self.name,
|
||||
|
@ -464,7 +466,7 @@ class ConsulService():
|
|||
return data
|
||||
|
||||
|
||||
class ConsulCheck():
|
||||
class ConsulCheck(object):
|
||||
|
||||
def __init__(self, check_id, name, node=None, host='localhost',
|
||||
script=None, interval=None, ttl=None, notes=None, http=None, timeout=None, service_id=None):
|
||||
|
@ -513,8 +515,8 @@ class ConsulCheck():
|
|||
self.check_id == other.check_id and
|
||||
self.service_id == other.service_id and
|
||||
self.name == other.name and
|
||||
self.script == script and
|
||||
self.interval == interval)
|
||||
self.script == other.script and
|
||||
self.interval == other.interval)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
@ -586,7 +588,6 @@ def main():
|
|||
except Exception as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue