takes_args defined in a baseldap subclass is now transformed into positional
arguments that go after primary keys. Before this patch, takes_args in crud
subclasses were ignored.
example:
--- snip ---
class user_something(LDAPRetrieve):
takes_args = (
Str('randomarg'),
)
--- snip ---
# ipa help something
Usage: ipa [global-options] user-something LOGIN RANDOMARG
Pavel
>From b67b9f355a31278656285fb2082696b008cf41ef Mon Sep 17 00:00:00 2001
From: Pavel Zuna <pz...@redhat.com>
Date: Tue, 5 Oct 2010 14:33:27 -0400
Subject: [PATCH 1/2] Generate additional positional arguments for baseldap commands from takes_args.
---
ipalib/plugins/baseldap.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index f6b98e2..42d9017 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -240,6 +240,8 @@ class LDAPCreate(CallbackInterface, crud.Create):
yield key
if self.obj.primary_key:
yield self.obj.primary_key.clone(attribute=True)
+ for arg in super(crud.Create, self).get_args():
+ yield arg
def execute(self, *keys, **options):
ldap = self.obj.backend
@@ -343,6 +345,8 @@ class LDAPQuery(CallbackInterface, crud.PKQuery):
yield key
if self.obj.primary_key:
yield self.obj.primary_key.clone(attribute=True, query=True)
+ for arg in super(crud.PKQuery, self).get_args():
+ yield arg
class LDAPMultiQuery(LDAPQuery):
@@ -356,6 +360,8 @@ class LDAPMultiQuery(LDAPQuery):
yield self.obj.primary_key.clone(
attribute=True, query=True, multivalue=True
)
+ for arg in super(crud.PKQuery, self).get_args():
+ yield arg
class LDAPRetrieve(LDAPQuery):
@@ -881,6 +887,8 @@ class LDAPSearch(CallbackInterface, crud.Search):
for key in self.obj.get_ancestor_primary_keys():
yield key
yield Str('criteria?')
+ for arg in super(crud.Search, self).get_args():
+ yield arg
def get_options(self):
for option in super(LDAPSearch, self).get_options():
--
1.7.1.1
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel