Skip to content
Snippets Groups Projects
Commit d6ed458d authored by Matthieu Faure's avatar Matthieu Faure
Browse files

add Postgres connection validation

parent 4ec0947e
No related branches found
No related tags found
1 merge request!5Resolve "Create Comptoir Puppet module"
Pipeline #3956 failed
......@@ -7,7 +7,9 @@
# @param comptoir_srv_dir Absolute path where Comptoir source code should be cloned, example: '/home/comptoir/Comptoir-srv'. Must be coherent with comptoir_repos_url
# @param comptoir_revision Revision of Comptoir repos as understood by module VCSRepos, may be a branch, a tag, a SHA-1
# @param comptoir_db_user Database username owning the database for the application
# @param comptoir_db_name Name for the database for the application
# @param comptoir_db_user Database username owning
# @param comptoir_db_password PAssword for the user of the database
# @param comptoir_db_host Name of the database host, must an FQDN or an IP address
#
# @example
# include comptoir
......@@ -19,6 +21,8 @@ class comptoir (
String $comptoir_revision = 'master',
String $comptoir_db_user = 'comptoir',
String $comptoir_db_name = 'comptoir',
String $comptoir_db_password = 'comptoir',
String $comptoir_db_host = 'localhost',
) {
# Inner variables
......@@ -46,6 +50,13 @@ class comptoir (
# environment => [ 'HOME=/home/comptoir' ],
# }
# TODO add a connection validation
postgresql_conn_validator { 'validate my postgres connection':
host => $comptoir_db_host,
db_username => $comptoir_db_user,
db_password => $comptoir_db_password,
db_name => $comptoir_db_name,
} ->
postgresql_psql { 'Create SQL tables & procedures':
command => "\i ${comptoir_dir}/${_SQL_create_tables_and_procedure}",
db => $comptoir_db_name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment