Tâche #18676
Scénario #18693: Traitement express MEN (4-6)
Erreur creolelint Amonecole 2.6.1a3 (lxc)
Description
00:21:50.458 \-- /usr/share/eole/creole/distrib/lxc.devices.hook 00:38:02.742 Exception ctypes.ArgumentError: "argument 1: <type 'exceptions.TypeError'>: expected LP_udev_enumerate instance instead of Enumerator" in <bound method Enumerator.__del__ of <pyudev.core.Enumerator object at 0x7f18b3db91d0>> ignored 00:38:02.743 Exception ctypes.ArgumentError: "argument 1: <type 'exceptions.TypeError'>: expected LP_udev_enumerate instance instead of Enumerator" in <bound method Enumerator.__del__ of <pyudev.core.Enumerator object at 0x7f18b3db92d0>> ignored 00:38:02.743 Exception ctypes.ArgumentError: "argument 1: <type 'exceptions.RuntimeError'>: maximum recursion depth exceeded while calling a Python object" in <bound method Enumerator.__del__ of <pyudev.core.Enumerator object at 0x7f18b3db93d0>> ignored 00:38:02.744 Exception ctypes.ArgumentError: "argument 1: <type 'exceptions.RuntimeError'>: maximum recursion depth exceeded while calling a Python object" in <bound method Context.__del__ of <pyudev.core.Context object at 0x7f18b3db9310>> ignored 00:38:02.744 AUTOMATE : Traceback dans la sortie console! 00:38:02.744 Traceback (most recent call last): 00:38:02.745 File "/usr/bin/CreoleLint", line 60, in main 00:38:02.745 validate(keyword, ansi, tmpl) 00:38:02.748 File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 1167, in validate 00:38:02.749 ansi.process(cl) 00:38:02.749 File "/usr/lib/python2.7/dist-packages/creole/lint/ansiwriter.py", line 47, in process 00:38:02.749 checks = linter.check() 00:38:02.751 File "/usr/lib/python2.7/dist-packages/creole/lint/creolelint.py", line 1126, in check 00:38:02.751 parse_templates(self._list_tmpl_files()) 00:38:02.752 File "/usr/lib/python2.7/dist-packages/creole/lint/parsetemplate.py", line 633, in parse_templates 00:38:02.752 print_red(str(err)) 00:38:02.753 RuntimeError: maximum recursion depth exceeded while getting the repr of a tuple
Associated revisions
Correction du template lxc.devices.hook
Le "current_container" n'a pas forcément de disknods.
C'est ce qui fait planté CreoleLint ... il n'y a donc pas
de bug dans CreoleLint ...
ref #18676 @2h
Protect access to containers attributes
Some container's attributes are not present, checking the length of
such an attribute result in
“RuntimeError: maximum recursion depth exceeded while getting the repr of a tuple”
We need to protect access to such attributes, but the following does
not work:
%if 'attributes' in %%current_container
we need to explicitely use “%%hasattr”.
- tmpl/lxc.config: Protect access to “disknods”.
- tmpl/lxc.fstab: Protect access to “fstabs”.
- tmpl/lxc.devices.hook: Use single quote.
Ref: #18676
Template: check element existence in context with “in”
It's not possible to make:
%if 'fstabs' in %%current_container
Because the “CreoleGet” object does not implements the
“__contains__()” method.
- creole/template.py (CreoleGet.__contains__): Check variable
existence in context.
Ref: #18676
Fix protection of access to containers attributes
We need to protect access to such attributes, but they are not
attributes of the object %%current_context.
“creole.template.CreoleGet” is fixed to make the use of “in” possible.
- tmpl/lxc.config: Check existence of “disknods” in
“%%current_container”.
- tmpl/lxc.devices.hook: Check existence of “disknods” in
“%%current_container”.
- tmpl/lxc.fstab: Check existence of “fstabs” in
“%%current_container”.
Ref: #18676
LXC: fix “UnicodeEncodeError” on /etc/hosts generation
Concatening an unicode with a non unicode can result in “UnicodeEncodeError”.
- creole/funcs/get_etc_hosts.py (get_etc_hosts): Add unicode to
inlined strings.
Ref: #18676
LXC: fix comment on container interface
- creole/funcs/get_etc_hosts.py (get_etc_hosts): Remove plural form
for single interface.
Ref: #18676
CreoleLint: LXC must contains resources
Some templates use “%%current_container” to access container resources
like “interfaces”, “disknods”, “hosts”, “fstabs”...
Protecting access in template is useless because CreoleLint did not
use the correct method to build container context.
- creole/lint/parsetemplate.py (Check_Template.__init__): Use
“CreoleClient.get_container_info()”.
Ref: #18676
History
#2 Updated by Gérald Schwartzmann over 6 years ago
- Parent task changed from #18373 to #18693
#3 Updated by Philippe Caseiro over 6 years ago
- Assigned To set to Philippe Caseiro
#4 Updated by Scrum Master over 6 years ago
- Status changed from Nouveau to En cours
#5 Updated by Scrum Master over 6 years ago
- Status changed from En cours to Résolu
#6 Updated by Daniel Dehennin over 6 years ago
- Status changed from Résolu to En cours
#7 Updated by Daniel Dehennin over 6 years ago
- Assigned To changed from Philippe Caseiro to Daniel Dehennin
Le problème est présent sur d’autres templates.
#8 Updated by Daniel Dehennin over 6 years ago
- Status changed from En cours to Résolu
Nouveau paquet 2.6.1-52.
#9 Updated by Daniel Dehennin over 6 years ago
- % Done changed from 0 to 100
#10 Updated by Daniel Dehennin over 6 years ago
Pas de plantage au CreoleLint sur jenkins.
#11 Updated by Daniel Dehennin over 6 years ago
- Status changed from Résolu to Fermé
- Remaining (hours) changed from 1.0 to 0.0