Projet

Général

Profil

cfgparser.patch

Joël Cuissinat, 02/04/2012 12:36

Télécharger (4,05 ko)

Voir les différences:

creole/cfgparser.py
1000 1000
                raise Exception('Le conteneur %s n\'existe pas'%container)
1001 1001
            tcontainer = {}
1002 1002
            tcontainer[container] = self.containers[container]
1003
        need_update = {}
1004
        #cvar = load_container_var()
1005
        for name, value in tcontainer.items():
1006
            if not need_update.has_key(name):
1007
                need_update[name] = True
1008
            if config.VIRTDISABLED == False and name != config.VIRTMASTER:
1003

  
1004
        if not config.VIRTDISABLED:
1005
            # mode conteneur => gestion par conteneur
1006
            for name, value in tcontainer.items():
1007
                missing_pkg = []
1009 1008
                for package in value['packages']:
1010
                    #chroot = cvar['container_path_%s'%name]
1011 1009
                    if not is_installed(package, container=name, context=context):
1012
                        if need_update[name] == True:
1013
                            cmd = ['/usr/bin/apt-eole', 'update-conteneur', name]
1014
                            if system_out(cmd)[0] != 0:
1015
                                raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1016
                            need_update[name] = False
1017
                        self.log.info(install_msg % (package, name))
1018
                        print_cyan(install_msg % (package, name))
1019
                        cmd = ['/usr/bin/apt-eole', 'install-conteneur', name, package]
1020
                        if system_code(cmd) != 0:
1021
                            raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1022
            else:
1010
                        missing_pkg.append(package)
1011
                if missing_pkg != []:
1012
                    cmd = ['/usr/bin/apt-eole', 'update-conteneur', name]
1013
                    if system_out(cmd)[0] != 0:
1014
                        raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1015
                    packages = ' '.join(missing_pkg)
1016
                    self.log.info(install_msg % (packages, name))
1017
                    print_cyan(install_msg % (packages, name))
1018
                    cmd = ['/usr/bin/apt-eole', 'install-conteneur', name, packages]
1019
                    if system_code(cmd) != 0:
1020
                        raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1021
        else:
1022
            # mode non conteneur => gestion globale
1023
            missing_pkg = []
1024
            for name, value in tcontainer.items():
1023 1025
                for package in value['packages']:
1024
                    #update
1025 1026
                    if not is_installed(package):
1026
                        if need_update[name] == True:
1027
                            cmd = ['/usr/bin/apt-get', 'update']
1028
                            if system_out(cmd)[0] != 0:
1029
                                raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1030
                            need_update[name] = False
1031
                        self.log.info(install_msg % (package, name))
1032
                        print_cyan(install_msg % (package, name))
1033
                        cmd = ['/usr/bin/apt-eole', 'install', package]
1034
                        if system_code(cmd) != 0:
1035
                            raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1027
                        missing_pkg.append(package)
1028
            if missing_pkg != []:
1029
                cmd = ['/usr/bin/apt-get', 'update']
1030
                if system_out(cmd)[0] != 0:
1031
                    raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1032
                packages = ' '.join(missing_pkg)
1033
                self.log.info(install_msg % (packages, config.VIRTMASTER))
1034
                print_cyan(install_msg % (packages, config.VIRTMASTER))
1035
                cmd = ['/usr/bin/apt-eole', 'install', package]
1036
                if system_code(cmd) != 0:
1037
                    raise Exception("Erreur d'exécution de %s" % ' '.join(cmd))
1036 1038

  
1037 1039
    def lxc_postinstall(self, container=None):
1038 1040
        if config.VIRTDISABLED == True: