Muehlenhoff has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372841 )

Change subject: Add new config options to debdeploy.conf to support pre-defined 
library name mapping for the restart check
......................................................................

Add new config options to debdeploy.conf to support pre-defined
library name mapping for the restart check

Change-Id: I66c0117a19ce6e2bbd164f815039441bbb6947ae
---
M debian/changelog
M examples/debdeploy.conf
M server/debdeploy_conf.py
M server/generate-debdeploy-spec
4 files changed, 31 insertions(+), 26 deletions(-)


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

diff --git a/debian/changelog b/debian/changelog
index 11799d0..28b20b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,8 @@
     a transition period)
   * Create a new package debdeploy-server for the Cumin-based server
     and a new package debdeploy-client for the local runtime scripts
+  * Add new config options to debdeploy.conf to support pre-defined
+    library name mapping for the restart check
 
  -- Moritz Muehlenhoff <mmuhlenh...@wikimedia.org>  Fri, 07 Jul 2017 13:49:03 
+0200
 
diff --git a/examples/debdeploy.conf b/examples/debdeploy.conf
index b6e7456..8c04104 100644
--- a/examples/debdeploy.conf
+++ b/examples/debdeploy.conf
@@ -1,22 +1,11 @@
-
 [distros]
 # Code names of supported distribution releases
-supported = trusty, jessie, precise
-
-[serverlists]
-# A list of servers, each defined by one or more Salt grains. If multiple 
grains
-# are specified, they're processed sequentially
-testsystem = debdeploy:testsystem
-webserver_full = debdeploy:webserver, debdeploy:webservertest
-
-[rollout]
-# A list of update patterns, each performed in up to three steps, specified by
-# name = a% , x delay in minutes , b% , y delay in minutes , c%
-# The first a% are deployed immediately, then x minutes need to pass, then b%
-# of all updates are deployed and after waiting y minutes the final c% are
-# deployed
-immediately = 100 , 0, 0, 0, 0
+trusty = ubuntu, 14.04
+jessie = debian, 8
+stretch = debian, 9
 
 [logging]
 debug = false
 
+[libraries]
+openssl = libssl, libcrypto
diff --git a/server/debdeploy_conf.py b/server/debdeploy_conf.py
index c721bf3..6556970 100644
--- a/server/debdeploy_conf.py
+++ b/server/debdeploy_conf.py
@@ -11,6 +11,7 @@
     '''
     supported_distros = {}
     debug = False
+    library_hints = {}
 
     def __init__(self, configfile):
         config = ConfigParser.ConfigParser()
@@ -31,6 +32,12 @@
             print "You need to specify at least one supported distribution in 
/etc/debdeploy.conf"
             sys.exit(1)
 
+        if config.has_section("libraries"):
+            for library in config.options("libraries"):
+                self.library_hints[library] = []
+                for i in config.get("libraries", library).split(","):
+                    self.library_hints[library].append(i.strip())
+
         if config.has_section("logging") and config.has_option("logging", 
"debug"):
             if config.getboolean("logging", "debug"):
                 self.debug = True
diff --git a/server/generate-debdeploy-spec b/server/generate-debdeploy-spec
index 7867df6..8e9b750 100755
--- a/server/generate-debdeploy-spec
+++ b/server/generate-debdeploy-spec
@@ -10,6 +10,7 @@
 comment = ""
 updatetype = ""
 fixes = {}
+libraries = []
 
 while source == "":
     source = raw_input("Please enter the name of source package (e.g. 
openssl). Leave blank or type 'quit' to abort\n>").strip()
@@ -52,20 +53,26 @@
     sys.exit(1)
 
 if updatetype == 'library':
-    print "You can specify an optional list of one or more library base names. 
These"
-    print "are used to detect necessary library restarts after an upgrade of a 
library"
+    print conf.library_hints
+    print "You can specify an optional comma-separated list of one or more 
library base names."
+    print "These are used to detect necessary library restarts after an 
upgrade of a library"
     print "E.g. for openssl, these would be 'libssl' and 'libcrypto'"
-    print "Press ENTER to complete the list or not provide any"
 
-    libraries = []
+    if conf.library_hints.get(source, None):
+        print "A pre-defined set has been configured: ", 
conf.library_hints[source]
+        print "Press ENTER to use it or provide an alternative list"
+        libinput = raw_input("Please enter the name of a library. Leave blank 
to quit \n>").strip()
+        if libinput == "":
+            libraries = conf.library_hints[source]
+        else:
+            for i in libinput.split(","):
+                libraries.append(i.strip())
+    else:
+        libinput = raw_input("Please enter the name of a library. Leave blank 
to quit \n>").strip()
+        for i in libinput.split(","):
+            libraries.append(i.strip())
     
-    lib = "undef"
-    while lib != "":
-        lib = raw_input("Please enter the name of a library. Leave blank to 
quit \n>").strip()
 
-        if lib != "undef" and lib != "":
-            libraries.append(lib)
-    
 valid_name = False
 suggested_name = datetime.datetime.now().strftime("%Y-%m-%d-") + source + 
".yaml"
 while not valid_name:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66c0117a19ce6e2bbd164f815039441bbb6947ae
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