Muehlenhoff has submitted this change and it was merged.

Change subject: List all required restarts next to the new restarts introduced 
by a library upgrade
......................................................................


List all required restarts next to the new restarts introduced by a library 
upgrade

Useful when updating severals in one batch and bundling the service restarts

Change-Id: I72d56267ac6bc9c579555844e732bf33733d099c
---
M debian/changelog
M master/debdeploy
M minion/debdeploy-minion.py
3 files changed, 29 insertions(+), 1 deletion(-)

Approvals:
  Muehlenhoff: Verified; Looks good to me, approved



diff --git a/debian/changelog b/debian/changelog
index eca6019..f6f0f24 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,9 @@
   * Detect outdated package versions and flag an error
   * Packages in deinstalled status ("rc" in dpkg) are now ignored by
     the minion
+  * List all required restarts next to the new restarts introduced by
+    the library upgrade, useful when updating severals in one batch
+    and bundling the service restarts
 
  -- Moritz Muehlenhoff <[email protected]>  Fri, 20 Nov 2015 12:50:01 
+0100
 
diff --git a/master/debdeploy b/master/debdeploy
index 0b6527a..79486ce 100755
--- a/master/debdeploy
+++ b/master/debdeploy
@@ -40,6 +40,7 @@
     update_cnt = {}
     install_errors = []
     restart_cnt = {}
+    new_restart_cnt = {}
 
     if rollback_mode:
         if not joblogdb.does_job_exist(opt.updatefile, opt.serverlist):
@@ -96,6 +97,9 @@
         restart = False
         if res[host]['return'].has_key('restart'):
             restart = res[host]['return']['restart']
+        new_restart = False
+        if res[host]['return'].has_key('new_restart'):
+            new_restart = res[host]['return']['new_restart']
 
         print host + ":"
         if added:
@@ -137,6 +141,15 @@
                         restart_cnt[process].append(host)
                     else:
                         restart_cnt[process].append(host)
+
+        if new_restart:
+            for process in new_restart:
+                if len(process) > 0:
+                    if not new_restart_cnt.get(process, None):
+                        new_restart_cnt[process] = []
+                        new_restart_cnt[process].append(host)
+                    else:
+                        new_restart_cnt[process].append(host)
 
         # Detect installation errors and collect them to display an error list
         # across all Salt grains
@@ -202,6 +215,14 @@
             for i in restart_cnt[process]:
                 print i,
             print
+        print
+        print "New restarts needed:"
+        for process in sorted(new_restart_cnt.keys()):
+            print process, "on", len(new_restart_cnt[process]), "hosts:"
+            print "  ",
+            for i in new_restart_cnt[process]:
+                print i,
+            print
 
     print
     print "Error summary:"
diff --git a/minion/debdeploy-minion.py b/minion/debdeploy-minion.py
index 397dc0e..ce19810 100644
--- a/minion/debdeploy-minion.py
+++ b/minion/debdeploy-minion.py
@@ -258,9 +258,11 @@
     removals = []
     updated = []
     restarts = []
+    new_restarts = []
 
     if update_type == "library":
-        restarts = list(pending_restarts_post.difference(pending_restarts_pre))
+        restarts = list(pending_restarts_post)
+        new_restarts = 
list(pending_restarts_post.difference(pending_restarts_pre))
 
     for i in new_keys.difference(old_keys):
         additions.append[i]
@@ -273,11 +275,13 @@
     log.info("Removed packages: "  + str(removals))
     log.info("Modified packages: " + str(modified))
     log.info("Packages needing a restart: " + str(restarts))
+    log.info("New packages needing a restart: " + str(new_restarts))
 
     r = {}
     r["additions"] = additions
     r["removals"] = removals
     r["updated"] = modified
+    r["new_restart"] = new_restarts
     r["restart"] = restarts
     r["aptlog"] = str(apt_call['stdout'])
     r["apterrlog"] = str(apt_call['stderr'])

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I72d56267ac6bc9c579555844e732bf33733d099c
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/debdeploy
Gerrit-Branch: master
Gerrit-Owner: Muehlenhoff <[email protected]>
Gerrit-Reviewer: Muehlenhoff <[email protected]>

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

Reply via email to