Hi,

I have the following exec type:

exec{"createdb":
        path => "/usr/bin:/usr/sbin:/bin",
        command => "sudo -u postgres createdb -U postgres -E UNICODE opennms",
        unless => "sudo -u postgres psql -l | grep opennms > /dev/null",
        require => Service["postgresql"],
     }

Where this basically says, if the database exists don't run the create database 
command.  However, the unless statement doesn't behave like it should and 
puppet apply seems to execute the exec command regardless of what the unless 
statement returns.
Below is the error I receive.


err: /Stage[main]/Opennms/Exec[createdb]/returns: change from notrun to 0 
failed: sudo -u postgres createdb -U postgres -E UNICODE opennms returned 1 
instead of one of [0] at 
/etc/puppetlabs/puppet/modules/opennms/manifests/init.pp:87.  

So my question is why is exec ignoring the unless statement?  Also is there a 
better way of handling database creation than using exec?



Corey


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