[enh] add --force to 'dyndns update'

This commit is contained in:
Laurent Peuch 2019-08-26 17:35:18 +02:00
parent 19dbe87167
commit b8f27b7593
2 changed files with 6 additions and 2 deletions

View file

@ -1533,6 +1533,10 @@ dyndns:
-i: -i:
full: --ipv4 full: --ipv4
help: IP address to send help: IP address to send
-f:
full: --force
help: Force the update (for debugging only)
action: store_true
-6: -6:
full: --ipv6 full: --ipv6
help: IPv6 address to send help: IPv6 address to send

View file

@ -176,7 +176,7 @@ def dyndns_subscribe(operation_logger, subscribe_host="dyndns.yunohost.org", dom
@is_unit_operation() @is_unit_operation()
def dyndns_update(operation_logger, dyn_host="dyndns.yunohost.org", domain=None, key=None, def dyndns_update(operation_logger, dyn_host="dyndns.yunohost.org", domain=None, key=None,
ipv4=None, ipv6=None): ipv4=None, ipv6=None, force=False):
""" """
Update IP on DynDNS platform Update IP on DynDNS platform
@ -249,7 +249,7 @@ def dyndns_update(operation_logger, dyn_host="dyndns.yunohost.org", domain=None,
logger.debug("Requested IPv4/v6 are (%s, %s)" % (ipv4, ipv6)) logger.debug("Requested IPv4/v6 are (%s, %s)" % (ipv4, ipv6))
# no need to update # no need to update
if old_ipv4 == ipv4 and old_ipv6 == ipv6: if not force and (old_ipv4 == ipv4 and old_ipv6 == ipv6):
logger.info("No updated needed.") logger.info("No updated needed.")
return return
else: else: