Commit 96391341 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[1704] Delete lock files when BIND 10 shuts down

parent 9427bd41
...@@ -64,6 +64,7 @@ import posix ...@@ -64,6 +64,7 @@ import posix
import copy import copy
from bind10_config import LIBEXECPATH from bind10_config import LIBEXECPATH
import bind10_config
import import
import isc.util.process import isc.util.process
import import
...@@ -1122,6 +1123,24 @@ def unlink_pid_file(pid_file): ...@@ -1122,6 +1123,24 @@ def unlink_pid_file(pid_file):
if error.errno is not errno.ENOENT: if error.errno is not errno.ENOENT:
raise raise
def remove_lock_files():
Remove various lock files which were created by code such as in the
logger. This function should be called after BIND 10 shutdown.
lockfiles = ["logger_lockfile"]
lpath = bind10_config.DATA_PATH
if "B10_FROM_BUILD" in os.environ:
lpath = os.environ["B10_FROM_BUILD"]
if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
lpath = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"]
for f in lockfiles:
os.unlink(lpath + '/' + f)
def main(): def main():
global options global options
...@@ -1201,6 +1220,7 @@ def main(): ...@@ -1201,6 +1220,7 @@ def main():
finally: finally:
# Clean up the filesystem # Clean up the filesystem
unlink_pid_file(options.pid_file) unlink_pid_file(options.pid_file)
if boss_of_bind is not None: if boss_of_bind is not None:
boss_of_bind.remove_socket_srv() boss_of_bind.remove_socket_srv()
sys.exit(boss_of_bind.exitcode) sys.exit(boss_of_bind.exitcode)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment