summaryrefslogtreecommitdiffstats
path: root/func/utils.py
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2008-02-05 16:25:16 -0500
committerSeth Vidal <skvidal@fedoraproject.org>2008-02-05 16:25:16 -0500
commita9ecad95e33506b21c7b1a282b5c2fd4bfb693cf (patch)
tree28da6265ee34333f886ad2efe61d8000cd09db7e /func/utils.py
parent6b9881532773f8e697437d8c6b92ce99477a0a43 (diff)
parent40ccbbf55e6fedf57629ba344dfee2e0b3ceda18 (diff)
downloadthird_party-func-a9ecad95e33506b21c7b1a282b5c2fd4bfb693cf.tar.gz
third_party-func-a9ecad95e33506b21c7b1a282b5c2fd4bfb693cf.tar.xz
third_party-func-a9ecad95e33506b21c7b1a282b5c2fd4bfb693cf.zip
Merge branch 'master' of ssh://git.fedorahosted.org/git/hosted/func
* 'master' of ssh://git.fedorahosted.org/git/hosted/func: Make hostname detection code shared. seeing if this resultis 0 is dumb, just see if it executes use socket.getfqdn instead of gethostname for sanity sake Adding a module to allow func to control certmaster via func, this will be more useful once we have support for local connections.
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