mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/ddclient: stop trying to updat 'None' address
Looks like the type check was off leading to update an empty address. Now instead check first and throw a warning. The condition might be transient but try to hint at the user that the setup is likely broken.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
import syslog
|
||||
import hashlib
|
||||
import uuid
|
||||
import time
|
||||
@@ -120,8 +121,13 @@ class BaseAccount:
|
||||
interface = self.settings['interface'] if self.settings.get('interface' ,'').strip() != '' else None
|
||||
)
|
||||
|
||||
|
||||
if self._current_address != '' and (
|
||||
if self._current_address == None:
|
||||
syslog.syslog(
|
||||
syslog.LOG_WARNING,
|
||||
"Account %s no global IP address detected, check config if warning persists" % (self.description)
|
||||
)
|
||||
return False
|
||||
elif (
|
||||
self._state.get('ip') is None or
|
||||
self._current_address != self._state.get('ip') or
|
||||
self.state.get('md5') != self.md5
|
||||
|
||||
@@ -145,13 +145,15 @@ class Poller:
|
||||
for acc in self._accounts.values():
|
||||
if time.time() - acc.atime > self.poll_interval:
|
||||
if self.is_verbose:
|
||||
syslog.syslog(syslog.LOG_NOTICE, "Account %s execute" % acc.description)
|
||||
syslog.syslog(syslog.LOG_NOTICE, "Account %s executing" % acc.description)
|
||||
try:
|
||||
if acc.execute():
|
||||
if self.is_verbose:
|
||||
syslog.syslog(syslog.LOG_NOTICE, "Account %s changed" % acc.description)
|
||||
syslog.syslog(syslog.LOG_NOTICE, "Account %s updated" % acc.description)
|
||||
needs_flush = True
|
||||
else:
|
||||
if self.is_verbose:
|
||||
syslog.syslog(syslog.LOG_NOTICE, "Account %s not modified" % acc.description)
|
||||
# update last accessed timestamp
|
||||
acc.update_state(None)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user