add 'behavior' attribute to consul_session (#2183)
add 'behavior' attribute to consul_session
This commit is contained in:
parent
f0475ab1e6
commit
4914721094
1 changed files with 13 additions and 0 deletions
|
@ -100,6 +100,14 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: True
|
default: True
|
||||||
version_added: "2.1"
|
version_added: "2.1"
|
||||||
|
behavior:
|
||||||
|
description:
|
||||||
|
- the optional behavior that can be attached to the session when it
|
||||||
|
is created. This can be set to either ‘release’ or ‘delete’. This
|
||||||
|
controls the behavior when a session is invalidated.
|
||||||
|
default: release
|
||||||
|
required: false
|
||||||
|
version_added: "2.2"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
@ -188,6 +196,7 @@ def update_session(module):
|
||||||
checks = module.params.get('checks')
|
checks = module.params.get('checks')
|
||||||
datacenter = module.params.get('datacenter')
|
datacenter = module.params.get('datacenter')
|
||||||
node = module.params.get('node')
|
node = module.params.get('node')
|
||||||
|
behavior = module.params.get('behavior')
|
||||||
|
|
||||||
consul_client = get_consul_api(module)
|
consul_client = get_consul_api(module)
|
||||||
|
|
||||||
|
@ -195,6 +204,7 @@ def update_session(module):
|
||||||
|
|
||||||
session = consul_client.session.create(
|
session = consul_client.session.create(
|
||||||
name=name,
|
name=name,
|
||||||
|
behavior=behavior,
|
||||||
node=node,
|
node=node,
|
||||||
lock_delay=validate_duration('delay', delay),
|
lock_delay=validate_duration('delay', delay),
|
||||||
dc=datacenter,
|
dc=datacenter,
|
||||||
|
@ -203,6 +213,7 @@ def update_session(module):
|
||||||
module.exit_json(changed=True,
|
module.exit_json(changed=True,
|
||||||
session_id=session,
|
session_id=session,
|
||||||
name=name,
|
name=name,
|
||||||
|
behavior=behavior,
|
||||||
delay=delay,
|
delay=delay,
|
||||||
checks=checks,
|
checks=checks,
|
||||||
node=node)
|
node=node)
|
||||||
|
@ -249,6 +260,8 @@ def main():
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
checks=dict(default=None, required=False, type='list'),
|
checks=dict(default=None, required=False, type='list'),
|
||||||
delay=dict(required=False,type='str', default='15s'),
|
delay=dict(required=False,type='str', default='15s'),
|
||||||
|
behavior=dict(required=False,type='str', default='release',
|
||||||
|
choices=['release', 'delete']),
|
||||||
host=dict(default='localhost'),
|
host=dict(default='localhost'),
|
||||||
port=dict(default=8500, type='int'),
|
port=dict(default=8500, type='int'),
|
||||||
scheme=dict(required=False, default='http'),
|
scheme=dict(required=False, default='http'),
|
||||||
|
|
Loading…
Reference in a new issue