Puppet Providers and Prefetching

30 views
Skip to first unread message

Daysmen

unread,
Mar 19, 2014, 1:17:00 PM3/19/14
to puppet...@googlegroups.com
Hi

I'm creating a puppet provider that manages the creation/removal and modification of a node over restful api.

All the devices attributes can be retrieved in one call however because of the nature of the code i have created  i cannot use self.instances and self.prefetch. 

Im using the flushing method as I need to consolidate all changes to as few as calls to rest server as possible

Does any one know of a way to create a cache of the results obtained for this device info call?

As stated above i cannot use the singleton methods as the code that sets up the calls to the rest backend use instance methods


jcbollinger

unread,
Mar 19, 2014, 4:30:31 PM3/19/14
to puppet...@googlegroups.com


And I suppose that you need an instance method for calling the REST terminus because you need some of the resource instance's parameters.  Fair enough.

One thing you could do would be to set up all your property getters as front ends to a common method that retrieves ALL of the available properties into the resource instance, and then marks the property hash so that it knows not to do so again when any of the getters is invoked for that resource.


John

Daysmen

unread,
Mar 19, 2014, 7:14:38 PM3/19/14
to puppet...@googlegroups.com
Man o man why didn't I think of that - well that's the reason for these boards - feel like such a tool  
 
Thanks John
Reply all
Reply to author
Forward
0 new messages