2008-10-24 16:07:07 -05:00
|
|
|
# Authors:
|
2008-10-24 21:59:11 -05:00
|
|
|
# Martin Nagy <mnagy@redhat.com>
|
2008-10-24 16:07:07 -05:00
|
|
|
# Jason Gerard DeRose <jderose@redhat.com>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2008 Red Hat
|
|
|
|
# see file 'COPYING' for use and warranty information
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation; version 2 only
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
"""
|
2008-12-10 22:14:05 -06:00
|
|
|
All constants centralised in one file.
|
2008-10-24 16:07:07 -05:00
|
|
|
"""
|
|
|
|
|
2008-12-10 22:14:05 -06:00
|
|
|
# The parameter system treats all these values as None:
|
|
|
|
NULLS = (None, '', u'', tuple(), [])
|
|
|
|
|
|
|
|
|
2008-12-18 02:57:39 -06:00
|
|
|
TYPE_ERROR = '%s: need a %r; got %r (which is a %r)'
|
2008-12-11 19:07:54 -06:00
|
|
|
|
|
|
|
|
|
|
|
CALLABLE_ERROR = '%s: need a callable; got %r (a %r)'
|
|
|
|
|
|
|
|
|
2008-11-12 01:46:04 -06:00
|
|
|
# Used for a tab (or indentation level) when formatting for CLI:
|
|
|
|
CLI_TAB = ' ' # Two spaces
|
2008-10-31 19:55:32 -05:00
|
|
|
|
2008-10-24 21:02:14 -05:00
|
|
|
# The section to read in the config files, i.e. [global]
|
2008-10-24 16:07:07 -05:00
|
|
|
CONFIG_SECTION = 'global'
|
2008-10-24 21:02:14 -05:00
|
|
|
|
|
|
|
|
2008-10-31 19:55:32 -05:00
|
|
|
# Log format for console output
|
|
|
|
LOG_FORMAT_STDERR = ': '.join([
|
|
|
|
'%(name)s',
|
|
|
|
'%(levelname)s',
|
|
|
|
'%(message)s',
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# Log format for console output when env.dubug is True:
|
|
|
|
LOG_FORMAT_STDERR_DEBUG = ' '.join([
|
|
|
|
'%(levelname)s',
|
|
|
|
'%(message)r',
|
|
|
|
'%(lineno)d',
|
|
|
|
'%(filename)s',
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# Tab-delimited log format for file (easy to opened in a spreadsheet):
|
2008-10-31 21:25:33 -05:00
|
|
|
LOG_FORMAT_FILE = '\t'.join([
|
|
|
|
'%(asctime)s',
|
2008-10-31 19:55:32 -05:00
|
|
|
'%(levelname)s',
|
|
|
|
'%(message)r', # Using %r for repr() so message is a single line
|
|
|
|
'%(lineno)d',
|
|
|
|
'%(pathname)s',
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2008-10-24 21:02:14 -05:00
|
|
|
# The default configuration for api.env
|
2008-10-24 21:59:11 -05:00
|
|
|
# This is a tuple instead of a dict so that it is immutable.
|
|
|
|
# To create a dict with this config, just "d = dict(DEFAULT_CONFIG)".
|
2008-10-24 21:02:14 -05:00
|
|
|
DEFAULT_CONFIG = (
|
2008-10-24 21:59:11 -05:00
|
|
|
# Domain, realm, basedn:
|
|
|
|
('domain', 'example.com'),
|
|
|
|
('realm', 'EXAMPLE.COM'),
|
|
|
|
('basedn', 'dc=example,dc=com'),
|
|
|
|
|
|
|
|
# LDAP containers:
|
|
|
|
('container_accounts', 'cn=accounts'),
|
|
|
|
('container_user', 'cn=users,cn=accounts'),
|
|
|
|
('container_group', 'cn=groups,cn=accounts'),
|
|
|
|
('container_service', 'cn=services,cn=accounts'),
|
|
|
|
('container_host', 'cn=computers,cn=accounts'),
|
2008-11-04 13:03:43 -06:00
|
|
|
('container_hostgroup', 'cn=hostgroups,cn=accounts'),
|
2008-11-14 17:04:57 -06:00
|
|
|
('container_automount', 'cn=automount'),
|
2008-10-24 21:59:11 -05:00
|
|
|
|
|
|
|
# Ports, hosts, and URIs:
|
2008-10-24 21:02:14 -05:00
|
|
|
('lite_xmlrpc_port', 8888),
|
|
|
|
('lite_webui_port', 9999),
|
|
|
|
('xmlrpc_uri', 'http://localhost:8888'),
|
2008-10-24 21:59:11 -05:00
|
|
|
('ldap_uri', 'ldap://localhost:389'),
|
|
|
|
('ldap_host', 'localhost'),
|
|
|
|
('ldap_port', 389),
|
2008-10-24 21:02:14 -05:00
|
|
|
|
2008-10-24 21:59:11 -05:00
|
|
|
# Debugging:
|
2008-10-24 21:02:14 -05:00
|
|
|
('verbose', False),
|
|
|
|
('debug', False),
|
2008-10-28 00:30:55 -05:00
|
|
|
('mode', 'production'),
|
2008-10-24 21:02:14 -05:00
|
|
|
|
2008-10-31 19:55:32 -05:00
|
|
|
# Logging:
|
|
|
|
('log_format_stderr', LOG_FORMAT_STDERR),
|
|
|
|
('log_format_stderr_debug', LOG_FORMAT_STDERR_DEBUG),
|
|
|
|
('log_format_file', LOG_FORMAT_FILE),
|
|
|
|
|
2008-10-24 21:59:11 -05:00
|
|
|
# ********************************************************
|
|
|
|
# The remaining keys are never set from the values here!
|
|
|
|
# ********************************************************
|
|
|
|
#
|
2008-10-24 21:02:14 -05:00
|
|
|
# Env.__init__() or Env._bootstrap() or Env._finalize_core()
|
|
|
|
# will have filled in all the keys below by the time DEFAULT_CONFIG
|
|
|
|
# is merged in, so the values below are never actually used. They are
|
2008-10-24 21:59:11 -05:00
|
|
|
# listed both to provide a big picture and also so DEFAULT_CONFIG contains
|
|
|
|
# the keys that should be present after Env._finalize_core() is called.
|
|
|
|
#
|
|
|
|
# The values are all None so if for some reason any of these keys were
|
|
|
|
# set from the values here, an exception will be raised.
|
2008-10-24 21:02:14 -05:00
|
|
|
|
|
|
|
# Set in Env.__init__():
|
|
|
|
('ipalib', None), # The directory containing ipalib/__init__.py
|
|
|
|
('site_packages', None), # The directory contaning ipalib
|
|
|
|
('script', None), # sys.argv[0]
|
|
|
|
('bin', None), # The directory containing script
|
|
|
|
('home', None), # The home directory of user underwhich process is running
|
|
|
|
('dot_ipa', None), # ~/.ipa directory
|
|
|
|
|
|
|
|
# Set in Env._bootstrap():
|
|
|
|
('in_tree', None), # Whether or not running in-tree (bool)
|
|
|
|
('context', None), # Name of context, default is 'default'
|
2008-10-27 01:58:25 -05:00
|
|
|
('conf', None), # Path to config file
|
|
|
|
('conf_default', None), # Path to common default config file
|
2008-11-10 16:53:10 -06:00
|
|
|
('conf_dir', None), # Directory containing config files
|
2008-10-24 21:02:14 -05:00
|
|
|
|
|
|
|
# Set in Env._finalize_core():
|
|
|
|
('in_server', None), # Whether or not running in-server (bool)
|
|
|
|
('log', None), # Path to log file
|
|
|
|
|
|
|
|
)
|