On 2011-02-18 16:33, Bryan wrote:

> On Feb 18, 8:40 am, jcbollinger <john.bollin...@stjude.org> wrote:

>> (When its argument is absent, ls writes to standard
>> error, which I think Puppet always copies to its log.)

Crazily enough, Puppet doesn't capture standard error at all.  It
is always thrown away, making debugging exec:s unnecessarily hard.
(Unless this has changed in 2.6; I still haven't had time to try
that out.)

> 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.

Here is one way:

    file {
        "$oracle_base/dba/bin/database_backup.ksh":
            ensure => file, noop => true, loglevel => err;
    }

The 'noop => true' parameter tells Puppet to not actualy create that
file, and 'loglevel => err' makes it log that fact as an error instead
of as a notice.  If the file doesn't exist, you will get a message like
this on every Puppet run:

    err: //Node[kumiko]/File[/opt/oracle/dba/bin/database_backup.ksh]/ensure:
         is absent, should be file (noop)

And here is another way:

    exec {
        database-backup-script-missing:
            command => '/bin/echo "database_backup.ksh missing"; /bin/false',
            creates => "$oracle_base/dba/bin/database_backup.ksh",
            logoutput => true, loglevel => err;
    }

This gives me the messages

    err: //Node[kumiko]/Exec[database-backup-script-missing]/returns:
         database_backup.ksh missing
    err: //Node[kumiko]/Exec[database-backup-script-missing]/returns:
        change from notrun to 0 failed: /bin/echo "database_backup.ksh 
missing"; /bin/false
        returned 1 instead of one of [0] at /tmp/blaha.pp:17

when the file doesn't exist.


        /Bellman

-- 
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