Commit Graph

161 Commits

Author SHA1 Message Date
Rob Crittenden
c7789199f9 Fix output of failed managedby hosts, allow a host to manage itself.
The output problem was a missing label for failed managedby.

This also fixes a call to print_entry that was missing the flags argument.

Add a flag to specify whether a group can be a member of itself, defaulting
to False.

ticket 708
2011-01-11 10:23:31 -05:00
Rob Crittenden
6f58f38748 Display the entries that failed when deleting with --continue.
We collected the failures but didn't report it back. This changes the
API of most delete commands so rather than returning a boolean it returns
a dict with the only current key as failed.

This also adds a new parameter flag, suppress_empty. This will try to
not print values that are empty if included. This makes the output of
the delete commands a bit prettier.

ticket 687
2011-01-10 10:32:10 -05:00
Jan Zeleny
6214af8a8d Changed concept of ipa help
The concept is now following:
topic:    either a module or a group of modules containing registered
          commands. All these commands will usually handle common entity
          type (e.g. hbac rules)
subtopic: each topic can have a number of subtopics. In this case topic
          is a group of modules and each module represents a subtopic.

grouping modules to topics is possible by assigning a 2-tuple to module
variable:

topic = ('topic-name','topic description')

The topic description has to be the same in all modules in the topic.
These are examples of commands now available in IPA help:

ipa help              - display a list of all topics
ipa help hbac         - display help for hbac topic
ipa help hbacrule     - display help for a subtopic of hbac
ipa help hbacrule-add - display help for a particular command

https://fedorahosted.org/freeipa/ticket/410
2011-01-07 09:42:38 -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
5b7abefb42 If any params marked alwaysask are provided then prompt for none of them.
ticket 604
2010-12-09 15:06:42 -05:00
Rob Crittenden
a41e69fba3 Add labels for passwords, fix output of exceptions, fix passwd output.
Passwords didn't have internationalizable labels.

Exceptions that occured during required input weren't printed as unicode
so weren't being translated properly.

Don't use output_for_cli() directly in the passwd plugin, use output.Output.

ticket 352
2010-12-02 16:31:42 -05:00
Rob Crittenden
df592c6cc8 Use better description for group names in help and always prompt for members
When running <foo>-[add|remove]-member completely interactively it didn't
prompt for managing membership, it just reported that 0 members were
handled which was rather confusing.

This will work via a shell if you want to echo too:

$ echo "" | ipa group-add-member g1

This returns 0 members because nothing is read for users or group members.

$ echo -e "g1\nadmin\n" | ipa group-add-member

This adds the user admin to the group g1. It adds it as a user because
user membership is prompted for first.

ticket 415
2010-12-02 16:21:31 -05:00
Pavel Zuna
94957c8ddc Prompt correctly for required Password params.
Ticket #361
2010-11-30 15:14:28 -05:00
Rob Crittenden
1db42b5461 Don't include INTERNAL commands in ipa help commands output.
ticket 463
2010-11-10 20:20:29 -05:00
Rob Crittenden
3c795f3251 Return reason for failure when updating group membership fails.
We used to return a list of dns that failed to be added. We now return
a list of tuples instead. The tuple looks like (dn, reason) where reason
is the exception that was returned.

Also made the label we use for failures to be singular instead of plural
since we now print them out individually instead of as comma-separated.

ticket 270
2010-10-28 17:47:20 -04:00
Rob Crittenden
6220b53893 Set default encoding to utf-8, use unicode when printing output.
The Gettext() object only does the lookup when you print it as a unicode.

ticket 308
2010-10-22 21:39:53 -04:00
Rob Crittenden
0ceba59d87 Add Requires on ipa-client to ipa-admintools, ensure ipa client is configured
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
2010-10-15 15:03:51 -04:00
Rob Crittenden
47f849ec21 Try to make topic help less confusing. Rename Related to Topic commands.
Also don't print the commands at the bottom if the plugin implements
only one command, like the passwd plugin.

ticket 105
2010-09-23 12:04:13 -04:00
Rob Crittenden
1df10a88cd Add support for client failover to the ipa command-line.
This adds a new global option to the ipa command, -f/--no-fallback. If this
is included then just the server configured in /etc/ipa/default.conf is used.
Otherwise that is tried first then all servers in DNS with the ldap SRV record
are tried.

Create a new Local() Command class for local-only commands. The help
command is one of these. It shouldn't need a remote connection to execute.

ticket #15
2010-08-16 10:35:27 -04:00
Pavel Zuna
c7a35f95c5 Fix output for commands that do not return entries.
I also changed the default value of the print_all argument in
textui.print_entry from False to True. It think it makes more sense this
way, because:

1) if order is None, it will still print something
2) if order is not None, it will print what's in order first and then the
   rest
3) commands that care about the print_all argument have to set it in any
   case, those that don't care usually want to print everything
2010-03-26 16:56:47 -04:00
Pavel Zuna
43ab2c483d Add INTERNAL flag to frontend plugins. If set, the plugin won't show in UI. 2010-03-22 10:41:36 -04:00
John Dennis
b75d06e189 localize doc strings
A number of doc strings were not localized, wrap them in _().
Some messages were not localized, wrap them in _()

Fix a couple of failing tests:
The method name in RPC should not be unicode.
The doc attribute must use the .msg attribute for comparison.

Also clean up imports of _() The import should come from
ipalib or ipalib.text, not ugettext from request.
2010-03-08 21:10:36 -07:00
John Dennis
789cba4378 fix bug 570392, command help traceback
As a consequence of using doc=_('some message') the _()
method was returning a Gettext instance, thus when optparse
was handed the help text it received a Gettext instance instead
of a basestring. optparse tried to operate on the Gettext instance
as if it were a basestring and since it wasn't threw an exception.
The fix is to promote (e.g. cast) the option.doc to unicode.
If the option.doc was a str it becomes unicode, if it was unicode
nothing happens, if it was Gettext (or any other object implementing
the __unicode__() method) object is converted to unicode via the
objects rules.

By the way, while debugging this I discovered strings which were not
localized, sometimes option.doc would be a str and sometimes a Gettext
object. In a subsequent patch I'll fix all those unlocalized doc
strings, but I don't want to bury this fix along with a load of
string fixes.
2010-03-05 10:03:41 -05:00
Jason Gerard DeRose
47f2e618f9 Fix non XML-RPC tests 2010-02-19 18:10:37 -05:00
Rob Crittenden
3fd098bb60 Used named variables in calls to print_attribute() 2010-02-17 12:05:01 -05:00
Rob Crittenden
63b55307e5 Reverse patch to not encode int values, handled at OID level properly now. 2010-02-17 09:13:50 -07:00
Pavel Zuna
03967f62e9 Auto-generate --all and --raw for commands, that return entries. 2010-02-17 10:56:06 -05:00
Rob Crittenden
7ccac40175 Don't base64-encode integers
This is a temporary fix until we either use Params to determine
output type or treat integers differently from other binary values
internally (as unicode instead of str, for example).
2010-02-17 04:13:15 -07:00
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