diff --git a/gestion/iscsi/nolslib.py b/gestion/iscsi/nolslib.py index 05150c01..1efc29b0 100755 --- a/gestion/iscsi/nolslib.py +++ b/gestion/iscsi/nolslib.py @@ -101,8 +101,26 @@ class Nols(object): tree = ElementTree(root) Objects = tree.findall("OBJECT[@name='volume-view']") for Object in Objects: - name = Object.findall("PROPERTY[@name='volume-name']")[0].text - lun = Object.findall("OBJECT/PROPERTY[@name='lun']")[0].text + # Quand on passera à wheezy, décommenter ces lignes, et virer + # la merde que j'ai fait juste après. + #name = Object.findall("PROPERTY[@name='volume-name']")[0].text + #lun = Object.findall("OBJECT/PROPERTY[@name='lun']")[0].text + properties = Object.findall("PROPERTY") + for property in properties: + if property.attrib['name'] == "volume-name": + name = property.text + else: + pass + + subObjects = Object.findall("OBJECT") + for subObject in subObjects: + properties = subObject.findall("PROPERTY") + for property in properties: + if property.attrib['name'] == "lun": + lun = property.text + else: + pass + if lun is None: pass else: