Skip to content

Commit

Permalink
1506167: Ignore new SIGHUP signals during signal handling
Browse files Browse the repository at this point in the history
* BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1506167
* This bug was Python 2 specific.
* When signal SIGHUP was handled, then recieving other signal
  caused terminating of virt-who
  • Loading branch information
jirihnidek committed Apr 30, 2019
1 parent 2139e5d commit 48ef3b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions virtwho/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

from virtwho import log
from virtwho.config import InvalidPasswordFormat, VW_GLOBAL
from virtwho.daemon import daemon
from virtwho.executor import Executor, ReloadRequest, ExitRequest
from virtwho.parser import parse_options, OptionError
from virtwho.password import InvalidKeyFile
Expand Down Expand Up @@ -103,9 +102,13 @@ def atexit_fn(*args, **kwargs):
executor = None


def reload(signal, stackframe):
def reload(sig, stackframe):
if executor:
# Ignore signal SIGHUP during reloading executor
# See bug: https://bugzilla.redhat.com/show_bug.cgi?id=1506167
signal.signal(signal.SIGHUP, lambda _sig, _stack: None)
executor.reload()
signal.signal(signal.SIGHUP, reload)
raise ReloadRequest()
exit(1, status="virt-who cannot reload, exiting")

Expand Down

0 comments on commit 48ef3b4

Please sign in to comment.