diff options
| author | Adrian Likins <alikins@redhat.com> | 2008-07-24 16:17:47 -0400 |
|---|---|---|
| committer | Adrian Likins <alikins@redhat.com> | 2008-07-24 16:17:47 -0400 |
| commit | cedd9198d92ed606fe47bb64cfbe8e0a4aa07ec8 (patch) | |
| tree | e8df842dd72404a2ff7f1ac5974d098af6cbe1db /func/utils.py | |
| parent | 01f597a670b3554e96cb3f27b68ad4655d66a50b (diff) | |
| parent | 2cf553e9375110f7c15b1785bc95b37c07592750 (diff) | |
Merge branch 'unduping_code'
Diffstat (limited to 'func/utils.py')
| -rwxr-xr-x | func/utils.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/func/utils.py b/func/utils.py index 9577bd9..0e4b4d5 100755 --- a/func/utils.py +++ b/func/utils.py @@ -18,49 +18,6 @@ import socket REMOTE_ERROR = "REMOTE_ERROR" -def trace_me(): - x = traceback.extract_stack() - bar = string.join(traceback.format_list(x)) - return bar - -def daemonize(pidfile=None): - """ - Daemonize this process with the UNIX double-fork trick. - Writes the new PID to the provided file name if not None. - """ - - print pidfile - pid = os.fork() - if pid > 0: - sys.exit(0) - os.setsid() - os.umask(0) - pid = os.fork() - - if pid > 0: - if pidfile is not None: - open(pidfile, "w").write(str(pid)) - sys.exit(0) - -def nice_exception(etype, evalue, etb): - etype = str(etype) - try: - lefti = etype.index("'") + 1 - righti = etype.rindex("'") - nicetype = etype[lefti:righti] - except: - nicetype = etype - nicestack = string.join(traceback.format_list(traceback.extract_tb(etb))) - return [ REMOTE_ERROR, nicetype, str(evalue), nicestack ] - -def get_hostname(): - fqdn = socket.getfqdn() - host = socket.gethostname() - if fqdn.find(host) != -1: - return fqdn - else: - return host - def is_error(result): if type(result) != list: |
