Ema has submitted this change and it was merged.

Change subject: Move Varnishkafka APT pinning to role definition
......................................................................


Move Varnishkafka APT pinning to role definition

We want to make sure the pinning file for varnishkafka on Varnish 3
instances is present before the package is installed.

Bug: T122880
Change-Id: Ia9a5a334dad27a9cd915139b477adcc3fe403546
---
M modules/role/manifests/cache/kafka.pp
M modules/varnish/manifests/apt_preferences.pp
2 files changed, 21 insertions(+), 13 deletions(-)

Approvals:
  Ottomata: Looks good to me, but someone else must approve
  Ema: Verified; Looks good to me, approved



diff --git a/modules/role/manifests/cache/kafka.pp 
b/modules/role/manifests/cache/kafka.pp
index bb7fb84..e8f61d2 100644
--- a/modules/role/manifests/cache/kafka.pp
+++ b/modules/role/manifests/cache/kafka.pp
@@ -17,6 +17,27 @@
     # sets up varnishkafka.
     Rsyslog::Conf['varnishkafka'] -> Varnishkafka::Instance <|  |>
 
+    # APT pinning for Varnish 3
+    if (hiera('varnish_version4', false)) {
+        apt::pin { 'varnishkafka':
+            ensure   => 'absent',
+            pin      => '',
+            priority => '',
+        }
+    } else {
+        # Prefer varnishkafka 1.0.7, compatible with varnish 3
+        apt::pin { 'varnishkafka':
+            package  => 'varnishkafka*',
+            pin      => 'version 1.0.7*',
+            priority => 1002,
+        }
+    }
+
+    # Make the Varnishkafka class depend on APT pinning. We want to ensure
+    # varnishkafka is not apt-get installed before the pinning file is
+    # created/removed.
+    Apt::Pin['varnishkafka'] -> Class['Varnishkafka']
+
     # Make sure varnishes are configured and started for the first time
     # before the instances as well, or they fail to start initially...
     Service <| tag == 'varnish_instance' |> -> Varnishkafka::Instance <| |>
diff --git a/modules/varnish/manifests/apt_preferences.pp 
b/modules/varnish/manifests/apt_preferences.pp
index 96d4eea..b5d0bfd 100644
--- a/modules/varnish/manifests/apt_preferences.pp
+++ b/modules/varnish/manifests/apt_preferences.pp
@@ -6,24 +6,11 @@
             pin      => '',
             priority => '',
         }
-
-        apt::pin { 'varnishkafka':
-            ensure   => 'absent',
-            pin      => '',
-            priority => '',
-        }
     } else {
         # Prefer v3 varnish packages
         apt::pin { 'varnish':
             package  => 'varnish varnish-dbg varnish-doc libvarnishapi1 
libvarnishapi-dev',
             pin      => 'version 3.*',
-            priority => 1002,
-        }
-
-        # Prefer varnishkafka 1.0.7, compatible with varnish 3
-        apt::pin { 'varnishkafka':
-            package  => 'varnishkafka*',
-            pin      => 'version 1.0.7*',
             priority => 1002,
         }
     }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia9a5a334dad27a9cd915139b477adcc3fe403546
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Ottomata <o...@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