Corey Osman
2011-Aug-16 05:25 UTC
[Puppet Users] help using unless in exec for postgres database creation
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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Reasonably Related Threads
- [PATCH server] added ovirt-wait4service and invokation in installer to wait for psql/ldap
- Postgres, testing and maybe spurious database DROPpings?
- [PATCH server] update installer exec items to single_exec where applicable
- permission error in rake''s clone_structure_to_test
- postgres/R access problems