diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp index 9d849da7d..3bc35b5c7 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -29,7 +29,7 @@ define pgsql::database::populate ($username, $password, $schemafile) { } exec { "populate-${name}-pgsql-db": - unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", + onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", require => Pgsql::Database::Create[$name], }