Revision dfe11bad
b/qa/qa_daemon.py | ||
---|---|---|
83 | 83 |
|
84 | 84 |
""" |
85 | 85 |
|
86 |
qa_utils.PrintWarning("The following tests require the cron script for"
|
|
87 |
" ganeti-watcher to be set up.")
|
|
86 |
print qa_utils.FormatWarning("The following tests require the cron script "
|
|
87 |
"for ganeti-watcher to be set up.")
|
|
88 | 88 |
|
89 | 89 |
|
90 | 90 |
def TestInstanceAutomaticRestart(node, instance): |
b/qa/qa_instance.py | ||
---|---|---|
301 | 301 |
|
302 | 302 |
def TestInstanceMasterDiskFailure(instance, node, node2): |
303 | 303 |
"""Testing disk failure on master node.""" |
304 |
qa_utils.PrintError("Disk failure on primary node cannot be "
|
|
305 |
"tested due to potential crashes.") |
|
304 |
print qa_utils.FormatError("Disk failure on primary node cannot be "
|
|
305 |
"tested due to potential crashes.")
|
|
306 | 306 |
# The following can cause crashes, thus it's disabled until fixed |
307 |
return _TestInstanceDiskFailure(instance, node, node2, True) |
|
307 |
#return _TestInstanceDiskFailure(instance, node, node2, True)
|
|
308 | 308 |
|
309 | 309 |
|
310 | 310 |
def TestInstanceSecondaryDiskFailure(instance, node, node2): |
b/qa/qa_os.py | ||
---|---|---|
74 | 74 |
|
75 | 75 |
cmd = ' && '.join(parts) |
76 | 76 |
|
77 |
qa_utils.PrintInfo("Setting up %s with %s OS definition" % |
|
78 |
(node["primary"], ["an invalid", "a valid"][int(valid)])) |
|
77 |
print qa_utils.FormatInfo("Setting up %s with %s OS definition" % |
|
78 |
(node["primary"], |
|
79 |
["an invalid", "a valid"][int(valid)])) |
|
79 | 80 |
|
80 | 81 |
AssertEqual(StartSSH(node['primary'], cmd).wait(), 0) |
81 | 82 |
|
b/qa/qa_utils.py | ||
---|---|---|
42 | 42 |
""" |
43 | 43 |
global _INFO_SEQ, _WARNING_SEQ, _ERROR_SEQ, _RESET_SEQ |
44 | 44 |
|
45 |
# Don't use colours if stdout isn't a terminal |
|
46 |
if not sys.stdout.isatty(): |
|
47 |
return |
|
48 |
|
|
45 | 49 |
try: |
46 | 50 |
import curses |
47 | 51 |
except ImportError: |
... | ... | |
201 | 205 |
return instances |
202 | 206 |
|
203 | 207 |
|
204 |
def _PrintWithColor(text, seq): |
|
205 |
f = sys.stdout |
|
206 |
|
|
207 |
if not f.isatty(): |
|
208 |
seq = None |
|
209 |
|
|
210 |
if seq: |
|
211 |
f.write(seq) |
|
212 |
|
|
213 |
f.write(text) |
|
214 |
f.write("\n") |
|
215 |
|
|
216 |
if seq: |
|
217 |
f.write(_RESET_SEQ) |
|
218 |
|
|
219 |
|
|
220 |
def PrintWarning(text): |
|
221 |
return _PrintWithColor(text, _WARNING_SEQ) |
|
222 |
|
|
223 |
|
|
224 |
def PrintError(text): |
|
225 |
return _PrintWithColor(text, _ERROR_SEQ) |
|
208 |
def _FormatWithColor(text, seq): |
|
209 |
if not seq: |
|
210 |
return text |
|
211 |
return "%s%s%s" % (seq, text, _RESET_SEQ) |
|
226 | 212 |
|
227 | 213 |
|
228 |
def PrintInfo(text): |
|
229 |
return _PrintWithColor(text, _INFO_SEQ) |
|
214 |
FormatWarning = lambda text: _FormatWithColor(text, _WARNING_SEQ) |
|
215 |
FormatError = lambda text: _FormatWithColor(text, _ERROR_SEQ) |
|
216 |
FormatInfo = lambda text: _FormatWithColor(text, _INFO_SEQ) |
Also available in: Unified diff