Alexandros Kosiaris has submitted this change and it was merged.

Change subject: install-server module. Precise has squid3
......................................................................


install-server module. Precise has squid3

Precise has squid3 and install-server::caching-proxy had to be updated
While at it also update rspec tests

Change-Id: Ic811f487cacd5bcc81328a8b57cb599812478423
---
M modules/install-server/manifests/caching-proxy.pp
M modules/install-server/spec/classes/install_server_caching_proxy_spec.rb
2 files changed, 46 insertions(+), 13 deletions(-)

Approvals:
  Alexandros Kosiaris: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/install-server/manifests/caching-proxy.pp 
b/modules/install-server/manifests/caching-proxy.pp
index cfc135a..dfedb8c 100644
--- a/modules/install-server/manifests/caching-proxy.pp
+++ b/modules/install-server/manifests/caching-proxy.pp
@@ -13,10 +13,19 @@
 #   include install-server::caching-proxy
 
 class install-server::caching-proxy {
+    if $::lsbdistid == 'Ubuntu' and versioncmp($::lsbdistrelease, '12.04') >= 
0 {
+        $confdir = '/etc/squid3'
+        $package_name = 'squid3'
+        $service_name = 'squid3'
+    } else {
+        $confdir = '/etc/squid'
+        $package_name = 'squid'
+        $service_name = 'squid'
+    }
 
-    file { '/etc/squid/squid.conf':
+    file { "${confdir}/squid.conf":
         ensure  => present,
-        require => Package[squid],
+        require => Package[$package_name],
         mode    => '0444',
         owner   => 'root',
         group   => 'root',
@@ -25,21 +34,23 @@
 
     file { '/etc/logrotate.d/squid':
         ensure  => present,
-        require => Package[squid],
+        require => Package[$package_name],
         mode    => '0444',
         owner   => 'root',
         group   => 'root',
         source  => 'puppet:///modules/install-server/squid-logrotate',
     }
 
-    package { 'squid':
+    package { $package_name:
         ensure => latest,
     }
 
-    service { 'squid':
+    service { $service_name:
         ensure      => running,
-        require     => [ File['/etc/squid/squid.conf'], Package[squid] ],
-        subscribe   => File['/etc/squid/squid.conf'],
+        require     => [
+                        File["${confdir}/squid.conf"],
+                        Package[$package_name]
+                       ],
+        subscribe   => File["${confdir}/squid.conf"],
     }
-
 }
diff --git 
a/modules/install-server/spec/classes/install_server_caching_proxy_spec.rb 
b/modules/install-server/spec/classes/install_server_caching_proxy_spec.rb
index d4690e2..954e1c1 100644
--- a/modules/install-server/spec/classes/install_server_caching_proxy_spec.rb
+++ b/modules/install-server/spec/classes/install_server_caching_proxy_spec.rb
@@ -1,20 +1,42 @@
 require 'spec_helper'
 
 describe 'install-server::caching-proxy', :type => :class do
+    let(:facts) { { :lsbdistid => 'Ubuntu', :lsbdistrelease => '10.04' } }
 
-    it { should contain_package('squid').with_ensure('latest') }
-    it { should contain_service('squid').with_ensure('running') }
+    it 'should  have squid with Ubuntu < 12.04' do
+        contain_package('squid').with_ensure('latest')
+        contain_service('squid').with_ensure('running')
 
-    it do
         should contain_file('/etc/squid/squid.conf').with({
             'ensure' => 'present',
             'mode'   => '0444',
             'owner'  => 'root',
             'group'  => 'root',
         }).without_path()
-    end
 
-    it do
+        should contain_file('/etc/logrotate.d/squid').with({
+            'ensure' => 'present',
+            'mode'   => '0444',
+            'owner'  => 'root',
+            'group'  => 'root',
+        }).without_path()
+    end
+end
+
+describe 'install-server::caching-proxy', :type => :class do
+    let(:facts) { { :lsbdistid => 'Ubuntu', :lsbdistrelease => '12.04' } }
+
+    it 'should  have squid with Ubuntu >= 12.04' do
+        contain_package('squid3').with_ensure('latest')
+        contain_service('squid3').with_ensure('running')
+
+        should contain_file('/etc/squid3/squid.conf').with({
+            'ensure' => 'present',
+            'mode'   => '0444',
+            'owner'  => 'root',
+            'group'  => 'root',
+        }).without_path()
+
         should contain_file('/etc/logrotate.d/squid').with({
             'ensure' => 'present',
             'mode'   => '0444',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic811f487cacd5bcc81328a8b57cb599812478423
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@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