Use new shiny Devices class instead of old ugly Device

The pyudev library migrated teh Device class to Devices and
while all the old methods still work, it's marked for removal
in one of the next releases.
Updating to the new class will probably prevent some
headaches.

Change-Id: I4a4c7ce7b5139af9c8886a759979d5b3f5bf8b8d
This commit is contained in:
Riccardo Pittau 2019-10-21 15:01:30 +02:00
parent 7883102db0
commit 453485bf0a

View File

@ -33,7 +33,7 @@ def get_devices_wwn(devices, module):
for device in devices:
name = '/dev/' + device
try:
udev = pyudev.Device.from_device_file(context, name)
udev = pyudev.Devices.from_device_file(context, name)
except (ValueError, EnvironmentError, pyudev.DeviceNotFoundError) as e:
module.warn('Device %(dev)s is inaccessible, skipping... '
'Error: %(error)s' % {'dev': name, 'error': e})