diff options
author | David Kupka <dkupka@redhat.com> | 2016-06-21 14:41:17 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2016-06-28 15:03:42 +0200 |
commit | 65aa2d48ffeeacafd5736db33b9be050153077c3 (patch) | |
tree | 4f15b554eae830bc46581e7a65bd253ff6433fbc | |
parent | bf91c0f938502fdd9ac6490d0781788ec99a868b (diff) | |
download | freeipa-65aa2d48ffeeacafd5736db33b9be050153077c3.tar.gz freeipa-65aa2d48ffeeacafd5736db33b9be050153077c3.tar.xz freeipa-65aa2d48ffeeacafd5736db33b9be050153077c3.zip |
env: Add 'server' variable to api.env
https://fedorahosted.org/freeipa/ticket/4739
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
-rw-r--r-- | ipalib/config.py | 9 | ||||
-rw-r--r-- | ipalib/constants.py | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/config.py b/ipalib/config.py index 44dedf294..55a95bb98 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -563,6 +563,15 @@ class Env(object): self.jsonrpc_uri = urlunparse(( scheme, netloc, uripath, params, query, fragment)) + if 'server' not in self: + if 'jsonrpc_uri' in self: + jsonrpc_uri = self.jsonrpc_uri + else: + jsonrpc_uri = defaults.get('jsonrpc_uri') + if jsonrpc_uri: + parsed = urlparse(jsonrpc_uri) + self.server = parsed.netloc + self._merge(**defaults) def _finalize(self, **lastchance): diff --git a/ipalib/constants.py b/ipalib/constants.py index bcddb5b97..4242fe685 100644 --- a/ipalib/constants.py +++ b/ipalib/constants.py @@ -231,6 +231,7 @@ DEFAULT_CONFIG = ( ('logdir', object), # Directory containing log files ('log', object), # Path to context specific log file ('jsonrpc_uri', object), # derived from xmlrpc_uri in Env._finalize_core() + ('server', object), # derived from jsonrpc_uri in Env._finalize_core() ) |