Commit Graph
48 Commits
Author SHA1 Message Date
Petr Viktorin 3021b3e9d5 Improve output validation
We only checked the length of Command output dictionaries. A misspelled
key in would not be caught.

Fix the problem by checking if the sets of keys are equal.

Add a test. Split the test methods into more manageable pieces.

https://fedorahosted.org/freeipa/ticket/2860
2012-06-25 22:04:14 -04:00
Petr Viktorin 1235dfa7bf Fail on unknown Command options
When unknown keyword arguments are passed to a Command, raise an
error instead of ignoring them.

Options used when IPA calls its commands internally are listed
in a new Command attribute called internal_options, and allowed.

Previous patches (0b01751c, c45174d6, c5689e7f) made IPA not use
unknown keyword arguments in its own commands and tests, but since
that some violations were reintroduced in permission_find and tests.
Fix those.

Tests included; both a frontend unittest and a XML-RPC test via the
ping plugin (which was untested previously).

https://fedorahosted.org/freeipa/ticket/2509
2012-06-20 15:18:42 +02:00
Jan Cholasta e7a6d10555 Finalize plugin initialization on demand.
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
2011-11-22 00:52:24 -05:00
Jan Cholasta b203756a88 Add ability to specify DNS reverse zone name by IP network address.
In order for this to work, chaining of parameters through
default_from is made possible.

ticket 1474
2011-07-15 02:21:23 -04:00
Pavel Zuna 18dda28c56 Fix i18n related failures in unit tests. 2011-03-01 10:31:41 -05:00
Rob Crittenden c69d8084c1 Add API version and have server reject incompatible clients.
This patch contains 2 parts.

The first part is a small utility to create and validate the current
API. To do this it needs to load ipalib which on a fresh system
introduces a few problems, namely that it relies on a python plugin
to set the default encoding to utf8. For our purposes we can skip that.
It is also important that any optional plugins be loadable so the
API can be examined.

The second part is a version exchange between the client and server.
The version has a major and a minor version. The major verion is
updated whenever existing API changes. The minor version is updated when
new API is added. A request will be rejected if either the major versions
don't match or if the client major version is higher than then server
major version (though by implication new API would return a command not
found if allowed to proceed).

To determine the API version of the server from a client use the ping
command.

ticket 584
2011-01-14 14:26:22 -05:00
Jakub Hrozek 7493d781df Change FreeIPA license to GPLv3+
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
2010-12-20 17:19:53 -05:00
Rob Crittenden 33802ab712 Use context to decide which name to return on RequirementsErrors
When a Requirement fails we throw an exception including the name of the
field that is missing. To make the command-line friendlier we have a
cli_name defined which may or may not match the LDAP attribute. This can
be confusing if you are using ipalib directly because the attribute name
missing may not match what is actually required (desc vs description is
a good example).

If you use the context 'cli' then it will throw exceptions using cli_name.
If you use any other context it will use the name of the attribute.

ticket 187
2010-10-28 16:06:06 -04:00
Jason Gerard DeRose dc2f246d47 Command.output_params not contains params in Command.params 2010-02-11 14:56:10 -05:00
Jason Gerard DeRose 1d6cc1bb7b Remove __public__ and __proxy__ hold-overs from Plugin class 2010-01-28 13:32:00 -05:00
Jason Gerard DeRose b6e4972e7f Take 2: Extensible return values and validation; steps toward a single output_for_cli(); enable more webUI stuff 2009-12-10 08:29:15 -07:00
Jason Gerard DeRose 5c9437b9e6 Removed util.add_global_options() and frontend.Application 2009-10-14 15:07:17 -06:00
Pavel Zuna e01b1b8f99 Fix unit tests for plugins using baseldap classes. 2009-10-05 15:59:09 -04:00
Jason Gerard DeRose c0f558d98b Removed PluginProxy and all its uses 2009-08-05 12:18:51 -04:00
Pavel Zuna cda0f85ce5 Fix bug in Encoder where tuples were encoded into lists. Fix Encoder and Command.args_options_2_entry unit tests. 2009-06-10 11:51:10 -04:00
Jason Gerard DeRose 7e58b29a92 Completed Param.use_in_context() functionality, which is now used by Command and Object 2009-05-21 14:32:45 -04:00
Pavel Zuna 7d0bd4b895 Rename errors2.py to errors.py. Modify all affected files. 2009-04-23 10:29:14 -04:00
Rob Crittenden 64fa3dd4c3 Finish work replacing the errors module with errors2
Once this is committed we can start the process of renaming errors2 as errors.
I thought that combinig this into one commit would be more difficult to
review.
2009-04-20 13:58:26 -04:00
Pavel Zuna 8041cd038b Add unit test for ipalib.frontend.Command.args_options_2_entry. 2009-02-24 14:40:47 -05:00
Jason Gerard DeRose 244346dbcb More work on xmlrpc stuff, started migrated more code to use errors2 instead of errors 2009-02-03 15:29:01 -05:00
Jason Gerard DeRose 24b6cb89d4 Further migration toward new xmlrcp code; fixed problem with unicode Fault.faultString; fixed problem where ServerProxy method was not called correctly 2009-02-03 15:29:01 -05:00
Jason Gerard DeRose 6aadeb9aea Added Object.params_minus() method; various small tweaks 2009-02-03 15:29:00 -05:00
Jason Gerard DeRose f3a84683d2 Removed depreciated Command.args_to_kw() method; updated CLI to use Command.args_options_2_params() instead 2009-02-03 15:29:00 -05:00
Jason Gerard DeRose ae39dece13 Added Command.args_options_2_params() method and its unit tests 2009-02-03 15:29:00 -05:00
Jason Gerard DeRose 6e53d03c69 Command.takes_options and Command.takes_args class attributes can now also be a callable 2009-02-03 15:28:59 -05:00
Jason Gerard DeRose 79422d0489 All unit tests now working (except for doctests and Rob's xmlrpc tests) 2009-01-14 13:51:37 -07:00
Jason Gerard DeRose 09e2f5d615 New Param: got most of unit tests ported (still have 6 errors); haven't ported doctests yet 2009-01-14 13:17:30 -07:00
Jason Gerard DeRose 69acff450c New Param: removed more depreciated 'import ipa_types' 2009-01-14 12:00:47 -07:00
Jason Gerard DeRose 2b2e73e7df Removed depreciated code from frontend.py; frontend.py no longer imports ipa_types 2009-01-14 11:39:29 -07:00
Jason Gerard DeRose 7e21ea5ad8 Fixed Warning messages about log dir in unit test 2008-12-08 16:56:24 -07:00
Jason Gerard DeRose 500b816681 Added unit test for Param.ispassword() method 2008-11-18 16:29:08 -07:00
Jason Gerard DeRose 8474bd01da Command.get_defaults() now returns param.default if param.type is a Bool 2008-11-17 18:50:30 -07:00
Jason Gerard DeRose 9de56d43f0 env plugin now subclasses from RemoteOrLocal 2008-11-14 21:58:39 -07:00
Jason Gerard DeRose 36737c2d91 Added frontend.LocalOrRemote command base class for commands like env 2008-11-14 21:29:46 -07:00
Jason Gerard DeRose 860d391f3e Change Param.__repr__() so it returns the exact expression that could create it; added unit test for Param.__repre__() 2008-11-13 22:16:04 -07:00
Jason Gerard DeRose f04aaff97c output_for_cli signature is now output_for_cli(textui, result, *args, **options) 2008-11-12 09:55:11 -07:00
Jason Gerard DeRose d76202fea3 API.env is now an Env instance rather than an Environment instance 2008-10-27 01:35:40 -06:00
Jason Gerard DeRose bb978e591b Fixed bug in DefaultFrom where impleied keys were using entire func_code.co_varnames instead of an approprate slice 2008-10-20 16:45:32 -06:00
Jason Gerard DeRose 8322138f38 Added new Param.flags attribute (set with flags=foo kwarg) 2008-10-17 19:34:26 -06:00
Martin Nagy 3a80297b04 Reworking Environment, moved it to config.py 2008-10-17 23:11:51 +02:00
Jason Gerard DeRose 446037fd60 Added Object.get_dn() method; added corresponding unit tests 2008-10-13 23:26:24 -06:00
Jason Gerard DeRose 8674086b85 Param now takes cli_name kwarg that sets Param.cli_name attribute 2008-10-13 17:24:23 -06:00
Jason Gerard DeRose 887016e69d Base Command.execute() method now raises NotImplementedError; updated unit tests 2008-10-08 18:18:13 -06:00
Jason Gerard DeRose ad2cd6560b PEP 257: cleaned up docstrings in test_frontend.py 2008-10-08 00:58:53 -06:00
Jason Gerard DeRose deb8e3dfc8 Renamed tests/tstutil.py to tests/util.py 2008-10-07 22:30:53 -06:00
Jason Gerard DeRose f6ac2df6bd Moved tstutil.py into base of tests so it can be used by all test subpackages more easily 2008-10-07 21:59:47 -06:00
Jason Gerard DeRose af56c71d50 Cleaned up package and module level docstrings for everything in tests/ 2008-10-07 21:25:23 -06:00
Jason Gerard DeRose 7721443a62 Moved ipalib/tests/ into tests/test_ipalib/ 2008-10-07 20:41:15 -06:00