inventory: added workaround for pyudev < 0.18
This is needed for e.g. RHEL-7.4. Related: rhbz#1251240 Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
4be4754646
commit
8af58432af
1 changed files with 5 additions and 1 deletions
|
|
@ -30,7 +30,11 @@ class Inventory(object):
|
|||
|
||||
def get_device(self, subsystem, sys_name):
|
||||
"""Get a pyudev.Device object for the sys_name (e.g. 'sda')."""
|
||||
return pyudev.Devices.from_name(self._udev_context, subsystem, sys_name)
|
||||
try:
|
||||
return pyudev.Devices.from_name(self._udev_context, subsystem, sys_name)
|
||||
# workaround for pyudev < 0.18
|
||||
except AttributeError:
|
||||
return pyudev.Device.from_name(self._udev_context, subsystem, sys_name)
|
||||
|
||||
def get_devices(self, subsystem):
|
||||
"""Get list of devices on a given subsystem."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue