Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/251042

Change subject: Add backports repository, but with a low priority
......................................................................

Add backports repository, but with a low priority

Enable backports with a lower priority (50) than that of any installed
packages. This has the following effect:

* Packages which are only available in backports are installable.
* If a package is only available in backports, it will be installed from
  backports.
* If a package is available in both the main package repository and in
  backports, it will be installed from the main package repository.
* Packages which are already installed but which have a newer version available
  in backports will not be upgraded automatically.

Task: T107507
Change-Id: I42d7393eb7ed7444e5887a3fa39fabe9faf775e3
---
A modules/apt/manifests/backports.pp
M modules/apt/manifests/init.pp
M modules/base/manifests/init.pp
3 files changed, 35 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/42/251042/1

diff --git a/modules/apt/manifests/backports.pp 
b/modules/apt/manifests/backports.pp
new file mode 100644
index 0000000..b79f16f
--- /dev/null
+++ b/modules/apt/manifests/backports.pp
@@ -0,0 +1,34 @@
+# == Class: apt::backports
+#
+# Enable backports with a lower priority (50) than that of any installed
+# packages. This makes packages that are only available in backports
+# installable, but it prevents already-installed packages from being
+# upgraded automatically if a newer version exists in backports.
+#
+class apt::backports {
+       requires_os('ubuntu || debian')
+
+       $backports_repository_uri = $::lsbdistid ? {
+               Debian => 'http://mirrors.wikimedia.org/debian',
+               Ubuntu => 'http://nova.clouds.archive.ubuntu.com/ubuntu/',
+       }
+
+       $backports_repository_components = $::lsbdistid ? {
+               Debian => 'main',
+               Ubuntu => 'main restricted universe multiverse',
+       }
+
+       apt::repository { "${::lsbdistcodename}-backports":
+               uri        => $backports_repository_uri,
+               dist       => "${::lsbdistcodename}-backports",
+               components => $backports_repository_components,
+       }
+
+       apt::pin { "${::lsbdistcodename}-backports":
+               pin      => "release a=${::lsbdistcodename}-backports",
+               priority => 50,
+               package  => '*',
+       }
+
+       Class['::apt::backports'] -> Package <| provider == 'apt' |>
+}
diff --git a/modules/apt/manifests/init.pp b/modules/apt/manifests/init.pp
index e6cea05..7a2fe5d 100644
--- a/modules/apt/manifests/init.pp
+++ b/modules/apt/manifests/init.pp
@@ -39,12 +39,6 @@
         pin      => 'release o=Wikimedia',
         priority => 1001,
     }
-    # TODO: Remove after applied everywhere.
-    file { '/etc/apt/preferences.d/wikimedia':
-        ensure  => absent,
-        require => Apt::Pin['wikimedia'],
-        notify  => Exec['apt-get update'],
-    }
 
     $http_proxy = "http://webproxy.${::site}.wmnet:8080";
 
diff --git a/modules/base/manifests/init.pp b/modules/base/manifests/init.pp
index 1871864..38f3054 100644
--- a/modules/base/manifests/init.pp
+++ b/modules/base/manifests/init.pp
@@ -1,5 +1,6 @@
 class base {
     include apt
+    include ::apt::backports
 
     file { '/usr/local/sbin':
         ensure => directory,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42d7393eb7ed7444e5887a3fa39fabe9faf775e3
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>

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

Reply via email to