Muehlenhoff has uploaded a new change for review.

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

Change subject: Add code to handle legacy binaries
......................................................................

Add code to handle legacy binaries

Also add to documentation and provide an example config.

Change-Id: Id96e2b9412badf3102a4dc339949f9320e329c94
---
M debian/changelog
M docs/readme.txt
A examples/debdeploy-minion.conf
M minion/debdeploy-minion.py
4 files changed, 44 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/debs/debdeploy 
refs/changes/80/282680/1

diff --git a/debian/changelog b/debian/changelog
index b57bb9e..f0ea11e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@
     the library upgrade, useful when updating severals in one batch
     and bundling the service restarts
   * Fix traceback in error message if update is deployed twice
+  * Allow blacklisting of legacy packages, see chapter "Dealing with
+    legacy binary packages" in readme.txt
 
  -- Moritz Muehlenhoff <mmuhlenh...@wikimedia.org>  Fri, 20 Nov 2015 12:50:01 
+0100
 
diff --git a/docs/readme.txt b/docs/readme.txt
index 5ce9269..7f4e121 100644
--- a/docs/readme.txt
+++ b/docs/readme.txt
@@ -218,8 +218,33 @@
 -----------------
 
 
+Dealing with legacy binary packages
+-----------------------------------
 
+debdeploy operates on source packages. When an update is deployed
+all currently installed binary packages are queried. If a system
+has been upgraded from an earlier release and if some outdated
+binary packages are still around, upgrades may fail with the error
+message:
+"The version to be installed could not be found. It might have been
+superceded by a more recent version or the apt source is incomplete"
 
+This happens since debdeploy explicitly specifies the version to
+upgrade to, but for those outdated binaries thet version is not
+available. An example:
+
+You're trying to upgrade the bind9 source package. In Debian wheezy
+the binary package name for the ISC DNS shared library is libdns88,
+while in Debian jessie, the package name is libdns100. If you are
+trying to upgrade bind9 on a jessie system which still has libdns88
+installed you, the minion will detect that libdns88 is from the bind9
+source package and try to upgrade to the version specified in the YAML
+file (which doesn't exist on jessie any longer).
+
+It's recommended to prune those outdated binary packages after
+distribution upgrades. Alternatively you can add a local blacklist
+by adding a config file /etc/debdeploy-minion.conf. It contains
+a blacklist of binary packages, see the shipped example file.
 
 
 
diff --git a/examples/debdeploy-minion.conf b/examples/debdeploy-minion.conf
new file mode 100644
index 0000000..4600462
--- /dev/null
+++ b/examples/debdeploy-minion.conf
@@ -0,0 +1,2 @@
+[blacklist-trusty]
+bind9: libdns81, libisc83
\ No newline at end of file
diff --git a/minion/debdeploy-minion.py b/minion/debdeploy-minion.py
index ce19810..f688724 100644
--- a/minion/debdeploy-minion.py
+++ b/minion/debdeploy-minion.py
@@ -6,6 +6,7 @@
 import logging, pickle, subprocess, os, re
 import logging.handlers
 
+import ConfigParser
 import salt.utils
 import salt.config
 import salt.loader
@@ -198,11 +199,21 @@
 
     pending_restarts_pre = set()
     pending_restarts_post = set()
+    blacklisted_packages = []
 
     installed_distro = grains['oscodename']
     if not versions.has_key(installed_distro):
         log.info("Update doesn't apply to the installed distribution (" + 
installed_distro + ")")
         return {}
+
+    if os.path.exists("/etc/debdeploy-minion.conf"):
+        config = ConfigParser.ConfigParser()
+        config.read("/etc/debdeploy-minion.conf")
+
+        if config.has_section("blacklist-" + installed_distro):
+            if config.has_option("blacklist-" + installed_distro, source):
+                blacklisted_packages = [x.strip() for x in 
config.get("blacklist-" + installed_distro, source).split(",")]
+    log.info("Packages blacklisted for upgrades: " + str(blacklisted_packages))
 
     # Detect all locally installed binary packages of a given source package
     # The only resource we can use for that is parsing the /var/lib/dpkg/status
@@ -219,6 +230,10 @@
         if installation_status == "deinstall":
             continue
 
+        if pkg.has_key('Package') and pkg.get('Package') in 
blacklisted_packages:
+            log.info('Package ' + pkg.get('Package') + ' has been blacklisted 
for installation')
+            continue
+
         # Source packages which have had a binNMU have a Source: entry with 
the source
         # package version in brackets, so strip these
         # If no Source: entry is present in /var/lib/dpkg/status, then the 
source package

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id96e2b9412badf3102a4dc339949f9320e329c94
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/debdeploy
Gerrit-Branch: master
Gerrit-Owner: Muehlenhoff <mmuhlenh...@wikimedia.org>

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

Reply via email to