Project

General

Profile

redefine_service.diff

Emmanuel GARETTE, 02/10/2012 12:29 PM

Download (1.93 KB)

View differences:

dom_parser.py 2012-02-07 20:59:12.319707741 +0100
141 141
        except (TypeError, ValueError):
142 142
            pty = True
143 143
        try:
144
            redefine = string_to_bool(serv.getAttribute('redefine'))
145
        except (TypeError, ValueError):
146
            redefine = False
147
        try:
144 148
            #True : seulement en mode conteneur
145 149
            #False : seulement en mode non conteneur
146 150
            #None : dans les deux modes
......
153 157
                'method': method,
154 158
                'pty': pty,
155 159
                'level': service_level,
156
                'in_container': in_container}
160
                'in_container': in_container,
161
                'redefine': redefine}
157 162
    return result
158 163
def parse_interfaces(interface_node):
159
-- /root/cfgparser.py	2012-02-07 20:46:53.525047970 +0100
164
++ cfgparser.py	2012-02-09 15:16:01.523909182 +0100
......
219 219
                if in_container != None and ((in_container == True and config.VIRTDISABLED) or (in_container == False and not config.VIRTDISABLED)):
220 220
                    continue
221 221
                if self.containers[name]['services'].has_key(servicename):
222
                    raise Exception('Le service {0} existe déjà dans le conteneur {1}' % (servicename, name))
222
                    if not value['redefine']:
223
                        raise Exception('Le service {0} existe déjà dans le conteneur {1}'.format(servicename, name))
224
                    else:
225
                        self.containers[name]['services'].pop(servicename)
226
                elif value['redefine']:
227
                        raise Exception("Le service {0} n'existe pas dans le conteneur {1} alors que redefine".format(servicename, name))
228

  
223 229
                self.containers[name]['services'][servicename] = {'active': True,
224 230
                        'servicelist': servicelist,
225 231
                        'startlevel': startlevel,