diff options
author | Rob Crittenden <rcritten@redhat.com> | 2011-02-01 14:24:46 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-02-02 10:00:38 -0500 |
commit | 275998f6bde90c253d935c2f2724538b64cbd618 (patch) | |
tree | bd2840606a906276d21e646eae47db49f7adb6c2 /ipalib/cli.py | |
parent | f3d04bfc405753b3c6a11a53ec6b2ccc99e8bf09 (diff) | |
download | freeipa-275998f6bde90c253d935c2f2724538b64cbd618.tar.gz freeipa-275998f6bde90c253d935c2f2724538b64cbd618.tar.xz freeipa-275998f6bde90c253d935c2f2724538b64cbd618.zip |
Add support for tracking and counting entitlements
Adds a plugin, entitle, to register to the entitlement server, consume
entitlements and to count and track them. It is also possible to
import an entitlement certificate (if for example the remote entitlement
server is unaviailable).
This uses the candlepin server from https://fedorahosted.org/candlepin/wiki
for entitlements.
Add a cron job to validate the entitlement status and syslog the results.
tickets 28, 79, 278
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 5543301c0..5ef812f75 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -1022,15 +1022,21 @@ class cli(backend.Executioner): """ for p in cmd.params(): if isinstance(p, File): + # FIXME: this only reads the first file + raw = None if p.name in kw: + if type(kw[p.name]) in (tuple, list): + fname = kw[p.name][0] + else: + fname = kw[p.name] try: - f = open(kw[p.name], 'r') + f = open(fname, 'r') raw = f.read() f.close() except IOError, e: raise ValidationError( name=to_cli(p.cli_name), - error='%s: %s:' % (kw[p.name], e[1]) + error='%s: %s:' % (fname, e[1]) ) elif p.stdin_if_missing: try: @@ -1039,6 +1045,10 @@ class cli(backend.Executioner): raise ValidationError( name=to_cli(p.cli_name), error=e[1] ) + if not raw: + raise ValidationError( + name=to_cli(p.cli_name), error=_('No file to read') + ) kw[p.name] = self.Backend.textui.decode(raw) |