Catch SIGTERM signal and call the signal handler method.
The signal handler then raises KeyboardInterrupt. The
KeyboardInterrupt won't be caught by any 'except Exception'
clauses.
Without this the service does not stop periodic workers,
tear down pxe filters etc as it is supposed to on shutdown.
NOTE: Calling shutdown() directly from the signal handler
causes the below error. This is why the signal handler
raises KeyboardInterrupt.
AssertionError: Cannot switch to MAINLOOP from MAINLOOP
This patch differs from the commit on master:
* It also imports 'signal' module. In master the signal
module was already imported.
Related-Bug: #1765700
Story: 2001890
Task: 14374
Change-Id: If0e24eae767b7806243fa4ae34fedb30ae9af25a
(cherry picked from commit 737dbeae11)