Gehel has submitted this change and it was merged.

Change subject: Upgrade osm2pgsql to 0.90.0
......................................................................


Upgrade osm2pgsql to 0.90.0

0.90.0 is available in Jessie backports.

I took eventlogging::service::service as an example of how we pull packages
from backports.

This new version has been tested on new maps2??? servers and show that initial
import and replication are working fine.

Bug: T112423
Depends-on: I0482b718a496cfabf647295b413bce5e2a453375
Change-Id: I13cc0a9566a32cdf8f4ce7a85e22bfdab1c50173
---
M modules/osm/manifests/init.pp
M modules/osm/spec/classes/osm_spec.rb
2 files changed, 61 insertions(+), 20 deletions(-)

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



diff --git a/modules/osm/manifests/init.pp b/modules/osm/manifests/init.pp
index 8512ed1..7592ca4 100644
--- a/modules/osm/manifests/init.pp
+++ b/modules/osm/manifests/init.pp
@@ -1,10 +1,30 @@
 #
 
-class osm($ensure='present') {
-    package { [
-        'osm2pgsql',
-        'osmosis',
-        ]:
-        ensure => $ensure,
+class osm (
+    $ensure = present,
+){
+
+    # osm2pgsql 0.90 is only available on jessie at the moment
+    # there is no need for 0.90 on labs machines (precise)
+    $osm2pgsql_ensure = $ensure ? {
+        'present' => os_version('Debian >= Jessie') ? {
+            true => '0.90.0+ds-1~bpo8+1',
+            default => 'present',
+        },
+        default   => $ensure,
+    }
+
+    # Can't use require_package here because we need to specify version
+    # from jessie-backports:
+    if !defined(Package['osm2pgsql']) {
+        package { 'osm2pgsql':
+            ensure => $osm2pgsql_ensure,
+        }
+    }
+
+    if !defined(Package['osmosis']) {
+        package { 'osmosis':
+            ensure => $ensure,
+        }
     }
 }
diff --git a/modules/osm/spec/classes/osm_spec.rb 
b/modules/osm/spec/classes/osm_spec.rb
index a58f4c3..2803d56 100644
--- a/modules/osm/spec/classes/osm_spec.rb
+++ b/modules/osm/spec/classes/osm_spec.rb
@@ -1,24 +1,45 @@
 require 'spec_helper'
 
 describe 'osm', :type => :class do
-    let(:params) { {
-        :ensure           => 'present',
-        }
-    }
-
     context 'ensure present' do
-        it { should contain_package('osm2pgsql').with_ensure('present') }
-        it { should contain_package('osmosis').with_ensure('present') }
-    end
-end
+        let(:params) { {
+            :ensure => 'present',
+        } }
 
-describe 'osm', :type => :class do
-    let(:params) { {
-        :ensure           => 'absent',
-        }
-    }
+        context 'on Ubuntu Precise' do
+            let(:facts) { {
+                :lsbdistrelease => 'Precise',
+                :lsbdistid      => 'Ubuntu',
+            } }
+
+            context 'ensure present' do
+                it { should 
contain_package('osm2pgsql').with_ensure('present') }
+                it { should contain_package('osmosis').with_ensure('present') }
+            end
+        end
+
+        context 'on Debian Jessie' do
+            let(:facts) { {
+                :lsbdistrelease => 'Jessie',
+                :lsbdistid      => 'Debian',
+            } }
+
+            context 'ensure present' do
+                it { should 
contain_package('osm2pgsql').with_ensure('0.90.0+ds-1~bpo8+1') }
+                it { should contain_package('osmosis').with_ensure('present') }
+            end
+        end
+    end
 
     context 'ensure absent' do
+        let(:params) { {
+            :ensure => 'absent',
+        } }
+        let(:facts) { {
+            :lsbdistrelease => 'Precise',
+            :lsbdistid      => 'Ubuntu',
+        } }
+
         it { should contain_package('osm2pgsql').with_ensure('absent') }
         it { should contain_package('osmosis').with_ensure('absent') }
     end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I13cc0a9566a32cdf8f4ce7a85e22bfdab1c50173
Gerrit-PatchSet: 9
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Yurik <yu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to