Revision 225e2544
b/lib/cli.py | ||
---|---|---|
27 | 27 |
import os.path |
28 | 28 |
import time |
29 | 29 |
import logging |
30 |
import errno |
|
30 | 31 |
from cStringIO import StringIO |
31 | 32 |
|
32 | 33 |
from ganeti import utils |
... | ... | |
1939 | 1940 |
ToStderr("Aborted. Note that if the operation created any jobs, they" |
1940 | 1941 |
" might have been submitted and" |
1941 | 1942 |
" will continue to run in the background.") |
1943 |
except IOError, err: |
|
1944 |
if err.errno == errno.EPIPE: |
|
1945 |
# our terminal went away, we'll exit |
|
1946 |
sys.exit(constants.EXIT_FAILURE) |
|
1947 |
else: |
|
1948 |
raise |
|
1942 | 1949 |
|
1943 | 1950 |
return result |
1944 | 1951 |
|
... | ... | |
2795 | 2802 |
@param txt: the message |
2796 | 2803 |
|
2797 | 2804 |
""" |
2798 |
if args: |
|
2799 |
args = tuple(args) |
|
2800 |
stream.write(txt % args) |
|
2801 |
else: |
|
2802 |
stream.write(txt) |
|
2803 |
stream.write('\n') |
|
2804 |
stream.flush() |
|
2805 |
try: |
|
2806 |
if args: |
|
2807 |
args = tuple(args) |
|
2808 |
stream.write(txt % args) |
|
2809 |
else: |
|
2810 |
stream.write(txt) |
|
2811 |
stream.write('\n') |
|
2812 |
stream.flush() |
|
2813 |
except IOError, err: |
|
2814 |
if err.errno == errno.EPIPE: |
|
2815 |
# our terminal went away, we'll exit |
|
2816 |
sys.exit(constants.EXIT_FAILURE) |
|
2817 |
else: |
|
2818 |
raise |
|
2805 | 2819 |
|
2806 | 2820 |
|
2807 | 2821 |
def ToStdout(txt, *args): |
Also available in: Unified diff