Merge branch 'master' of git.wrede.ca:andreas/heartbeat

sequence
This commit is contained in:
2020-02-04 17:57:24 -05:00
2 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# $Id: hbc,v 1.9 2012/03/29 02:08:36 andreas Exp $ # $Id: hbc,v 1.9 2012/03/29 02:08:36 andreas Exp $
# NEW # NEW
import sys import sys
+8 -3
View File
@@ -34,6 +34,8 @@ from subprocess import Popen, STDOUT, PIPE
import hbdclass import hbdclass
NSUPDATE_BIN = "/usr/local/bin/nsupdate" # override in .hbrc possible
SEND_EMAIL=False SEND_EMAIL=False
SEND_PUSHOVER=True SEND_PUSHOVER=True
@@ -275,7 +277,7 @@ answer
""" % D """ % D
if DEBUG > 0: log(None, "DBG: nsup %s" % nsup) if DEBUG > 0: log(None, "DBG: nsup %s" % nsup)
cmd = ["/usr/local/bin/nsupdate", "-k", "/etc/dhcpc/K%(domain)s.+157+00000." % D, "-v"] cmd = [nsupdate_bin, "-k", "/etc/dhcpc/K%(domain)s.+157+00000." % D, "-v"]
if DEBUG > 0: log(None, "DBG: cmd %s" % cmd) if DEBUG > 0: log(None, "DBG: cmd %s" % cmd)
try: try:
p = Popen(cmd, shell=False, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=STDOUT) p = Popen(cmd, shell=False, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
@@ -285,9 +287,9 @@ answer
return "nsupdate: some error occured" return "nsupdate: some error occured"
(output, err) = p.communicate(nsup.encode()) (output, err) = p.communicate(nsup.encode())
if output.find('status: NOERROR') >= 0: if output.decode().find('status: NOERROR') >= 0:
return None return None
return output return output.decode()
# #
@@ -880,6 +882,7 @@ grace = GRACE
watchhosts = [] watchhosts = []
dyndnshosts = [] dyndnshosts = []
drophosts = [] drophosts = []
nsupdate_bin = NSUPDATE_BIN
try: try:
f = open(configfile, "r") f = open(configfile, "r")
@@ -928,6 +931,8 @@ if f:
dyndnshosts = a dyndnshosts = a
elif o == 'drophosts': elif o == 'drophosts':
drophosts = a drophosts = a
elif o == 'nsupdate_bin':
nsupdate_bin = a
f.close() f.close()
if len(args) != 0: if len(args) != 0: