Skip to content

Commit

Permalink
Revert "802346 - wait for postgres to come up in puppet"
Browse files Browse the repository at this point in the history
This reverts commit caef237.

This is thowing error:

err: Could not apply complete catalog: Found dependency cycles in the
following relationships:

http://lzap.fedorapeople.org/projects/katello/graphs/puppet_of_0.2_13.png

Reverting, not sure what is wrong now.
  • Loading branch information
lzap committed Mar 19, 2012
1 parent cccd0b4 commit 56deb5e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
11 changes: 0 additions & 11 deletions puppet/modules/postgres/manifests/config.pp
Expand Up @@ -16,17 +16,6 @@
notify => Service["postgresql"],
require => Exec["InitDB"];
}

# wait 30 seconds for postgresql daemon to accept connections and execute SQL commands or timeout when not running
exec { "wait-for-postgresql":
environment => "PGCONNECT_TIMEOUT=5",
path => "/usr/bin:/bin",
command => "bash -c \"for i in {1..7}; do psql -U ${postgres::params::user} -h localhost -c 'select count(*) from pg_tables' >/dev/null 2>&1 || sleep 5; done\"",
timeout => 30, # loop above is for 35 secs max but we timeout after 30
user => $postgres::params::user,
require => Class["postgres::service"],
}

exec { "InitDB":
command => $postgres::params::password ? {
"" => "/usr/bin/initdb ${postgres::params::home}//data -E UTF8",
Expand Down
2 changes: 1 addition & 1 deletion puppet/modules/postgres/manifests/createdb.pp
Expand Up @@ -6,7 +6,7 @@
database => "postgres",
sql => "CREATE DATABASE $name WITH OWNER = $owner ENCODING = 'UTF8';",
sqlcheck => "\"SELECT datname FROM pg_database WHERE datname ='$name'\" | grep $name",
require => Exec["wait-for-postgresql"],
require => Class["postgres::service"],
logfile => $logfile,
}
}
2 changes: 1 addition & 1 deletion puppet/modules/postgres/manifests/createuser.pp
Expand Up @@ -6,7 +6,7 @@
database => "postgres",
sql => "CREATE ROLE ${name} WITH LOGIN PASSWORD '${passwd}' ${roles};",
sqlcheck => "\"SELECT usename FROM pg_user WHERE usename = '${name}'\" | grep ${name}",
require => Exec["wait-for-postgresql"],
require => Class["postgres::service"],
logfile => $logfile,
}

Expand Down
2 changes: 1 addition & 1 deletion puppet/modules/postgres/manifests/sqlexec.pp
Expand Up @@ -8,6 +8,6 @@
path => $path,
timeout => 600,
unless => "psql -U $username $database -c $sqlcheck",
require => Exec["wait-for-postgresql"],
require => Class["postgres::service"],
}
}

0 comments on commit 56deb5e

Please sign in to comment.