Hi,
+1 to John, you're thinking of some wheels to reinvent.
On 10/29/2014 02:48 PM, JonY wrote:
> Is it (reasonably) feasible to add new resource types? I don't want to
> disassemble the whole code base but if there is a known path to this
> I'd like to read about it.
>
>
> Some thoughts:It strikes me that there are at a few situations that I
> run into with this SW that would make for decent additions.
>
> 1. "once": do a given resource type once and set a fact to not repeat
> it. I keep kludging solutions to this.
Best practice is to make all resource idempotent, so that it's fine for
Puppet to continuously check sync states.
If you really need things to run once only, you might get away cheaply
with a "has puppet ever run" fact, so that you can have a whole class of
things that will only ever run after provisioning. (Sure, if you ever
add to that class, the new resources won't run on old agents...)
> 2. "log": set a log level and location for a resource / node / etc.
> This would help to figure out "WTF is going on".
I don't think I follow. You want this information on every single agent
run? Why?
Do you not add the --debug flag whenever something is fishy, and can
safely ignore the gory details again once things are fixed?
> 3. "return value": set a fact with the failure code for a given
> operation or agent run. I keep finding cases where the agent is
> failing and the server isn't logging it. It isn't until I log in and
> run the agent that I see the error(s).
Again, don't really follow. Have you considered gathering and
summarizing reports? If you set up PuppetDB and Puppet Explorer /
PuppetBoard, you can very quickly determine which agents are generating
errors, both constantly and transiently.
> 4. "counter": set a fact with the # of times a given operation has
> been performed on a system. This would help to track down systems that
> are thrashing because of competing operations.
And once again, this is what PuppetDB will just do for you.
> These could either be additional params for existing resources or an
> outer layer to same.
I don't think that you can add metaparameters through modules. That
would indeed require patches to the Puppet core.
Meta-Types (like the resources type) to perform some extra operations on
other resources from the catalog - that would be a different story. You
could likely cobble something up in a module.
Cheers,
Felix