summaryrefslogtreecommitdiffstats
path: root/func/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'func/utils.py')
-rwxr-xr-xfunc/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/func/utils.py b/func/utils.py
index 1a4abb7..54c9c39 100755
--- a/func/utils.py
+++ b/func/utils.py
@@ -15,6 +15,7 @@ import string
import sys
import traceback
import xmlrpclib
+import socket
REMOTE_ERROR = "REMOTE_ERROR"
@@ -50,6 +51,15 @@ def nice_exception(etype, evalue, etb):
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:
return False