X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=NodeUpdate.py;h=8d07729f786d4e6a3f0c0b60a9ee846da361c279;hb=09f1706948e213a4b53ce20c69db8e70d3c79214;hp=8f890b0e01200c3dd132298082c91f266f592c17;hpb=bd0d345544e66f46264e25daf4b492f7cd808f73;p=nodeupdate.git diff --git a/NodeUpdate.py b/NodeUpdate.py old mode 100644 new mode 100755 index 8f890b0..8d07729 --- a/NodeUpdate.py +++ b/NodeUpdate.py @@ -52,12 +52,17 @@ DELETE_RPM_LIST_FILE= '/etc/planetlab/delete-rpm-list' # so, we force the update of crucial pkgs independently, as # the whole group is sometimes too much to swallow # this one is builtin -CRUCIAL_PACKAGES_BUILTIN=[ 'NodeUpdate' , 'nodemanager' ] +CRUCIAL_PACKAGES_BUILTIN=[ 'NodeUpdate' , 'nodemanager-lib', 'nodemanager-lxc', 'nodemanager-vs' ] # and operations can also try to push a list through a conf_file # should use the second one for consistency, try the first one as well for legacy -CRUCIAL_PACKAGES_OPTIONAL_PATH1='/etc/planetlab/NodeUpdate.packages' -CRUCIAL_PACKAGES_OPTIONAL_PATH2='/etc/planetlab/crucial-rpm-list' - +CRUCIAL_PACKAGES_OPTIONAL_PATHS=[ + # this is a legacy name, please avoid using this one + '/etc/planetlab/NodeUpdate.packages' + # file to use with a hand-written conf_file + '/etc/planetlab/crucial-rpm-list' + # this one could some day be maintained by a predefined config_file + '/etc/planetlab/sliceimage-rpm-list' +] # print out a message only if we are displaying output def Message(message): @@ -171,13 +176,18 @@ class NodeUpdate: try: crucial_packages = [] for package in CRUCIAL_PACKAGES_BUILTIN: crucial_packages.append(package) - try: crucial_packages += file(CRUCIAL_PACKAGES_OPTIONAL_PATH1).read().split() - except: pass - try: crucial_packages += file(CRUCIAL_PACKAGES_OPTIONAL_PATH2).read().split() - except: pass + for path in CRUCIAL_PACKAGES_OPTIONAL_PATHS: + try: crucial_packages += file(CRUCIAL_PACKAGES_OPTIONAL_PATH1).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)) + # if package is not yet installed, like e.g. slice images, + # need to yum install, not yum update + if os.system("rpm -q %s > /dev/null"%package)==0: + Message( "\nUpdating crucial package %s" % package) + os.system( "%s %s -y update %s" %(YUM_PATH, yum_options, package)) + else: + Message( "\Installing crucial package %s" % package) + os.system( "%s %s -y install %s" %(YUM_PATH, yum_options, package)) except: pass