Add TTL
This commit is contained in:
parent
0e0450549e
commit
4b023a01a3
3 changed files with 13 additions and 8 deletions
17
odi6/odi6.py
17
odi6/odi6.py
|
@ -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)
|
||||||
|
|
|
@ -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" }]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = odi6
|
name = odi6
|
||||||
version = 0.0.5
|
version = 0.0.6
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
packages = odi6
|
packages = odi6
|
||||||
|
|
Loading…
Reference in a new issue