On Feb 18, 8:40 am, jcbollinger <[email protected]> wrote:
> On Feb 17, 5:33 pm, Bryan <[email protected]> wrote:
>
>
>
>
>
>
>
>
>
> > I'm using puppet 0.25.1.  I've got a simple resource:
>
> > exec { "/bin/ls $oracle_base/dba/bin/database_backup.ksh":
> >     logoutput => on_failure,
>
> > }
>
> > and I don't want it to log every time it's successfully run:
>
> > $ sudo tail -F /var/log/messages | grep puppetd
> > Feb 17 16:36:11 test puppetd[26614]: (//my_module/Exec[/bin/ls /u01/
> > app/oracle/dba/bin/database_backup.ksh]/returns) executed successfully
>
> > but logoutput => on_failure doesn't suppress the above message.
>
> > Is that parameter not available in my version of puppet, or am I
> > perhaps misunderstanding its purpose?  I'm guessing the latter since
> > it looks like it was introduced 3 years ago.
>
> logoutput is about whether the command's standard output is copied
> into Puppet's log.  If that's still not clicking for you, try changing
> to logoutput => true to see the difference, especially when the target
> file is present.  (When its argument is absent, ls writes to standard
> error, which I think Puppet always copies to its log.)
>
> > In the meantime, I'm using this ugly, redundant hack to do what I
> > want:
>
> > exec { "/bin/ls $oracle_base/dba/bin/database_backup.ksh":
> >     unless => "/bin/ls $oracle_base/dba/bin/database_backup.ksh",
>
> > }
>
> This would be less redundant, but still hackish:
>
> exec { "check_database_backup.ksh":
>     command => "/bin/false",
>     unless => "/bin/ls $oracle_base/dba/bin/database_backup.ksh 2> /
> dev/null",
>
> }
>
> I'm not sure exactly what you're after, but a File resource is usually
> better than an Exec for managing and monitoring files.  For instance,
> it is possible that this would serve your purposes:
>
> file { "$oracle_base/dba/bin/database_backup.ksh":
>     ensure => present,
>     audit => all
>
> }
>
> It should produce output to the Puppet log only if the file is not
> initially present.  However, it might create an empty file (and
> subsequently not log anything while that file remains); if that
> matters to you then test.  Also, the resource will not fail if the
> file is absent, which an Exec could do.
>
> If all you want to do is test for the presence of a file, however,
> then really you should create a custom fact (which is easy) instead of
> attempting to use a resource.  That will fit much more naturally into
> the Puppet Way, and it will be a lot more flexible for you.
>
> John

Okay, that makes more sense.

Essentially this file is created by someone else during the server
setup process.  I'd put it in Puppet myself but I'm unable to for
reasons I won't go into.  We have automated backup scripts that depend
on this file, and I don't want them to be put into place until this
file is there, so it didn't seem like a File resource would work
because 1. I don't want to put a file there and 2. I want the resource
to fail until the file is put there so its dependencies aren't put
into place.

I want puppet to bug me until the file's put into place, but once it's
there I don't want to see extra output in the Puppet logs every time
it checks.

I probably need to rethink how I'm doing this, but in the meantime
I'll look into a custom fact.

Thanks for your help.

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

Reply via email to