1 |
commit: 988f43379698cd76e8883a6bfffff0506a1b128d |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 10 05:59:09 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 11 05:56:25 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=988f4337 |
7 |
|
8 |
resume: convert to log module |
9 |
|
10 |
The AutoResumeError exception wasn't actually used as an exception -- |
11 |
it was never raised, only printed. Throw it away in place of a plain |
12 |
log message. |
13 |
|
14 |
catalyst/base/resume.py | 22 ++++------------------ |
15 |
1 file changed, 4 insertions(+), 18 deletions(-) |
16 |
|
17 |
diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py |
18 |
index 443b46d..99d8abc 100644 |
19 |
--- a/catalyst/base/resume.py |
20 |
+++ b/catalyst/base/resume.py |
21 |
@@ -12,27 +12,13 @@ set, unset, is_set, is_unset, enabled, clear_all |
22 |
''' |
23 |
|
24 |
import os |
25 |
-import sys |
26 |
-import traceback |
27 |
|
28 |
from snakeoil import fileutils |
29 |
|
30 |
+from catalyst import log |
31 |
from catalyst.fileops import ensure_dirs, pjoin, listdir_files, clear_dir |
32 |
|
33 |
|
34 |
-class AutoResumeError(Exception): |
35 |
- def __init__(self, message, print_traceback=False): |
36 |
- if message: |
37 |
- if print_traceback: |
38 |
- (_type, value) = sys.exc_info()[:2] |
39 |
- if value!=None: |
40 |
- print |
41 |
- print "Traceback values found. listing..." |
42 |
- print traceback.print_exc(file=sys.stdout) |
43 |
- print "!!! catalyst: AutoResumeError " + message |
44 |
- print |
45 |
- |
46 |
- |
47 |
class AutoResume(object): |
48 |
'''Class for tracking and handling all aspects of |
49 |
the autoresume option and related files. |
50 |
@@ -73,7 +59,7 @@ class AutoResume(object): |
51 |
fileutils.touch(fname) |
52 |
self._points[point] = fname |
53 |
except Exception as e: |
54 |
- print AutoResumeError(str(e)) |
55 |
+ log.error('AutoResumeError: %s', e) |
56 |
return False |
57 |
return True |
58 |
|
59 |
@@ -91,7 +77,7 @@ class AutoResume(object): |
60 |
if data and no_lf: |
61 |
data = data.replace('\n', '') |
62 |
except OSError as e: |
63 |
- print AutoResumeError(str(e)) |
64 |
+ log.error('AutoResumeError: %s', e) |
65 |
return None |
66 |
return data |
67 |
return None |
68 |
@@ -109,7 +95,7 @@ class AutoResume(object): |
69 |
os.unlink(self._points[point]) |
70 |
self._points.pop(point) |
71 |
except Exception as e: |
72 |
- print AutoResumeError(str(e)) |
73 |
+ log.error('AutoResumeError: %s', e) |
74 |
return False |
75 |
return True |