Project

General

Profile

Tâche #9461

Distribution EOLE - Scénario #9446: Divers 2.4

KeyError non gérée découvert avec CreoleLint

Added by Philippe Caseiro over 6 years ago. Updated over 6 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Start date:
10/31/2014
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:
Remaining (hours):
0.0

Description

Pour reproduire :

Faire un dico avec un SymLinkOption avec une valeur qui n'est pas un nom de variable 
Par exemple :
 <service_access  service='webserver'>     
   <port port_type="SymLinkOption">443</port>                        
   <port>80</port>            
 </service_access>                         

voici le résultat :

DTD Non valide (valid_dtd:ERROR:error)
/usr/share/eole/creole/dicos/97_libvirt.xml:4: element service: validity error : No declaration for attribute type of element service
Document /usr/share/eole/creole/dicos/97_libvirt.xml does not validate against /usr/share/creole/creole.dtd

Lint wrong_dicos_name désactivé (niveau info)

Tabulation dans le dictionnaire au lieu de 4 espaces (tabs_in_dicos:NAME:warning)
 \-- /usr/share/eole/creole/dicos/90_openvswitch.xml
Traceback (most recent call last):
  File "/usr/bin/CreoleLint", line 55, in main
    validate(keyword, ansi, tmpl)
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 1070, in validate
    ansi.process(cl)
  File "/usr/lib/python2.7/dist-packages/creole/lint/ansiwriter.py", line 47, in process
    checks = linter.check()
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 939, in check
    self.load_dics()
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 146, in load_dics
    self._collect_vars_in_dicos()
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 228, in _collect_vars_in_dicos
    self.creoledic.read_dir(self.eoledirs, 'creole')
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 968, in read_dir
    self._gen_descr(namespace)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 1413, in _gen_descr
    containers = self.gen_container(paths, namespace='containers')
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 427, in gen_container
    ret.append(getattr(self, func_name)(paths))
  File "/usr/lib/python2.7/dist-packages/creole/loader.py", line 112, in gen_service_accesss
    return self.__gen_service_access_restriction('service_access', paths)
  File "/usr/lib/python2.7/dist-packages/creole/loader.py", line 136, in __gen_service_access_restriction
    return self.gen_generic(generic_name, paths, verify_exists_redefine=False)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 193, in gen_generic
    verify_exists_redefine=verify_exists_redefine)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 369, in _gen_tiramisu_config
    path = paths[option_value]
KeyError: '443'

Associated revisions

Revision eebfde58 (diff)
Added by Joël Cuissinat over 6 years ago

SymLinkOption avec variable inexistante

  • creole/var_loader.py : traitement de la KeyError

Fixes #9461 @30m

Revision 0267b05e (diff)
Added by Joël Cuissinat over 6 years ago

Ajout des traductions sur les exceptions ajoutées

Ref: #9495 @5m
Ref: #9461 @5m

History

#1 Updated by Joël Cuissinat over 6 years ago

  • Project changed from Distribution EOLE to creole
  • Estimated time set to 1.00 h
  • Parent task deleted (#9446)
  • Remaining (hours) set to 1.0

L'erreur en question n'est pas spécifique à CreoleLint, il faudrait ajouter un raise dans var_loader.py

root@eolebase:~# creoled --debug
creoled - Chargement de la configuration tiramisu
creoled - Set umask to 0022
creoled - Impossible de charger la configuration Creole.443
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/creole/server.py", line 199, in reload_config
    try_upgrade=False)
  File "/usr/lib/python2.7/dist-packages/creole/loader.py", line 287, in creole_loader
    loader.read_dir(dirs, namespace)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 979, in read_dir
    self._gen_descr(namespace)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 1437, in _gen_descr
    containers = self.gen_container(paths, namespace='containers')
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 427, in gen_container
    ret.append(getattr(self, func_name)(paths))
  File "/usr/lib/python2.7/dist-packages/creole/loader.py", line 112, in gen_service_accesss
    return self.__gen_service_access_restriction('service_access', paths)
  File "/usr/lib/python2.7/dist-packages/creole/loader.py", line 136, in __gen_service_access_restriction
    return self.gen_generic(generic_name, paths, verify_exists_redefine=False)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 193, in gen_generic
    verify_exists_redefine=verify_exists_redefine)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 369, in _gen_tiramisu_config
    path = paths[option_value]
KeyError: '443'

#2 Updated by Joël Cuissinat over 6 years ago

  • Parent task set to #9446

Le titre était trompeur, j'ai cru qu'il pouvait s'agir d'un scénario en soi :)

Je suggère au correcteur de résoudre également #9495 dans la foulée...

#3 Updated by Joël Cuissinat over 6 years ago

  • Subject changed from Amélioration de gestion d'erreurs dans CreoleLint to KeyError non géré découvert avec CreoleLint

#4 Updated by Joël Cuissinat over 6 years ago

  • Subject changed from KeyError non géré découvert avec CreoleLint to KeyError non gérée découvert avec CreoleLint

#5 Updated by Joël Cuissinat over 6 years ago

  • Status changed from Nouveau to En cours

#6 Updated by Joël Cuissinat over 6 years ago

  • Status changed from En cours to Résolu
  • % Done changed from 0 to 100

#7 Updated by Joël Cuissinat over 6 years ago

  • Assigned To set to Joël Cuissinat
  • Remaining (hours) changed from 1.0 to 0.15

#8 Updated by Klaas TJEBBES over 6 years ago

  • Status changed from Résolu to Fermé
  • Remaining (hours) changed from 0.15 to 0.0
root@scribek24:~# CreoleL
CreoleLint  CreoleLock  
root@scribek24:~# CreoleLint 

DTD Non valide (valid_dtd:ERROR:error)

Lint wrong_dicos_name désactivé (niveau info)
Traceback (most recent call last):
  File "/usr/bin/CreoleLint", line 55, in main
    validate(keyword, ansi, tmpl)
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 1070, in validate
    ansi.process(cl)
  File "/usr/lib/python2.7/dist-packages/creole/lint/ansiwriter.py", line 47, in process
    checks = linter.check()
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 939, in check
    self.load_dics()
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 146, in load_dics
    self._collect_vars_in_dicos()
  File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 228, in _collect_vars_in_dicos
    self.creoledic.read_dir(self.eoledirs, 'creole')
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 983, in read_dir
    self._gen_descr(namespace)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 1444, in _gen_descr
    containers = self.gen_container(paths, namespace='containers')
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 431, in gen_container
    ret.append(getattr(self, func_name)(paths))
  File "/usr/lib/python2.7/dist-packages/creole/loader.py", line 112, in gen_service_accesss
    return self.__gen_service_access_restriction('service_access', paths)
  File "/usr/lib/python2.7/dist-packages/creole/loader.py", line 136, in __gen_service_access_restriction
    return self.gen_generic(generic_name, paths, verify_exists_redefine=False)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 193, in gen_generic
    verify_exists_redefine=verify_exists_redefine)
  File "/usr/lib/python2.7/dist-packages/creole/var_loader.py", line 373, in _gen_tiramisu_config
    _(u"SymLinkOption targetting unexistent variable: {0}.").format(option_value))
Exception: Variable 443 inexistante utilis\xe9e comme cible d'une SymLinkOption.

Also available in: Atom PDF