[Fixed]-Puppet Dependency file failing in local Vagrant Environmnet

1👍

The error is this

==> clips: Notice: /Stage[main]/Ltp/Exec[create_ba_database]/returns: ERROR:  database "burson_clips" already exists

==> clips: Error: echo "psql -c 'create database burson_clips;'" | sudo su postgres returned 1 instead of one of [0]

your db already exists as burson_clips so the command fails and the rest of the provisioning fails.

You should be able to leverage some answers from Check if database exists in PostgreSQL using shell to check if the db exists first and then create only if needed; something like

exec {
    "create_ba_database":
        cwd => $project_dir,
        command => "echo \"psql -c 'create database burson_clips;'\" | sudo su postgres",
        require => Exec['change_pg_password'],
        unless => "psql -lqt | cut -d \| -f 1 | grep -qw 'burson_clips'"
}

Leave a comment