diff options
author | Rob Crittenden <rcritten@redhat.com> | 2009-02-18 17:12:27 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-19 10:09:24 -0500 |
commit | 1a8ec58602504427679784c5576522c137481e38 (patch) | |
tree | a08142e9708092d0d22cea961460391e62445e86 /ipalib/util.py | |
parent | 83d5987db917b8097ff80ba4df72db754cf4f943 (diff) | |
download | freeipa-1a8ec58602504427679784c5576522c137481e38.tar.gz freeipa-1a8ec58602504427679784c5576522c137481e38.tar.xz freeipa-1a8ec58602504427679784c5576522c137481e38.zip |
Utility function to get the local hostname
Diffstat (limited to 'ipalib/util.py')
-rw-r--r-- | ipalib/util.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ipalib/util.py b/ipalib/util.py index f1a7928a2..3e47cc3a1 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -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): |