Hello,
We are a long time Puppet 2.7 shop (installing latest Puppet 2.7 gems on deployments. In this particular build it picked up Puppet 2.7.23) and just discovered the following:
Executing a psql command like:
build 12-Nov-2013 04:30:16 debug: /Stage[main]/Buildeng_postgres::Service/Service[postgresql]: The container Class[Buildeng_postgres::Service] will propagate my refresh event
build 12-Nov-2013 04:30:16 debug: Class[Buildeng_postgres::Service]: The container Stage[main] will propagate my refresh event
build 12-Nov-2013 04:30:16 debug: Exec[create postgres user](provider=posix): Executing 'psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'password';"'
build 12-Nov-2013 04:30:16 debug: Executing 'psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'password';"'
build 12-Nov-2013 04:30:16 notice: /Stage[main]/Buildeng_postgres::Post_service/Buildeng_postgres::Create_user[postgres]/Exec[create postgres user]/returns: psql: FATAL: the database system is starting up
build 12-Nov-2013 04:30:16 err: /Stage[main]/Buildeng_postgres::Post_service/Buildeng_postgres::Create_user[postgres]/Exec[create postgres user]: Failed to call refresh: psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'password';" returned 2 instead of one of [0] at /home/ubuntu/puppet-cfg/buildeng-modules/buildeng_postgres/manifests/create_user.pp:10
The resource which creates this log is:
define buildeng_postgres::create_user ($password=undef) {
require buildeng_postgres::service
exec { 'create postgres user':
subscribe => Service['postgresql'],
user => $buildeng_postgres::params::user,
command => "psql -U ${buildeng_postgres::params::postgres_user} -c \"ALTER USER ${buildeng_postgres::params::postgres_user} WITH PASSWORD '${buildeng_postgres::params::postgres_password}';\"",
refreshonly => true,
}
}
Puppet registers the failure as an error ("2" is not an expected exit code of this Exec resource) but still exits with exit status "2" (with --detailed-exitcode).
I know why psql failed but that's besides the point - Puppet should have failed but it didn't.
Any idea why?
Thanks.