Gehel has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/343088 )

Change subject: postgresql - require postgresql / postgis packages for spatialdb
......................................................................


postgresql - require postgresql / postgis packages for spatialdb

also: minor refactoring to ensure line length conforms to our guidelines

Change-Id: I48f25f181bd22b00842af94c553474fd9b10f27c
---
M modules/postgresql/manifests/spatialdb.pp
M modules/role/manifests/maps/master.pp
2 files changed, 11 insertions(+), 7 deletions(-)

Approvals:
  Alexandros Kosiaris: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Gehel: Looks good to me, approved



diff --git a/modules/postgresql/manifests/spatialdb.pp 
b/modules/postgresql/manifests/spatialdb.pp
index 4619108..68af3e7 100644
--- a/modules/postgresql/manifests/spatialdb.pp
+++ b/modules/postgresql/manifests/spatialdb.pp
@@ -20,12 +20,18 @@
     $postgis_version = hiera('postgresql::spatialdb::postgis_version', '1.5'),
     ) {
 
+    require ::postgresql::packages
+    require ::postgresql::postgis
+
     # Check if our db exists and store it
     $db_exists = "/usr/bin/psql --tuples-only -c \'SELECT datname FROM 
pg_catalog.pg_database;\' | /bin/grep \'^ ${name}\'"
     # Check if plgsql is installed
     $plpgsql_exists = "/usr/bin/psql --tuples-only -c \'SELECT lanname FROM 
pg_catalog.pg_language;\' | /bin/grep \'^ plpgsql\'"
     # Check if postgis is installed
-    $postgis_exists = "/usr/bin/psql --tuples-only -c \"SELECT table_catalog 
FROM information_schema.tables where table_name=\'geometry_columns\';\" ${name} 
| /bin/grep \'^ ${name}\'"
+    $postgis_exists_sql = 'SELECT table_catalog FROM information_schema.tables 
where table_name=\'geometry_columns\';'
+    $postgis_exists = "/usr/bin/psql --tuples-only -c 
\"${postgis_exists_sql}\" ${name} | /bin/grep \'^ ${name}\'"
+
+    $postgres_basedir = "/usr/share/postgresql/${pgversion}"
 
     if $ensure == 'present' {
         exec { "create_db-${name}":
@@ -40,13 +46,13 @@
                 unless  => $plpgsql_exists,
             }
             exec { "create_postgis-${name}":
-                command => "/usr/bin/psql -d ${name} -f 
/usr/share/postgresql/${pgversion}/contrib/postgis-${postgis_version}/postgis.sql",
+                command => "/usr/bin/psql -d ${name} -f 
${postgres_basedir}/contrib/postgis-${postgis_version}/postgis.sql",
                 user    => 'postgres',
                 unless  => $postgis_exists,
             }
             # Create spatial_ref_sys
             exec { "create_spatial_ref_sys-${name}":
-                command     => "/usr/bin/psql -d ${name} -f 
/usr/share/postgresql/${pgversion}/contrib/postgis-${postgis_version}/spatial_ref_sys.sql",
+                command     => "/usr/bin/psql -d ${name} -f 
${postgres_basedir}/contrib/postgis-${postgis_version}/spatial_ref_sys.sql",
                 user        => 'postgres',
                 refreshonly => true,
                 subscribe   => Exec["create_postgis-${name}"],
@@ -58,7 +64,7 @@
                 subscribe   => Exec["create_spatial_ref_sys-${name}"],
             }
             exec { "create_comments-${name}":
-                command     => "/usr/bin/psql -d ${name} -f 
/usr/share/postgresql/${pgversion}/contrib/postgis_comments.sql",
+                command     => "/usr/bin/psql -d ${name} -f 
${postgres_basedir}/contrib/postgis_comments.sql",
                 user        => 'postgres',
                 refreshonly => true,
                 subscribe   => Exec["create_spatial_ref_sys-${name}"],
diff --git a/modules/role/manifests/maps/master.pp 
b/modules/role/manifests/maps/master.pp
index 5cab439..cfbfeff 100644
--- a/modules/role/manifests/maps/master.pp
+++ b/modules/role/manifests/maps/master.pp
@@ -82,9 +82,7 @@
     }
 
     # DB setup
-    postgresql::spatialdb { 'gis':
-        require => Class['::postgresql::postgis'],
-    }
+    postgresql::spatialdb { 'gis': }
 
     if $postgres_tile_storage {
         ::postgresql::db { 'tiles':

-- 
To view, visit https://gerrit.wikimedia.org/r/343088
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I48f25f181bd22b00842af94c553474fd9b10f27c
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Gehel <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to