JR Aquino wrote:
On Aug 1, 2011, at 11:28 PM, "Martin Kosek"<mko...@redhat.com>  wrote:

I made all of the small adjustments and then nearly literally stared frustrated 
at the code for 6 hours today.

I see no way of accomplishing the feat of replicating the ldapmodmember 
treatment of failed attributes, without overriding LDAPUpdate's exec

LDAPUpdate is simply looking to return entrys_attrs as the result, and only a 
dn for the callbacks...  I can't set or send anything back to track the faileds 
in a callback.

You can see it's been bothering me, as it is midnight my time and I'm thinking 
about it still. :/

Overriding execute is ok, we just didn't like duplicating all the code.

If you want to override the return value do something like:

def my_function(LDAPUpdate):
    has_output = (
        output.Entry('result'),
        output.Output('failed',
            type=dict,
            doc=_('Members that could not be added'),
        ),
    )

    def execute(self, *keys, **options):
        failed = dict('inclusive': [], 'exclusive', [])
        /* calculate failed */

        /* Make options consist of the values you want updated */

        result = super(my_function, self).execute(*keys, **options)

        return(result=result, failed=failed, value=keys[-1])

You may have to tweak failed so it looks ok on Output. The add/remove member methods in baseldap.py may provide some additional guidance.

rob

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to