summaryrefslogtreecommitdiffstats
path: root/ipalib/config.py
Commit message (Collapse)AuthorAgeFilesLines
* Test and docstring fixesPetr Viktorin2014-06-231-5/+1
| | | | | | | | | The recent conversions to managed permissions left behind a few failing tests. Fix them. Also fix a now incorrect docstring in ipalib.config. Reviewed-By: Martin Kosek <mkosek@redhat.com>
* ipalib.config: Don't autoconvert values to floatPetr Viktorin2014-06-161-5/+0
| | | | | | | | | | | | | | | | | | When api.env is loaded, strings that "look like" floats got auto-converted to floats. This is wrong, as the conversion to float can lose precision. Case in point: the api_version (e.g. '2.88') should never be interpreted as float. Do not automatically convert to float. We have two numeric options: startup_timeout and wait_for_dns. wait_for_dns is already converted to int when used in the code. Convert startup_timeout to float explicitly when used, so configuration that specified it with a decimal point continues to work. Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
* ipalib.config: Only convert basedn to DNPetr Viktorin2014-06-161-1/+1
| | | | | | | | | The current code would convert values to DN if the key was a substring of 'basedn', e.g. 'base' or 'sed'. Only convert if we're actually dealing with 'basedn'. Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
* Switch client to JSON-RPCPetr Viktorin2013-11-261-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Modify ipalib.rpc to support JSON-RPC in addition to XML-RPC. This is done by subclassing and extending xmlrpclib, because our existing code relies on xmlrpclib internals. The URI to use is given in the new jsonrpc_uri env variable. When it is not given, it is generated from xmlrpc_uri by replacing /xml with /json. The rpc_json_uri env variable existed before, but was unused, undocumented and not set the install scripts. This patch removes it in favor of jsonrpc_uri (for consistency with xmlrpc_uri). Add the rpc_protocol env variable to control the protocol IPA uses. rpc_protocol defaults to 'jsonrpc', but may be changed to 'xmlrpc'. Make backend.Executioner and tests use the backend specified by rpc_protocol. For compatibility with unwrap_xml, decoding JSON now gives tuples instead of lists. Design: http://freeipa.org/page/V3/JSON-RPC Ticket: https://fedorahosted.org/freeipa/ticket/3299
* Use DN objects instead of stringsJohn Dennis2012-08-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Convert every string specifying a DN into a DN object * Every place a dn was manipulated in some fashion it was replaced by the use of DN operators * Add new DNParam parameter type for parameters which are DN's * DN objects are used 100% of the time throughout the entire data pipeline whenever something is logically a dn. * Many classes now enforce DN usage for their attributes which are dn's. This is implmented via ipautil.dn_attribute_property(). The only permitted types for a class attribute specified to be a DN are either None or a DN object. * Require that every place a dn is used it must be a DN object. This translates into lot of:: assert isinstance(dn, DN) sprinkled through out the code. Maintaining these asserts is valuable to preserve DN type enforcement. The asserts can be disabled in production. The goal of 100% DN usage 100% of the time has been realized, these asserts are meant to preserve that. The asserts also proved valuable in detecting functions which did not obey their function signatures, such as the baseldap pre and post callbacks. * Moved ipalib.dn to ipapython.dn because DN class is shared with all components, not just the server which uses ipalib. * All API's now accept DN's natively, no need to convert to str (or unicode). * Removed ipalib.encoder and encode/decode decorators. Type conversion is now explicitly performed in each IPASimpleLDAPObject method which emulates a ldap.SimpleLDAPObject method. * Entity & Entry classes now utilize DN's * Removed __getattr__ in Entity & Entity clases. There were two problems with it. It presented synthetic Python object attributes based on the current LDAP data it contained. There is no way to validate synthetic attributes using code checkers, you can't search the code to find LDAP attribute accesses (because synthetic attriutes look like Python attributes instead of LDAP data) and error handling is circumscribed. Secondly __getattr__ was hiding Python internal methods which broke class semantics. * Replace use of methods inherited from ldap.SimpleLDAPObject via IPAdmin class with IPAdmin methods. Directly using inherited methods was causing us to bypass IPA logic. Mostly this meant replacing the use of search_s() with getEntry() or getList(). Similarly direct access of the LDAP data in classes using IPAdmin were replaced with calls to getValue() or getValues(). * Objects returned by ldap2.find_entries() are now compatible with either the python-ldap access methodology or the Entity/Entry access methodology. * All ldap operations now funnel through the common IPASimpleLDAPObject giving us a single location where we interface to python-ldap and perform conversions. * The above 4 modifications means we've greatly reduced the proliferation of multiple inconsistent ways to perform LDAP operations. We are well on the way to having a single API in IPA for doing LDAP (a long range goal). * All certificate subject bases are now DN's * DN objects were enhanced thusly: - find, rfind, index, rindex, replace and insert methods were added - AVA, RDN and DN classes were refactored in immutable and mutable variants, the mutable variants are EditableAVA, EditableRDN and EditableDN. By default we use the immutable variants preserving important semantics. To edit a DN cast it to an EditableDN and cast it back to DN when done editing. These issues are fully described in other documentation. - first_key_match was removed - DN equalty comparison permits comparison to a basestring * Fixed ldapupdate to work with DN's. This work included: - Enhance test_updates.py to do more checking after applying update. Add test for update_from_dict(). Convert code to use unittest classes. - Consolidated duplicate code. - Moved code which should have been in the class into the class. - Fix the handling of the 'deleteentry' update action. It's no longer necessary to supply fake attributes to make it work. Detect case where subsequent update applies a change to entry previously marked for deletetion. General clean-up and simplification of the 'deleteentry' logic. - Rewrote a couple of functions to be clearer and more Pythonic. - Added documentation on the data structure being used. - Simplfy the use of update_from_dict() * Removed all usage of get_schema() which was being called prior to accessing the .schema attribute of an object. If a class is using internal lazy loading as an optimization it's not right to require users of the interface to be aware of internal optimization's. schema is now a property and when the schema property is accessed it calls a private internal method to perform the lazy loading. * Added SchemaCache class to cache the schema's from individual servers. This was done because of the observation we talk to different LDAP servers, each of which may have it's own schema. Previously we globally cached the schema from the first server we connected to and returned that schema in all contexts. The cache includes controls to invalidate it thus forcing a schema refresh. * Schema caching is now senstive to the run time context. During install and upgrade the schema can change leading to errors due to out-of-date cached schema. The schema cache is refreshed in these contexts. * We are aware of the LDAP syntax of all LDAP attributes. Every attribute returned from an LDAP operation is passed through a central table look-up based on it's LDAP syntax. The table key is the LDAP syntax it's value is a Python callable that returns a Python object matching the LDAP syntax. There are a handful of LDAP attributes whose syntax is historically incorrect (e.g. DistguishedNames that are defined as DirectoryStrings). The table driven conversion mechanism is augmented with a table of hard coded exceptions. Currently only the following conversions occur via the table: - dn's are converted to DN objects - binary objects are converted to Python str objects (IPA convention). - everything else is converted to unicode using UTF-8 decoding (IPA convention). However, now that the table driven conversion mechanism is in place it would be trivial to do things such as converting attributes which have LDAP integer syntax into a Python integer, etc. * Expected values in the unit tests which are a DN no longer need to use lambda expressions to promote the returned value to a DN for equality comparison. The return value is automatically promoted to a DN. The lambda expressions have been removed making the code much simpler and easier to read. * Add class level logging to a number of classes which did not support logging, less need for use of root_logger. * Remove ipaserver/conn.py, it was unused. * Consolidated duplicate code wherever it was found. * Fixed many places that used string concatenation to form a new string rather than string formatting operators. This is necessary because string formatting converts it's arguments to a string prior to building the result string. You can't concatenate a string and a non-string. * Simplify logic in rename_managed plugin. Use DN operators to edit dn's. * The live version of ipa-ldap-updater did not generate a log file. The offline version did, now both do. https://fedorahosted.org/freeipa/ticket/1670 https://fedorahosted.org/freeipa/ticket/1671 https://fedorahosted.org/freeipa/ticket/1672 https://fedorahosted.org/freeipa/ticket/1673 https://fedorahosted.org/freeipa/ticket/1674 https://fedorahosted.org/freeipa/ticket/1392 https://fedorahosted.org/freeipa/ticket/2872
* Finalize plugin initialization on demand.Jan Cholasta2011-11-221-0/+4
| | | | | | | | | | | | This patch changes the way plugins are initialized. Instead of finalizing all the plugins at once, plugins are finalized only after they are accessed (currently applies to Command, Object and Attribute subclasses, only in CLI by default). This change provides significant performance boost, as only the plugins that are actually used are finalized. ticket 1336
* Let the framework be able to override the hostname.Rob Crittenden2011-06-231-4/+0
| | | | | | | | | | | | | | | | | | The hostname is passed in during the server installation. We should use this hostname for the resulting server as well. It was being discarded and we always used the system hostname value. Important changes: - configure ipa_hostname in sssd on masters - set PKI_HOSTNAME so the hostname is passed to dogtag installer - set the hostname when doing ldapi binds This also reorders some things in the dogtag installer to eliminate an unnecessary restart. We were restarting the service twice in a row with very little time in between and this could result in a slew of reported errors, though the server installed ok. ticket 1052
* Don't perform some API self-tests in production mode for performance reasonsRob Crittenden2011-01-281-0/+3
| | | | | | | | | | | | The API does a fair number of self tests and locking to assure that the registered commands are consistent and will work. This does not need to be done on a production system and adds additional overhead causing somewhere between a 30 and 50% decrease in performance. Because makeapi is executed when a build is done ensure that it is executed in developer mode to ensure that the framework is ok. ticket 751
* Change FreeIPA license to GPLv3+Jakub Hrozek2010-12-201-5/+5
| | | | | | | | | | The changes include: * Change license blobs in source files to mention GPLv3+ not GPLv2 only * Add GPLv3+ license text * Package COPYING not LICENSE as the license blobs (even the old ones) mention COPYING specifically, it is also more common, I think https://fedorahosted.org/freeipa/ticket/239
* Add Requires on ipa-client to ipa-admintools, ensure ipa client is configuredRob Crittenden2010-10-151-0/+2
| | | | | | | | | | It makes little sense to install ipa-admintools without ipa-client, require it. Also see if the client has been configured. This is a bit tricky since we have a full set of defaults. Add a new env option that gets set if at least one configuration file is loaded. ticket 213
* Fix unicode failures in Env tests and dn failures in XML-RPC testsRob Crittenden2010-02-261-8/+8
|
* Use unicode instead of str for environmental variables in Env.Pavel Zuna2010-02-191-2/+4
|
* Allow one-character Param namesRob Crittenden2010-02-121-2/+2
| | | | This is done explicitly to support the l/localityname attribute.
* Use the FQDN and not just the hostname internally.Rob Crittenden2009-10-161-2/+2
|
* Added Param 'include' and 'exclude' kwargs; added frontend.UsesParams base ↵Jason Gerard DeRose2009-05-191-1/+3
| | | | class with methods implementing the filtering to restrict params to only certain contexts
* Force xmlrpc tests to run with in_tree=True so config files in /etc/ipa/ ↵Jason Gerard DeRose2009-05-111-23/+60
| | | | don't get read; cleaned up config.Env automagic with regard to running in-tree vs. installed
* Finished small tweaks to get new ipaserver.xmlrpc() mod_python handler workingJason Gerard DeRose2009-02-031-1/+0
|
* Started work on a much simplified mod_python serverJason Gerard DeRose2009-02-031-2/+7
|
* Added ca_host, ca_port, and ca_ssl_port Env variables that Andrew requestedJason Gerard DeRose2009-02-031-0/+4
|
* A few docstring improvements in EnvJason Gerard DeRose2009-01-051-10/+20
|
* Added a bit to config.Env docstring about that variable names must pass ↵Jason Gerard DeRose2009-01-021-0/+14
| | | | check_name() function
* Fixed Env._bootstrap() docstring typoJason Gerard DeRose2008-12-301-1/+1
|
* Env now supports float valuesJason Gerard DeRose2008-12-301-6/+15
|
* Added my name to Athors of config.pyJason Gerard DeRose2008-12-301-0/+1
|
* More docstring cleanup in ipalib.configJason Gerard DeRose2008-12-301-13/+37
|
* Docstring cleanup in the Env bootstraping methodsJason Gerard DeRose2008-12-301-37/+86
|
* Started moving some core classes and functions from plugable.py to new ↵Jason Gerard DeRose2008-12-301-27/+54
| | | | base.py module
* Renamed Env._merge_config() to Env._merge_from_file()Jason Gerard DeRose2008-12-291-3/+3
|
* Yet more small docstring cleanup in EnvJason Gerard DeRose2008-12-231-4/+5
|
* More docstring cleanup in Env and its methodsJason Gerard DeRose2008-12-231-9/+20
|
* Finished Env class docstring; more organizational cleanup in Env and its ↵Jason Gerard DeRose2008-12-231-60/+99
| | | | unit tests
* Moved setting of run-time variables from Env.__init__() to Env._bootstrap()Jason Gerard DeRose2008-12-221-13/+19
|
* Some more reorganization in Env and added class docstring to Env with lots ↵Jason Gerard DeRose2008-12-221-16/+104
| | | | of examples
* Cleaned up Env.__setattr__() and Env.__setitem__() a bit updated their unit ↵Jason Gerard DeRose2008-12-221-33/+40
| | | | tests
* The Env.__setitem__() implied conversion is now case sensitive; ↵Jason Gerard DeRose2008-12-221-11/+13
| | | | Env.__setitem__() now also accepts None as a value
* Removed Env.__getattr__(); Env no longer accepts callables for values (no ↵Jason Gerard DeRose2008-12-221-27/+11
| | | | more dynamic/lazy values)
* Removed depreciated code from config.py; removed corresponding unit testsJason Gerard DeRose2008-12-221-280/+1
|
* Added 'conf_dir' env variable, which is directory containing config filesJason Gerard DeRose2008-11-101-0/+2
|
* Finished fist draft of plugin tutorial in ipalib/__init__.py docstringJason Gerard DeRose2008-11-071-3/+9
|
* Merge branch 'master' of ↵Jason Gerard DeRose2008-10-291-0/+1
|\ | | | | | | git://git.engineering.redhat.com/users/rcritten/freeipa2
| * Implement host groupsRob Crittenden2008-10-271-0/+1
| |
* | Env._finalize_core() now also loads config from Env.conf_defaultJason Gerard DeRose2008-10-271-0/+2
| |
* | Env._bootstrap() now also sets Env.conf_defaultJason Gerard DeRose2008-10-271-5/+7
| |
* | Finished Env._finalize() and corresponding unit testsJason Gerard DeRose2008-10-241-4/+10
| |
* | Finished Env._finalize_core() and corresponding unit testsJason Gerard DeRose2008-10-241-13/+49
| |
* | Env._bootstrap() now raises StandardError if called more than onceJason Gerard DeRose2008-10-241-0/+9
| |
* | Added ipalib/constants.py; added Env._load_config() method along with ↵Jason Gerard DeRose2008-10-241-3/+78
| | | | | | | | comprehensive unit tests for same
* | Finished doodle with stricter version of EnvironmentJason Gerard DeRose2008-10-241-0/+87
|/
* Fix ipa command running in server_context=TrueRob Crittenden2008-10-231-0/+2
| | | | | | Make the LDAP host and port environment variables More changes so that commands have a shell return value lite-xmlrpc no longer hardcodes the kerberos credentials cache location
* Implement the host commandsRob Crittenden2008-10-221-0/+1
| | | | | In order for this to work against a v1 database the update host.update needs to be applied