From 3f6411a49c49da7013341ff8feae3a63e75e0fbf Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Jul 04 2017 10:06:33 +0000 Subject: ipalib.constants: Remove default domain, realm, basedn, xmlrpc_uri, ldap_uri Domain, realm, basedn, xmlrpc_uri, ldap_uri do not have any reasonable default. This patch removes hardcoded default so the so the code which depends on these values blows up early and does not do crazy stuff with default values instead of real ones. This should help to uncover issues caused by improper ipalib initialization. Reviewed-By: Martin Babinsky Reviewed-By: Christian Heimes --- diff --git a/ipalib/constants.py b/ipalib/constants.py index ab466ba..31cd078 100644 --- a/ipalib/constants.py +++ b/ipalib/constants.py @@ -69,9 +69,12 @@ DEFAULT_CONFIG = ( ('version', VERSION), # Domain, realm, basedn: - ('domain', 'example.com'), - ('realm', 'EXAMPLE.COM'), - ('basedn', DN(('dc', 'example'), ('dc', 'com'))), + # Following values do not have any reasonable default. + # Do not initialize them so the code which depends on them blows up early + # and does not do crazy stuff with default values instead of real ones. + # ('domain', 'example.com'), + # ('realm', 'EXAMPLE.COM'), + # ('basedn', DN(('dc', 'example'), ('dc', 'com'))), # LDAP containers: ('container_accounts', DN(('cn', 'accounts'))), @@ -128,9 +131,12 @@ DEFAULT_CONFIG = ( ('container_certmaprules', DN(('cn', 'certmaprules'), ('cn', 'certmap'))), # Ports, hosts, and URIs: - ('xmlrpc_uri', 'http://localhost:8888/ipa/xml'), + # Following values do not have any reasonable default. + # Do not initialize them so the code which depends on them blows up early + # and does not do crazy stuff with default values instead of real ones. + # ('xmlrpc_uri', 'http://localhost:8888/ipa/xml'), # jsonrpc_uri is set in Env._finalize_core() - ('ldap_uri', 'ldap://localhost:389'), + # ('ldap_uri', 'ldap://localhost:389'), ('rpc_protocol', 'jsonrpc'), diff --git a/makeaci b/makeaci index 98b199c..813ecc7 100755 --- a/makeaci +++ b/makeaci @@ -98,6 +98,9 @@ def main(options): plugins_on_demand=False, basedn=DN('dc=ipa,dc=example'), realm='IPA.EXAMPLE', + domain="example.com", + xmlrpc_uri="http://localhost:8888/ipa/xml", + ldap_uri="ldap://localhost:389", ) from ipaserver.install.plugins import update_managed_permissions diff --git a/makeapi b/makeapi index d0a7295..729b922 100755 --- a/makeapi +++ b/makeapi @@ -40,6 +40,7 @@ from ipalib.parameters import Param from ipalib.output import Output from ipalib.text import Gettext, NGettext, ConcatenatedLazyText from ipalib.capabilities import capabilities +from ipapython.dn import DN API_FILE='API.txt' @@ -513,6 +514,11 @@ def main(): enable_ra=True, mode='developer', plugins_on_demand=False, + basedn=DN(('dc', 'example'), ('dc', 'com')), + realm="EXAMPLE.COM", + domain="example.com", + xmlrpc_uri="http://localhost:8888/ipa/xml", + ldap_uri="ldap://localhost:389", ) api.bootstrap(**cfg)