Utility function to get the local hostname

This commit is contained in:
Rob Crittenden 2009-02-18 17:12:27 -05:00
parent 83d5987db9
commit 1a8ec58602

View File

@ -30,6 +30,7 @@ import time
from types import NoneType
from xmlrpclib import Binary
import krbV
import socket
def get_current_principal():
@ -40,6 +41,16 @@ def get_current_principal():
print "Unable to get kerberos principal"
return None
def get_fqdn():
fqdn = ""
try:
fqdn = socket.getfqdn()
except:
try:
fqdn = socket.gethostname()
except:
fqdn = ""
return fqdn
# FIXME: This function has no unit test
def find_modules_in_dir(src_dir):