diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2015-10-10 16:26:02 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-10-10 16:26:02 -0400 |
commit | ca4930493d12a8e2d8aa22ab70801f8569e88559 (patch) | |
tree | 678321f11034d45d67826bbe3f935724918bd2c2 | |
parent | grs/Execute.py: suppress logging rc = 0. (diff) | |
download | grss-ca4930493d12a8e2d8aa22ab70801f8569e88559.tar.gz grss-ca4930493d12a8e2d8aa22ab70801f8569e88559.tar.bz2 grss-ca4930493d12a8e2d8aa22ab70801f8569e88559.zip |
lint: minor code cleanups.v0.3
-rw-r--r-- | grs/Execute.py | 3 | ||||
-rw-r--r-- | grs/Interpret.py | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/grs/Execute.py b/grs/Execute.py index 87667be..8d9da75 100644 --- a/grs/Execute.py +++ b/grs/Execute.py @@ -21,7 +21,6 @@ import signal import shlex import subprocess import sys -import time from grs.Constants import CONST class Execute(): @@ -71,7 +70,7 @@ class Execute(): if timed_out: _file.write('TIMEOUT ERROR: %s\n' % cmd) - if not failok and ( _rc != 0 or timed_out): + if not failok and (_rc != 0 or timed_out): pid = os.getpid() _file.write('SENDING SIGTERM: %s\n' % pid) _file.close() diff --git a/grs/Interpret.py b/grs/Interpret.py index 5624fd4..ab16cfa 100644 --- a/grs/Interpret.py +++ b/grs/Interpret.py @@ -20,7 +20,6 @@ import os import re import signal import sys -import time from grs.Constants import CONST from grs.Daemon import Daemon @@ -81,6 +80,9 @@ class Interpret(Daemon): if self.mock_run: _lo.log(_line) return + # We'll catch this exception to get in into the + # GRS system log rather than the daemon log. Without + # the try-except, it would wind up in the daemon log. try: func(*args) except Exception as excpt: @@ -89,10 +91,11 @@ class Interpret(Daemon): err = 'Number of parameters incorrect.' if err: + pid = os.getpid() _lo.log('Bad command: %s' % _line) _lo.log('Error message: %s' % err) - _lo.log('SENDING SIGTERM\n') - os.kill(os.getpid(), signal.SIGTERM) + _lo.log('SENDING SIGTERM to %d' % pid) + os.kill(pid, signal.SIGTERM) def stampit(progress): |