diff options
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/config.py | 4 | ||||
-rw-r--r-- | ipalib/constants.py | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/ipalib/config.py b/ipalib/config.py index 888785a26..410e5f0b2 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -447,7 +447,6 @@ class Env(object): self.__doing('_bootstrap') # Set run-time variables (cannot be overridden): - self.host = getfqdn() self.ipalib = path.dirname(path.abspath(__file__)) self.site_packages = path.dirname(self.ipalib) self.script = path.abspath(sys.argv[0]) @@ -550,9 +549,6 @@ class Env(object): if 'log' not in self: self.log = self._join('logdir', '%s.log' % self.context) - # FIXME: move into ca plugin - if 'ca_host' not in self: - self.ca_host = self.host self._merge(**defaults) def _finalize(self, **lastchance): diff --git a/ipalib/constants.py b/ipalib/constants.py index 202f5fa93..23e80257d 100644 --- a/ipalib/constants.py +++ b/ipalib/constants.py @@ -21,6 +21,14 @@ """ All constants centralised in one file. """ +import socket +try: + FQDN = socket.getfqdn() +except: + try: + FQDN = socket.gethostname() + except: + FQDN = None # The parameter system treats all these values as None: NULLS = (None, '', u'', tuple(), []) @@ -127,7 +135,7 @@ DEFAULT_CONFIG = ( ('mode', 'production'), # CA plugin: - ('ca_host', object), # Set in Env._finalize_core() + ('ca_host', FQDN), # Set in Env._finalize_core() ('ca_port', 9180), ('ca_agent_port', 9443), ('ca_ee_port', 9444), @@ -160,7 +168,7 @@ DEFAULT_CONFIG = ( # raised. # Non-overridable vars set in Env._bootstrap(): - ('host', object), + ('host', FQDN), ('ipalib', object), # The directory containing ipalib/__init__.py ('site_packages', object), # The directory contaning ipalib ('script', object), # sys.argv[0] |