Re: [Freeipa-devel] super of crud.Delete

2010-03-29 Thread Pavel Zuna

On 03/26/2010 10:57 PM, Rob Crittenden wrote:

I was poking around at the base classes today and I'm wondering if we
need to change the parent of crud.Delete().

The use case is host-del. We store the short and the fqdn name of hosts.
I think that for deleting we want enforce using the fqdn to be sure bad
things never happen. If we use the short name then we'll need to make
some fixes in the delete pre_callback() because right now you can delete
with a short name and the services for that host won't be deleted. This
is the bug that got me looking into this.

So lets assume we want to require fqdn. This should be easy since the
fqdn Param has a validator for this. Unfortunately for things based on
the PKQuery class validators aren't executed.

I had a couple ideas how to address this, throwing it out there for
discussion:

1. Make the query argument a class attribute that can be overridden.

[OT]
I already had a similar idea many times. I think we should have a method similar 
to Param.clone() that wouldn't override kwargs set explicitly. It could be used 
in situations like this one or when we want to define parameters for Object that 
aren't necessarily attributes (for example because we don't want them to be 
processed by Command.args_options_2_params).

[/OT]


2. Base crud.Delete on crud.Method instead
3. Add a get_args() implementation to baseldap.LDAPDelete
4. Do nothing with the class inheritance and handle this in host_del
pre_callback().

rob

I think this is an issue specific to the host plugin - it overrides 
LDAPObject.get_dn, so that users can refer to hosts by either hostname or fqdn. 
We should probably go with option 4: retrieve the host entry fqdn attribute in 
pre_callback first and then search for services with it.


Pavel

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


[Freeipa-devel] super of crud.Delete

2010-03-26 Thread Rob Crittenden
I was poking around at the base classes today and I'm wondering if we 
need to change the parent of crud.Delete().


The use case is host-del. We store the short and the fqdn name of hosts. 
I think that for deleting we want enforce using the fqdn to be sure bad 
things never happen. If we use the short name then we'll need to make 
some fixes in the delete pre_callback() because right now you can delete 
with a short name and the services for that host won't be deleted. This 
is the bug that got me looking into this.


So lets assume we want to require fqdn. This should be easy since the 
fqdn Param has a validator for this. Unfortunately for things based on 
the PKQuery class validators aren't executed.


I had a couple ideas how to address this, throwing it out there for 
discussion:


1. Make the query argument a class attribute that can be overridden.
2. Base crud.Delete on crud.Method instead
3. Add a get_args() implementation to baseldap.LDAPDelete
4. Do nothing with the class inheritance and handle this in host_del 
pre_callback().


rob

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