exec statement in puppet

112 views
Skip to first unread message

Spriya

unread,
Dec 10, 2014, 10:37:15 AM12/10/14
to puppet...@googlegroups.com
Hi,

I tried to place a command  in exec statement. when the command is executed successfully can we stop getting notice message. If the command in exec statement fails then only i need to get notice messages. 

Is there a way we can do that?



Felix Frank

unread,
Dec 12, 2014, 8:00:45 AM12/12/14
to puppet...@googlegroups.com
Hi,

no, this is just how Puppet is wired - if a resource needs syncing, then
this is treated as a notable occurence. You either drop all output (e.g.
loglevel => debug) or keep it.

Puppet is not a good fit to run recurring commands. Consider using a
cron resource instead.

HTH,
Felix

jcbollinger

unread,
Dec 15, 2014, 9:31:34 AM12/15/14
to puppet...@googlegroups.com

No and yes.  You must understand that Exec resources are not designed for general-purpose command running.  They can be used for that, but they are designed as a way to model resources for which no native type is available.  They follow the same model as all other resources: they are checked to determine whether they need to be synced, and if so then they are synced (by executing their `command'.  If they are synced, therefore, it is exactly as notable an event as if a resource of any other type is synced.

On the other hand, if you understand the above then you should now be considering how Puppet determines whether an Exec resource in fact needs to be synced.  This is the role of the 'onlyif', 'unless', and 'creates' parameters.  Very likely you can achieve something closer to what you're after, if not exactly what you're after, by incorporating these into your Exec usage.


John

Reply all
Reply to author
Forward
0 new messages