mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* 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>
(cherry picked from commit a6c8078ccf
)
Co-authored-by: Marc Leuser <marcquark@users.noreply.github.com>
This commit is contained in:
parent
baec510c40
commit
b4ae2ce44d
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
|
default: present
|
||||||
choices: [ 'present', 'absent' ]
|
choices: [ 'present', 'absent' ]
|
||||||
type: str
|
type: str
|
||||||
|
timeout:
|
||||||
|
description:
|
||||||
|
- HTTP(S) connection timeout in seconds.
|
||||||
|
default: 5
|
||||||
|
type: int
|
||||||
|
version_added: 5.7.0
|
||||||
requirements:
|
requirements:
|
||||||
- "nc-dnsapi >= 0.1.3"
|
- "nc-dnsapi >= 0.1.3"
|
||||||
author: "Nicolai Buchwitz (@nbuchwitz)"
|
author: "Nicolai Buchwitz (@nbuchwitz)"
|
||||||
|
@ -129,6 +135,18 @@ EXAMPLES = '''
|
||||||
type: "AAAA"
|
type: "AAAA"
|
||||||
value: "::1"
|
value: "::1"
|
||||||
solo: true
|
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 = '''
|
RETURN = '''
|
||||||
|
@ -193,6 +211,7 @@ def main():
|
||||||
priority=dict(required=False, type='int'),
|
priority=dict(required=False, type='int'),
|
||||||
solo=dict(required=False, type='bool', default=False),
|
solo=dict(required=False, type='bool', default=False),
|
||||||
state=dict(required=False, choices=['present', 'absent'], default='present'),
|
state=dict(required=False, choices=['present', 'absent'], default='present'),
|
||||||
|
timeout=dict(required=False, type='int', default=5),
|
||||||
|
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
|
@ -211,6 +230,7 @@ def main():
|
||||||
priority = module.params.get('priority')
|
priority = module.params.get('priority')
|
||||||
solo = module.params.get('solo')
|
solo = module.params.get('solo')
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
timeout = module.params.get('timeout')
|
||||||
|
|
||||||
if record_type == 'MX' and not priority:
|
if record_type == 'MX' and not priority:
|
||||||
module.fail_json(msg="record type MX required the 'priority' argument")
|
module.fail_json(msg="record type MX required the 'priority' argument")
|
||||||
|
@ -218,7 +238,7 @@ def main():
|
||||||
has_changed = False
|
has_changed = False
|
||||||
all_records = []
|
all_records = []
|
||||||
try:
|
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)
|
all_records = api.dns_records(domain)
|
||||||
record = DNSRecord(record, record_type, value, priority=priority)
|
record = DNSRecord(record, record_type, value, priority=priority)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue