[elbe-devel] [PATCH 2/2] cdroms: dont crash when no <src-cdrom> node exists

Torben Hohn torben.hohn at linutronix.de
Wed Oct 2 13:15:27 CEST 2019


normal xml files fail to create the source cdrom:

---------------------------------------------------------------------------
  File "/var/cache/elbe/devel/elbepack/asyncworker.py", line 181, in execute
    skip_pbuild=self.skip_pbuilder)
  File "/var/cache/elbe/devel/elbepack/elbeproject.py", line 625, in build
    self.build_cdroms(build_bin, build_sources, cdrom_size)
  File "/var/cache/elbe/devel/elbepack/elbeproject.py", line 469, in build_cdroms
    xml=self.xml)
  File "/var/cache/elbe/devel/elbepack/cdroms.py", line 97, in mk_source_cdrom
    for arch_vol in xml.node('src-cdrom').all('archive'):
AttributeError: 'NoneType' object has no attribute 'all'
Project build was not successful, current status: build_failed
---------------------------------------------------------------------------

dont try to access xml.node('src-cdrom'). Just use
xml.all('src-cdrom/archive') which will nicely iterate over nothing, if the
<src-cdrom> does not exist.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/cdroms.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
index d9e671958..669c3c786 100644
--- a/elbepack/cdroms.py
+++ b/elbepack/cdroms.py
@@ -94,7 +94,7 @@ def mk_source_cdrom(rfs, arch, codename, init_codename, target,
     if xml is not None:
         options = get_iso_options(xml)
 
-        for arch_vol in xml.node('src-cdrom').all('archive'):
+        for arch_vol in xml.all('src-cdrom/archive'):
             volume_attr = arch_vol.et.get('volume')
 
             if volume_attr == 'all':
-- 
2.20.1




More information about the elbe-devel mailing list