From 4b023a01a368d71ffb1151cc305d2f52c2d36f33 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Fri, 6 Oct 2023 18:09:02 +0300 Subject: [PATCH] Add TTL --- odi6/odi6.py | 17 +++++++++++------ pyproject.toml | 2 +- setup.cfg | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/odi6/odi6.py b/odi6/odi6.py index 96e2fa3..e8f47b6 100755 --- a/odi6/odi6.py +++ b/odi6/odi6.py @@ -68,7 +68,7 @@ the hostname: {data}""" 'fieldType': "A", 'subDomain': self.config['hostname'], 'target': ipv4, - 'ttl': 3600 + 'ttl': self.config['ttl'] } if record_exists: if record_exists['target'] != ipv4: @@ -88,8 +88,8 @@ hostname, updating it.""" ) sys.exit(1) else: - result = f"""A record exists {record_exists} with the same -target, doing nothing.""" + result = f"A record exists {record_exists} with the same\ +target, doing nothing." else: self._log.debug( "No A record exists for this hostname, creating it." @@ -113,14 +113,14 @@ target, doing nothing.""" if data['subDomain'] == self.config['hostname']: record_exists = data self._log.debug( - f"""Found a record that match the 'subDomain' with -the hostname: {data}""" + f"Found a record that match the 'subDomain' with\ +the hostname: {data}" ) params = { 'fieldType': "AAAA", 'subDomain': self.config['hostname'], 'target': ipv6, - 'ttl': 3600 + 'ttl': self.config['ttl'] } if record_exists: if record_exists['target'] != ipv6: @@ -311,6 +311,11 @@ then you have to enter the IP value with this option.''' help='''If the selected method is value, then you can optionally to enter the IPv6 value with this option.''' ) +@click.option( + '--ttl', '-t', + default=3600, + help='Time-To-Live for the record.' +) @click_config_file.configuration_option() def __main__(**kwargs): return odi6(**kwargs) diff --git a/pyproject.toml b/pyproject.toml index d899f5f..ea567c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ Homepage = "https://susurrando.com" [project] name = "odi6" -version = "0.0.5" +version = "0.0.6" description = "Update Dynamic Host IPv6 in OVH" readme = "README.md" authors = [{ name = "Antonio J. Delgado", email = "antonio@susurrando.com" }] diff --git a/setup.cfg b/setup.cfg index f21b342..a2e1f5a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = odi6 -version = 0.0.5 +version = 0.0.6 [options] packages = odi6