commit:     ca4930493d12a8e2d8aa22ab70801f8569e88559
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 10 20:26:02 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Oct 10 20:26:02 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=ca493049

lint: minor code cleanups.

 grs/Execute.py   | 3 +--
 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):

Reply via email to