On 10/15/2012 07:23 PM, Stefan Schulte wrote:

> The fact that your exists? method does not really answer the question if
> a resource is present or absent is a bit strange. And inside the create
> method you are basically reimplementing properties with parameters. If
> something has to be checked for correctness it should be a property.
> Otherwise it is a parameter. Like the service resource: enable is a
> property because it can be out of sync. hasstatus is a parameter because
> it cannot be out of sync but only changes the behaviour of the provider

OK, I've figured that out through this conversation...

Now this is somewhat fixed code:

http://pastebin.com/q0TBX4KB

I've moved some params to properties.


> Your main concern against properties if I got you correctly was about
> speed because puppet would run one query for each property. One way around
> that is to implement a query method that will query all properties at once
> and store them in a hash (@property_hash). Every get-method now check
> if @property_hash[:some_property] does already exist and return that
> value if it does or run the query method that would populate the
> @property_hash hash.

That sounds interesting, and more important it seems to me that complete
rewrite is not necessary in this case. Do you have some examples of this
idea?


> Another speed improvement is to implement an `instances` and `prefetch`
> method. That has the benefit that puppet does "react" on such methods
> if they are implemented:
> 
> * you are able to run "puppet resource cobblersystem" on the command
>   line to get the current configuration of all systems (that depends on
>   an instances classmethod)
> * you can use the resources type to purge unmanaged systems
> 
>     resources { 'cobblersystem':
>       purge => true
>     }
> * the prefetch method is automatically called by puppet if implemented
>   to create provider instances
> * your get methods become trivial

Wow, sounds very interesting.

I would plea for possible examples :)

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to