diff options
-rw-r--r-- | src/utils/sw_inventory.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/utils/sw_inventory.py b/src/utils/sw_inventory.py index 5c93ad4..69c1f2c 100644 --- a/src/utils/sw_inventory.py +++ b/src/utils/sw_inventory.py @@ -9,6 +9,7 @@ import platform import re import os +import logging from collections import namedtuple @@ -38,11 +39,15 @@ def _fill_package_set(h, key, pkg_set): for child in childs for value in h.node_values(child) if h.value_key(value) == 'DisplayVersion'] for ch in valid_childs: - name = h.value_string(h.node_get_value(ch, 'DisplayName')) - value = h.node_get_value(ch, 'DisplayVersion') - version = h.value_string(value) - pkg = Package(name, version) - pkg_set.add(pkg) + try: + name = h.value_string(h.node_get_value(ch, 'DisplayName')) + value = h.node_get_value(ch, 'DisplayVersion') + version = h.value_string(value) + pkg = Package(name, version) + pkg_set.add(pkg) + except RuntimeError: + logging.warning('Unable to fill package set with invalid child') + pass def _fill_package_set_1(h, pkg_set): |