mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
netcup_dnsapi: Add timeout paramter (#5301)
* netcup_dnsapi: Add timeout paramter * add changelog fragment * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * remove unnecessary newline Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
cfecbd6763
commit
a6c8078ccf
2 changed files with 23 additions and 1 deletions
2
changelogs/fragments/5301-netcup_dnsapi-timeout.yml
Normal file
2
changelogs/fragments/5301-netcup_dnsapi-timeout.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- netcup_dnsapi - add ``timeout`` parameter (https://github.com/ansible-collections/community.general/pull/5301).
|
|
@ -72,6 +72,12 @@ options:
|
|||
default: present
|
||||
choices: [ 'present', 'absent' ]
|
||||
type: str
|
||||
timeout:
|
||||
description:
|
||||
- HTTP(S) connection timeout in seconds.
|
||||
default: 5
|
||||
type: int
|
||||
version_added: 5.7.0
|
||||
requirements:
|
||||
- "nc-dnsapi >= 0.1.3"
|
||||
author: "Nicolai Buchwitz (@nbuchwitz)"
|
||||
|
@ -129,6 +135,18 @@ EXAMPLES = '''
|
|||
type: "AAAA"
|
||||
value: "::1"
|
||||
solo: true
|
||||
|
||||
- name: Increase the connection timeout to avoid problems with an unstable connection
|
||||
community.general.netcup_dns:
|
||||
api_key: "..."
|
||||
api_password: "..."
|
||||
customer_id: "..."
|
||||
domain: "example.com"
|
||||
name: "mail"
|
||||
type: "A"
|
||||
value: "127.0.0.1"
|
||||
timeout: 30
|
||||
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -193,6 +211,7 @@ def main():
|
|||
priority=dict(required=False, type='int'),
|
||||
solo=dict(required=False, type='bool', default=False),
|
||||
state=dict(required=False, choices=['present', 'absent'], default='present'),
|
||||
timeout=dict(required=False, type='int', default=5),
|
||||
|
||||
),
|
||||
supports_check_mode=True
|
||||
|
@ -211,6 +230,7 @@ def main():
|
|||
priority = module.params.get('priority')
|
||||
solo = module.params.get('solo')
|
||||
state = module.params.get('state')
|
||||
timeout = module.params.get('timeout')
|
||||
|
||||
if record_type == 'MX' and not priority:
|
||||
module.fail_json(msg="record type MX required the 'priority' argument")
|
||||
|
@ -218,7 +238,7 @@ def main():
|
|||
has_changed = False
|
||||
all_records = []
|
||||
try:
|
||||
with nc_dnsapi.Client(customer_id, api_key, api_password) as api:
|
||||
with nc_dnsapi.Client(customer_id, api_key, api_password, timeout) as api:
|
||||
all_records = api.dns_records(domain)
|
||||
record = DNSRecord(record, record_type, value, priority=priority)
|
||||
|
||||
|
|
Loading…
Reference in a new issue