This commit is contained in:
Antonio J. Delgado 2023-10-06 18:09:02 +03:00
parent 0e0450549e
commit 4b023a01a3
3 changed files with 13 additions and 8 deletions

View file

@ -68,7 +68,7 @@ the hostname: {data}"""
'fieldType': "A", 'fieldType': "A",
'subDomain': self.config['hostname'], 'subDomain': self.config['hostname'],
'target': ipv4, 'target': ipv4,
'ttl': 3600 'ttl': self.config['ttl']
} }
if record_exists: if record_exists:
if record_exists['target'] != ipv4: if record_exists['target'] != ipv4:
@ -88,8 +88,8 @@ hostname, updating it."""
) )
sys.exit(1) sys.exit(1)
else: else:
result = f"""A record exists {record_exists} with the same result = f"A record exists {record_exists} with the same\
target, doing nothing.""" target, doing nothing."
else: else:
self._log.debug( self._log.debug(
"No A record exists for this hostname, creating it." "No A record exists for this hostname, creating it."
@ -113,14 +113,14 @@ target, doing nothing."""
if data['subDomain'] == self.config['hostname']: if data['subDomain'] == self.config['hostname']:
record_exists = data record_exists = data
self._log.debug( self._log.debug(
f"""Found a record that match the 'subDomain' with f"Found a record that match the 'subDomain' with\
the hostname: {data}""" the hostname: {data}"
) )
params = { params = {
'fieldType': "AAAA", 'fieldType': "AAAA",
'subDomain': self.config['hostname'], 'subDomain': self.config['hostname'],
'target': ipv6, 'target': ipv6,
'ttl': 3600 'ttl': self.config['ttl']
} }
if record_exists: if record_exists:
if record_exists['target'] != ipv6: 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, help='''If the selected method is value,
then you can optionally to enter the IPv6 value with this option.''' 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() @click_config_file.configuration_option()
def __main__(**kwargs): def __main__(**kwargs):
return odi6(**kwargs) return odi6(**kwargs)

View file

@ -7,7 +7,7 @@ Homepage = "https://susurrando.com"
[project] [project]
name = "odi6" name = "odi6"
version = "0.0.5" version = "0.0.6"
description = "Update Dynamic Host IPv6 in OVH" description = "Update Dynamic Host IPv6 in OVH"
readme = "README.md" readme = "README.md"
authors = [{ name = "Antonio J. Delgado", email = "antonio@susurrando.com" }] authors = [{ name = "Antonio J. Delgado", email = "antonio@susurrando.com" }]

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = odi6 name = odi6
version = 0.0.5 version = 0.0.6
[options] [options]
packages = odi6 packages = odi6