1 |
commit: ca4930493d12a8e2d8aa22ab70801f8569e88559 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 10 20:26:02 2015 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 10 20:26:02 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=ca493049 |
7 |
|
8 |
lint: minor code cleanups. |
9 |
|
10 |
grs/Execute.py | 3 +-- |
11 |
grs/Interpret.py | 9 ++++++--- |
12 |
2 files changed, 7 insertions(+), 5 deletions(-) |
13 |
|
14 |
diff --git a/grs/Execute.py b/grs/Execute.py |
15 |
index 87667be..8d9da75 100644 |
16 |
--- a/grs/Execute.py |
17 |
+++ b/grs/Execute.py |
18 |
@@ -21,7 +21,6 @@ import signal |
19 |
import shlex |
20 |
import subprocess |
21 |
import sys |
22 |
-import time |
23 |
from grs.Constants import CONST |
24 |
|
25 |
class Execute(): |
26 |
@@ -71,7 +70,7 @@ class Execute(): |
27 |
if timed_out: |
28 |
_file.write('TIMEOUT ERROR: %s\n' % cmd) |
29 |
|
30 |
- if not failok and ( _rc != 0 or timed_out): |
31 |
+ if not failok and (_rc != 0 or timed_out): |
32 |
pid = os.getpid() |
33 |
_file.write('SENDING SIGTERM: %s\n' % pid) |
34 |
_file.close() |
35 |
|
36 |
diff --git a/grs/Interpret.py b/grs/Interpret.py |
37 |
index 5624fd4..ab16cfa 100644 |
38 |
--- a/grs/Interpret.py |
39 |
+++ b/grs/Interpret.py |
40 |
@@ -20,7 +20,6 @@ import os |
41 |
import re |
42 |
import signal |
43 |
import sys |
44 |
-import time |
45 |
|
46 |
from grs.Constants import CONST |
47 |
from grs.Daemon import Daemon |
48 |
@@ -81,6 +80,9 @@ class Interpret(Daemon): |
49 |
if self.mock_run: |
50 |
_lo.log(_line) |
51 |
return |
52 |
+ # We'll catch this exception to get in into the |
53 |
+ # GRS system log rather than the daemon log. Without |
54 |
+ # the try-except, it would wind up in the daemon log. |
55 |
try: |
56 |
func(*args) |
57 |
except Exception as excpt: |
58 |
@@ -89,10 +91,11 @@ class Interpret(Daemon): |
59 |
err = 'Number of parameters incorrect.' |
60 |
|
61 |
if err: |
62 |
+ pid = os.getpid() |
63 |
_lo.log('Bad command: %s' % _line) |
64 |
_lo.log('Error message: %s' % err) |
65 |
- _lo.log('SENDING SIGTERM\n') |
66 |
- os.kill(os.getpid(), signal.SIGTERM) |
67 |
+ _lo.log('SENDING SIGTERM to %d' % pid) |
68 |
+ os.kill(pid, signal.SIGTERM) |
69 |
|
70 |
|
71 |
def stampit(progress): |