mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 22:11:44 -07:00
termination handling
- moved to base cli class to handle centrally and duplicate less code - now avoids duplication and reiteration of signal handler by reassigning it - left note on how to do non-graceful in case we add in future as I won't remember everything i did here and don't want to 'relearn' it.
This commit is contained in:
parent
371c7315b0
commit
38120c1075
3 changed files with 19 additions and 22 deletions
|
@ -21,7 +21,6 @@ __metaclass__ = type
|
|||
########################################################
|
||||
|
||||
import os
|
||||
import signal
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.cli import CLI
|
||||
|
@ -89,11 +88,6 @@ class AdHocCLI(CLI):
|
|||
tasks = [ dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args)), async=async, poll=poll) ]
|
||||
)
|
||||
|
||||
def _terminate(self, signum=None, framenum=None):
|
||||
if signum is not None:
|
||||
display.debug("Termination signal detected, shutting down gracefully")
|
||||
raise SystemExit
|
||||
|
||||
def run(self):
|
||||
''' use Runner lib to do SSH things '''
|
||||
|
||||
|
@ -176,9 +170,6 @@ class AdHocCLI(CLI):
|
|||
# now create a task queue manager to execute the play
|
||||
self._tqm = None
|
||||
try:
|
||||
# Manage user interruptions
|
||||
signal.signal(signal.SIGTERM, self._terminate)
|
||||
|
||||
self._tqm = TaskQueueManager(
|
||||
inventory=inventory,
|
||||
variable_manager=variable_manager,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue