Daemonic check-in/out.
This commit is contained in:
parent
efb48078c7
commit
3bc09be4dc
|
@ -193,7 +193,7 @@ class Operator(wd.Firefox):
|
|||
user_form.send_keys(user)
|
||||
pass_form.send_keys(password)
|
||||
do_it = True
|
||||
if self.debug and not force and self.opts.headless:
|
||||
if self.debug and not force and not self.opts.headless:
|
||||
_do_it = input("Really do the login? [y/n] ").lower()
|
||||
do_it = True if _do_it == "y" else False
|
||||
if do_it:
|
||||
|
|
|
@ -112,7 +112,7 @@ def operator_login(op: Operator, username: str, password: str, force: bool) -> N
|
|||
"""
|
||||
Instructs the operator to perform login.
|
||||
"""
|
||||
logger.debug("Performing login.")
|
||||
logger.debug("Performing login...")
|
||||
op.login(username, password, force)
|
||||
logger.info("Login done.")
|
||||
|
||||
|
@ -121,7 +121,7 @@ def operator_logout(op: Operator, force: bool) -> None:
|
|||
"""
|
||||
Instructs the operator to perform logout.
|
||||
"""
|
||||
logger.debug("Performing logout.")
|
||||
logger.debug("Performing logout...")
|
||||
op.logout(force)
|
||||
logger.info("Logout done.")
|
||||
|
||||
|
@ -131,7 +131,7 @@ def operator_checkin(op: Operator, force: bool) -> None:
|
|||
Instructs the operator to perform the check in.
|
||||
"""
|
||||
logger.debug("Performing check in...")
|
||||
op.checkin()
|
||||
op.check_in(force)
|
||||
logger.info("Check in done.")
|
||||
|
||||
|
||||
|
@ -140,7 +140,7 @@ def operator_checkout(op: Operator, force: bool) -> None:
|
|||
Instructs the operator to perform the check out.
|
||||
"""
|
||||
logger.debug("Performing check out...")
|
||||
op.checkout()
|
||||
op.check_out(force)
|
||||
logger.info("Check out done.")
|
||||
|
||||
|
||||
|
@ -175,24 +175,34 @@ def daemon_process(
|
|||
debug=debug,
|
||||
)
|
||||
|
||||
def stop_all() -> None:
|
||||
pass
|
||||
def _stop_all() -> None:
|
||||
logger.debug("SIGTERM...stopping all the clients...")
|
||||
clients = PLifo.All(lifo_path)
|
||||
with Fifo(fifo_path) as fifo:
|
||||
for client in clients:
|
||||
fifo.write(cmd_marshal(name=client, cmd="stop"))
|
||||
|
||||
def reload_all() -> None:
|
||||
pass
|
||||
def _reload_all() -> None:
|
||||
logger.debug("SIGUSR1 received here.")
|
||||
clients = PLifo.All(lifo_path)
|
||||
with Fifo(fifo_path) as fifo:
|
||||
for client in clients:
|
||||
fifo.write(cmd_marshal(name=client, cmd="reload"))
|
||||
|
||||
def list_all() -> None:
|
||||
pass
|
||||
def _list_all() -> None:
|
||||
logger.debug("SIGUSR2 received here.")
|
||||
clients = PLifo.All(lifo_path)
|
||||
logger.info("Client list: %s", clients)
|
||||
|
||||
context = daemon.DaemonContext(
|
||||
working_directory=working_dir, umask=umask, pidfile=pidfile
|
||||
)
|
||||
logger.debug("context defined")
|
||||
context.signal_map = {
|
||||
signal.SIGTERM: stop_all,
|
||||
signal.SIGTERM: _stop_all,
|
||||
signal.SIGHUP: "terminate",
|
||||
signal.SIGUSR1: reload_all,
|
||||
signal.SIGUSR2: list_all,
|
||||
signal.SIGUSR1: _reload_all,
|
||||
signal.SIGUSR2: _list_all,
|
||||
}
|
||||
logger.debug("signal map defined")
|
||||
cmd_map = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user