Commit Graph

238 Commits

Author SHA1 Message Date
Rob Crittenden
58746226d4 Use the Output tuple to determine the order of output
The attributes displayed is now dependant upon their definition in
a Param. This enhances that, giving some level of control over how
the result is displayed to the user.

This also fixes displaying group membership, including failures of
adding/removing entries.

All tests pass now though there is still one problem. We need to
return the dn as well. Once that is fixed we just need to comment
out all the dn entries in the tests and they should once again
pass.
2010-02-15 13:10:11 -07:00
Rob Crittenden
8ca97cdf35 Base64-encode binary values on the command-line 2010-02-02 14:02:42 -05:00
Pavel Zuna
cfe47a3553 Temporary fix for name collision of textui.print_entry.
Somehow there's two of them... rename old one to print_entry1.
2010-01-20 16:53:28 -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
Pavel Zuna
973f36c496 Fix Bool parameter type. It was impossible to set it to FALSE. 2009-11-30 13:38:23 -05:00
Pavel Zuna
582228714e Print only one line of docstrings in command listings.
Full docstring is shown on `ipa help COMMAND`.
2009-11-30 13:25:19 -05:00
Rob Crittenden
1d1d82fda4 Fix typo in name of exception 2009-11-12 17:34:19 -05:00
Pavel Zuna
566a3cb972 Add 'File' parameter type.
Accepts filenames and loads file contents as parameter value.
2009-11-06 16:05:31 -07:00
Pavel Zuna
04c5b5ae42 Fix bug in print_attribute.
When the attribute had no values an exception was generated while
trying to word-wrap it.
2009-10-23 09:37:23 -04:00
Jason Gerard DeRose
5c9437b9e6 Removed util.add_global_options() and frontend.Application 2009-10-14 15:07:17 -06:00
Jason Gerard DeRose
f58ff2921d Giant webui patch take 2 2009-10-13 11:28:00 -06:00
Pavel Zuna
e01b1b8f99 Fix unit tests for plugins using baseldap classes. 2009-10-05 15:59:09 -04:00
Pavel Zuna
34970fef5e Improve attribute printing in the CLI.
- allow choice between single/multiple value per line
- word wrapping
2009-09-08 13:41:54 -04:00
Jason Gerard DeRose
c0f558d98b Removed PluginProxy and all its uses 2009-08-05 12:18:51 -04:00
Jason Gerard DeRose
22493eef21 Fix three broken unit tests 2009-08-04 00:21:26 -06:00
Pavel Zuna
104d02e167 Enable attribute re-mapping and ordering when printing entries.
Also print multiple values on one line separated by commas.
2009-08-03 22:56:06 -06:00
Rob Crittenden
c0b6a78040 Require a password only once when it is passed in via a pipe 2009-07-10 16:47:35 -04:00
Rob Crittenden
d6e1e15fcd Add a one-character option for parameters 2009-07-10 16:46:34 -04:00
Rob Crittenden
fe84ffd0f1 Add a return value to exceptions.
Returning the exception value doesn't work because a shell return value
is in the range of 0-255.

The default return value is 1 which means "something went wrong." The only
specific return value implemented so far is 2 which is "not found".
2009-07-10 16:44:54 -04:00
Rob Crittenden
0e29dd7226 Add textui function to display and prompt user for selection for *-find.
Since we may end up executing a *-show when an entry is selected we need
to defer destroying the connection context.
2009-07-10 16:44:22 -04:00
Rob Crittenden
e46fd3401e Two new arguments for the help built-in command: topics and commands
ipa help topics will show all topics (equivalent to ipa help)
ipa help commands will show list of all available commands
2009-06-15 14:03:12 -04:00
Rob Crittenden
fe012f4ff2 Fix a few issues introduced by the new Param.use_in_context() patch 2009-05-21 14:33:23 -04:00
Jason Gerard DeRose
87480b7bde Re-enable doctest, fix broken docstrings 2009-05-13 14:22:09 -04:00
Rob Crittenden
a7a16272b1 When reading a password, if there is no tty, read from stdin instead.
This will allow one to pipe a password in:

echo -e "secret123\secret123\n" | ipa password someuser
2009-05-04 17:43:14 -04:00
Pavel Zuna
9992b23a08 Change help interface to display builtin commands and a list of topics based on plugin modules. 2009-04-30 15:55:16 -04:00
Jason Gerard DeRose
3f4a0a2d77 Fixed cli.run() catching SystemExit exception under Python2.4
Resolves BZ #498088
2009-04-28 22:29:10 -04:00
Pavel Zuna
7d0bd4b895 Rename errors2.py to errors.py. Modify all affected files. 2009-04-23 10:29:14 -04:00
Pavel Zuna
596d410471 Make LDAP entry output slightly nicer, don't print u's in front of unicode strings etc. 2009-04-23 10:25:51 -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
Rob Crittenden
484eff1016 Implement an installer for the Dogtag certificate system.
The CA is currently not automatically installed. You have to pass in the
--ca flag to install it.

What works:
- installation
- unistallation
- cert/ra plugins can issue and retrieve server certs

What doesn't work:
- self-signed CA is still created and issues Apache and DS certs
- dogtag and python-nss not in rpm requires
- requires that CS be in the "pre" install state from pkicreate
2009-04-03 14:06:09 -04:00
Rob Crittenden
65e6259075 Always print the dn first when printing an entry 2009-03-25 11:02:42 -04:00
Jason Gerard DeRose
1359618e7e Fixed broken autfill logic in cli.prompt_interactively() 2009-02-27 12:58:32 -05:00
Rob Crittenden
5a6d2dd0d9 Print out multi-valued values one per-line instead of comman-delimited 2009-02-19 10:08:52 -05:00
Jason Gerard DeRose
a0aebd46a1 Got new ldap connection working using Connectible.connect() 2009-02-03 15:29:04 -05:00
Jason Gerard DeRose
231f0bd65a Finished reworked cli.CLI class into cli.cli plugin 2009-02-03 15:29:04 -05:00
Jason Gerard DeRose
db0168f7af Started reworking CLI class into cli plugin 2009-02-03 15:29:03 -05:00
Jason Gerard DeRose
7a0f969a47 CLI now logs trace if it catches a non-public error and then exists with an InternalError; other CLI cleanup 2009-02-03 15:29:02 -05:00
Jason Gerard DeRose
c0bc2451dd Fixed another small CLI decoding problem (multivalue args in a tuple now work) 2009-02-03 15:29:02 -05:00
Jason Gerard DeRose
e537dc89cb Fixed a few problems in the CLI interactive prompting (wont prompt for Flag now) 2009-02-03 15:29:02 -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
833088955c More xmlrpc tweaks: xmlserver.execute() now logs non-public exceptions; xmlclient.forward() now handles socket error; fixed some Python 2.4 problems in lite-xmlrpc2.py 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
46c10d4608 Removed bogus CLI.set_defaults() method that was causing non-required values to get filled in 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
7514f96173 New Param: fixed metavar bug in cli.py 2009-01-16 11:07:21 -07:00
Jason Gerard DeRose
4d4fa694ee Small change in ipalib.cli to check if param is a Password instance instead of calling depreciated ispasswd() method 2009-01-14 23:15:46 -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
6fe78a4944 Renamed all references to 'ipa_server' to 'ipaserver' 2009-01-04 18:39:39 -07:00
Jason Gerard DeRose
5b637f6a18 Removed depreciated code from config.py; removed corresponding unit tests 2008-12-22 15:41:24 -07:00
Jason Gerard DeRose
6fdf5d1e7b Merge branch 'master' of git://git.engineering.redhat.com/users/rcritten/freeipa2 2008-12-20 15:00:00 -07:00
Jakub Hrozek
360f95341a Fix show_api command 2008-12-17 17:21:25 -07:00
Jakub Hrozek
67b688c7b2 Jakub Hrozek's patch to make textui.get_tty_width() actually work 2008-12-16 19:00:39 -07:00
Rob Crittenden
3583735c60 Set defaults even for optional arguments. 2008-12-10 14:15:20 -05:00
Rob Crittenden
fc8ac69372 Port plugins to use the new output_for_cli() argument list
Fix some errors uncovered by the nosetests
2008-12-10 14:15:19 -05:00
Jason Gerard DeRose
2478ccd357 Fixed some unicode encoded/decode issues in textui.prompt_password() and textui.prompt() 2008-11-19 03:31:29 -07:00
Jason Gerard DeRose
4afee15d4b Calling 'passwd' command now prompts for password using textui.prompt_password() 2008-11-18 13:43:43 -07:00
Jason Gerard DeRose
0a60a6bcc4 Added textui.prompt_password() method; added logic in cli for dealing with 'password' flag in param.flags 2008-11-18 11:30:16 -07:00
Jason Gerard DeRose
75d1918996 Added some experimental textui methods 2008-11-17 20:41:01 -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
42bf555a3a Started updated user_* commands to use textui 2008-11-17 15:27:08 -07:00
Jason Gerard DeRose
e7ec413158 Moved plugins command from ipalib.cli to ipalib.plugins.f_misc 2008-11-16 19:50:17 -07:00
Jason Gerard DeRose
e3fec8f219 Fixed textui.print_keyval for cases when the row is a list instead of a tuple 2008-11-14 22:03:31 -07:00
Jason Gerard DeRose
c974451edf Added print_plain() and print_paragraph() methods to textui plugin and cleaned up the order of its methods 2008-11-14 13:33:42 -07:00
Jason Gerard DeRose
82d3de773b Added textui.prompt() method, which CLI.prompt_interactively() uses 2008-11-13 23:54:34 -07:00
Jason Gerard DeRose
f5594dd489 Started work on cleaning up how exceptions are caught and sys.exit() is called in ipalib.cli.CLI 2008-11-13 23:29:35 -07:00
Jason Gerard DeRose
01a7f1f437 Calling ./ipa with no command now calls Command.help() 2008-11-12 10:15:24 -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
014af24731 Changed calling signature of output_for_cli(); started work on 'textui' backend plugin 2008-11-12 00:46:04 -07:00
Rob Crittenden
f131480643 Move socket errors from the XML-RPC plugin to the client 2008-11-03 17:38:05 -05:00
Rob Crittenden
d53218a932 Handle exceptions in the command-line instead of in the XMLRPC client plugin 2008-11-03 17:19:29 -05:00
Jason Gerard DeRose
5e5a83e4e8 Renamed API.bootstrap_from_options() to bootstrap_with_global_options() 2008-10-31 19:03:07 -06:00
Jason Gerard DeRose
a23d41a57f Reoganized global option functionality to it is easy for any script to use the environment-related global options; lite-xmlrpc.py now uses same global options 2008-10-31 18:17:08 -06:00
Jason Gerard DeRose
6879140db7 Added ipalib.plugins.f_misc with new 'context' Command; moved 'env' Command from cli to f_misc 2008-10-30 02:20:28 -06:00
Jason Gerard DeRose
ddb5449c7f Did some initial work for Context plugins 2008-10-30 01:11:33 -06:00
Jason Gerard DeRose
138305b365 Added an example CLI-specific env command 2008-10-28 02:23:13 -06:00
Jason Gerard DeRose
316bd855d5 Added util.configure_logging() function; API.bootstrap() now calls util.configure_logging() 2008-10-28 01:39:02 -06:00
Jason Gerard DeRose
83d6c95e46 API.load_plugins() no longer takes dry_run=False kwarg and instead checks in env.mode == 'unit_test' to decide whether to load the plugins; it also only loads ipa_server.plugins in env.in_server is True 2008-10-27 23:39:43 -06:00
Jason Gerard DeRose
6e456cc749 More CLI cleanup, got all basics working again 2008-10-27 23:30:55 -06:00
Jason Gerard DeRose
9b1e3f5946 More docstrings, functionality, and unit tests for improved CLI class 2008-10-27 19:21:49 -06:00
Jason Gerard DeRose
e6254026fe Implemented basic CLI.bootstrap(); added corresponding unit tests 2008-10-27 15:19:49 -06:00
Jason Gerard DeRose
17fd9cc431 Started cleanup work on CLI class, added unit tests for CLI.parse_globals() 2008-10-27 14:49:34 -06:00
Jason Gerard DeRose
10026284db Started cleanup work on CLI class, added unit tests for CLI.parse_globals() 2008-10-27 14:48:02 -06:00
Rob Crittenden
06a82bf4b6 Fix ipa command running in server_context=True
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
2008-10-23 11:00:50 -04:00
Rob Crittenden
f189b02996 Return a value to the shell that called ipa 2008-10-22 17:52:32 -04:00
Rob Crittenden
bc5edcf893 Gracefully handle keyboard interrupts (^C) 2008-10-21 14:42:13 -04:00
Rob Crittenden
6b998ed479 Make boolean options work like standard OptionParser booleans 2008-10-21 09:32:48 -04:00
Jason Gerard DeRose
ac0a019605 Reworked 'plugins' command to use output_for_cli() 2008-10-20 18:57:03 -06:00
Jason Gerard DeRose
721982870e Removed generic Command.output_for_cli() method; CLI.run_interactive() now only calls output_for_cli() if it has been implemented 2008-10-17 21:05:03 -06:00
Martin Nagy
3a80297b04 Reworking Environment, moved it to config.py 2008-10-17 23:11:51 +02:00
Jason Gerard DeRose
1480224724 Started roughing out user_add() using api.Backend.ldap; added Command.output_for_cli() to take care of formatting print output 2008-10-14 01:45:30 -06:00
Jason Gerard DeRose
22669f1fc2 CLI.run_interactive() now uses Param.cli_name instead of Param.name for prompts and errors 2008-10-13 22:00:18 -06:00
Jason Gerard DeRose
b6dcd183a6 CLI now maps Param.cli_name to Param.name 2008-10-13 20:31:10 -06:00
Martin Nagy
4a1c4a3fe3 Implement argument parsing for the CLI 2008-10-08 00:07:44 +02:00
Martin Nagy
4a68c719f0 Implement config file reading 2008-10-08 00:07:44 +02:00
Martin Nagy
149429f305 Environment is now subclassed from object, rather then dict. Added tests for Environment and config.py 2008-10-02 17:22:41 -06:00
Martin Nagy
afdc721038 Add support for environment variables, change tests accordingly 2008-09-29 17:45:14 -06:00
Jason Gerard DeRose
eaf15d5a52 327: Improved formatting on show-api cli command 2008-09-24 05:35:40 +00:00
Jason Gerard DeRose
f3ac709922 326: Made output of plugins cli command nicer 2008-09-24 05:03:10 +00:00
Jason Gerard DeRose
3e70c3b56b 325: API.finalize() now creates instance attribtue 'plugins', which is a tuple of PluginInfo objects; renamed show_plugins cli command to namespaces; added new cli command plugins 2008-09-24 04:44:52 +00:00
Jason Gerard DeRose
3bf2da5714 324: Removed 'smart_option_order' from Command.__public__; cli commands help, console, and show_plugins now override Command.run() instead of Command.__call__() 2008-09-24 03:10:35 +00:00
Jason Gerard DeRose
4e8ff5c656 318: Renamed all references to 'public' module to 'frontend' 2008-09-24 00:01:29 +00:00
Jason Gerard DeRose
2d83614006 305: Ported cli.py to changes in public.py 2008-09-21 19:00:41 +00:00
Jason Gerard DeRose
23e251a605 288: CLI now uses Command.group_args() to check for required arguments 2008-09-10 23:33:36 +00:00
Jason Gerard DeRose
687f603562 284: Removed depreciated Command.Option property; removed corresponding unit tests; updated affected code 2008-09-10 15:31:34 +00:00
Jason Gerard DeRose
8062075f84 279: Fixed cli and public.Method re new Command.args attribute 2008-09-10 02:02:26 +00:00
Jason Gerard DeRose
0215bc8009 276: Option.__init__(): doc is now 3rd kwarg instead of 2nd positional arg; updated unit tests and other affected code 2008-09-10 00:21:40 +00:00
Jason Gerard DeRose
21a0bab79e 272: Add a quick positional arg experiment 2008-09-09 01:41:15 +00:00
Jason Gerard DeRose
cb9c442708 270: show-plugins now only shows namespaces with at least one member 2008-09-08 21:44:53 +00:00
Jason Gerard DeRose
03fd184e8e 269: Renamed print_api command to show_plugins 2008-09-08 21:42:48 +00:00
Jason Gerard DeRose
e74713a076 267: Finished builtin CLI api command 2008-09-08 21:37:02 +00:00
Jason Gerard DeRose
641403278e 266: Started work on new cli.print_api Command 2008-09-04 18:35:04 +00:00
Jason Gerard DeRose
22d9b8c078 265: Fixed small formatting error with use of CLI.print_commands() 2008-09-04 09:27:28 +00:00
Jason Gerard DeRose
553b0c596d 264: Cleaned up docstrings on all example plugins 2008-09-04 09:22:18 +00:00
Jason Gerard DeRose
6b9ba734e1 263: CLI.print_commands() now seperates Command subclasses from Application subclasses 2008-09-04 09:04:35 +00:00
Jason Gerard DeRose
6f95249d52 261: More work on demo using Option.__call__() for interactive input 2008-09-04 08:33:41 +00:00
Jason Gerard DeRose
915486dadc 260: Option.normalize() now does same conversion for multivalue as Option.convert() does 2008-09-04 08:16:12 +00:00
Jason Gerard DeRose
71d36aa6a0 258: Added some experimental features for interactively prompting for values 2008-09-04 07:18:26 +00:00
Jason Gerard DeRose
01b73e6910 257: Improved help command, now parsing options with optparse 2008-09-04 06:33:57 +00:00
Jason Gerard DeRose
b16deabdff 256: Fixed cli.help plugin so it looks up commands in CLI instead of API 2008-09-04 05:18:14 +00:00
Jason Gerard DeRose
ab81ca56fd 255: CLI help, console commands now subclass from public.Application; other tweeking to make CLI utilize Application 2008-09-04 04:39:01 +00:00
Jason Gerard DeRose
330c17730c 201: Added new cli command 'console' that starts a custom interactive Python console 2008-08-27 00:25:33 +00:00
Jason Gerard DeRose
b0ec8fe551 182: Renamed plublic.cmd base class to Command 2008-08-15 19:49:04 +00:00
Jason Gerard DeRose
ba8d32a110 150: NameSpace.__iter__() now iterates through the names, not the members; added NameSpace.__call__() method which iterates through the members; NameSpace no longer requires members to be Proxy instances; updated unit tests and affected code; cleaned up NameSpace docstrings and switch to epydoc param docstrings 2008-08-14 05:46:20 +00:00
Jason Gerard DeRose
d95133b66f 149: CLI.run() now does an arg.decode('utf-8') for args in sys.argv so that non-ascii characters work 2008-08-14 01:09:11 +00:00
Jason Gerard DeRose
fe7440735d 148: Added some basic out put for cli.help.__call__() method 2008-08-13 07:20:10 +00:00
Jason Gerard DeRose
d422ef1134 146: Removed CLI.parse_kw() method and corresponding unit tests 2008-08-13 06:40:25 +00:00
Jason Gerard DeRose
337c9964d4 145: Added new CLI.parse() method; added corresponding unit tests 2008-08-13 06:25:42 +00:00
Jason Gerard DeRose
14cdb57b50 140: Added a skeleton help command in cli.py 2008-08-13 04:02:39 +00:00
Jason Gerard DeRose
b9fa9dc240 139: Removed dummy gettext _() func from cli.py; improved CLI.print_commands() 2008-08-13 03:15:00 +00:00
Jason Gerard DeRose
0fed74b56d 138: Added ProxyTarget.doc property; CLI.print_commands() now uses cmd.doc instead of cmd.get_doc() 2008-08-13 02:34:36 +00:00
Jason Gerard DeRose
05cefc2af6 136: CLI.print_commands() now prints cmd.get_doc() as well 2008-08-13 02:10:09 +00:00
Jason Gerard DeRose
0b5efa2a62 134: Added CLI.mcl (Max Command Length) property; added corresponding unit tests 2008-08-13 01:52:17 +00:00
Jason Gerard DeRose
64054a673c 122: The dictorary interface to CLI now has keys build using to_cli(), rather than converting at each call 2008-08-12 23:33:02 +00:00
Jason Gerard DeRose
99d7638ff5 115: CLI now parses out kw args; cmd.__call__() now uses print_n_call() to give feedback on the calling 2008-08-12 16:49:23 +00:00
Jason Gerard DeRose
bc4b26ffca 114: Fixed cmd.__get_options(); more work on CLI 2008-08-12 02:03:47 +00:00
Jason Gerard DeRose
afdbc42b2e 112: More work on cli.py 2008-08-11 21:38:30 +00:00
Jason Gerard DeRose
9282418291 110: Started fleshing out more in cli.py 2008-08-11 19:35:57 +00:00
Jason Gerard DeRose
3fe13d5945 87: Moved to_cli(), from_cli() functions from plugable.py into new cli.py file; moved corresponding unit tests into new test_cli.py file 2008-08-08 21:46:23 +00:00