before running yum groupupdate PlanetLab, we start with
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 18 Feb 2011 12:06:47 +0000 (13:06 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 18 Feb 2011 12:11:08 +0000 (13:11 +0100)
running yum update on several crucial packages
this is for when the whole groupupdate fails, which happens
NodeManager is promoted as a builtin package to update
additionally /etc/planetlab/NodeUpdate.packages, if exists
(e.g. through a conf_file) is also scanned for more packages

NodeUpdate.py

index c6823fb..c6be451 100644 (file)
@@ -23,7 +23,6 @@ RPM_PATH = "/bin/rpm"
 
 RPM_GPG_PATH = "/etc/pki/rpm-gpg"
 
-
 # location of file containing http/https proxy info, if needed
 PROXY_FILE = '/etc/planetlab/http_proxy'
 
@@ -47,6 +46,16 @@ EXTENSIONS_FILE='/etc/planetlab/extensions'
 # that were not intended to be deleted.
 DELETE_RPM_LIST_FILE= '/etc/planetlab/delete-rpm-list'
 
+# ok, so the logic should be simple, just yum update the world
+# however there are many cases in the real life where this 
+# just does not work, because of a glitch somewhere
+# so, we force the update of crucial pkgs independently, as 
+# the whole group is sometimes too much to swallow 
+# this one is builtin
+UPDATE_PACKAGES_BUILTIN=[ 'NodeManager' ]
+# and operations can also try to push a list through a conf_file
+UPDATE_PACKAGES_OPTIONAL_PATH='/etc/planetlab/NodeUpdate.packages'
+
 
 # print out a message only if we are displaying output
 def Message(message):
@@ -154,7 +163,20 @@ class NodeUpdate:
             yum_options += " --verbose"
         else:
             Message( "Unsupported, not using --verbose option" )
-                    
+        
+        # a configurable list of packages to try and update independently
+        # cautious..
+        try:
+            crucial_packages = []
+            for package in UPDATE_PACKAGES_BUILTIN: crucial_packages.append(package)
+            try: crucial_packages += file(UPDATE_PACKAGES_OPTIONAL_PATH).read().split()
+            except: pass
+            for package in crucial_packages:
+                Message( "\nUpdating crucial package %s" % package)
+                os.system( "%s %s -y update %s" %(YUM_PATH, yum_options, package))
+        except:
+            pass
+
         Message( "\nUpdating PlanetLab group" )
         os.system( "%s %s %s -y groupinstall \"PlanetLab\"" %
                    (YUM_PATH, yum_options, sslcertdir) )