client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py | 28 ++++------
1 file changed, 13 insertions(+), 15 deletions(-)
New commits:
commit 3798d4c09df0b70447ca37b45f3f0b608a8c9de5
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Mar 23 17:05:58 2010 +0100
do not use reserved word type
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
index 6fe95bb..4c07373 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
@@ -250,12 +250,12 @@ def _clasify_class(device):
if subsystem =='scsi':
if device.get_devtype =='scsi_device':
- type = _get_scsi_dev_type(device)
- if type == 0 or type == 14:
+ dev_type = _get_scsi_dev_type(device)
+ if dev_type == 0 or dev_type == 14:
return 'HD'
- elif type == 1:
+ elif dev_type == 1:
return 'TAPE'
- elif type == 5:
+ elif dev_type == 5:
return 'CDROM'
else:
return 'OTHER'
commit 84cb380e0c2a994d083eac369c33e5f2d12c166e
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Mar 23 17:04:55 2010 +0100
remove dead code
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
index a1976f2..6fe95bb 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
@@ -74,9 +74,6 @@ def get_devices():
pci_subsys = device.get_property('PCI_SUBSYS_ID')
if pci_subsys:
(result_item['prop3'], result_item['prop4']) =
pci_subsys.split(':')
- elif subsystem =='scsi':
- if device.get_devtype =='scsi_device':
- type = _get_scsi_dev_type(device)
elif subsystem == 'usb':
if device.has_property('ID_VENDOR_ID'):
result_item['prop1'] =
device.get_property('ID_VENDOR_ID')
commit 8b25dd50f45a1514e4c38b55df04f51578f4ce87
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Mar 23 17:01:31 2010 +0100
group test on subsystem together, to create more readable code
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
index 7ac1ee3..a1976f2 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
@@ -45,6 +45,8 @@ def get_devices():
'class': _clasify_class(device),
'desc': _get_device_desc(device),
}
+ if result_item['driver'] is None:
+ result_item['driver'] = 'unknown'
if subsystem == 'block':
if device.has_property('ID_BUS'):
result_item['bus'] = device.get_property('ID_BUS')
@@ -65,15 +67,22 @@ def get_devices():
# result_item['prop1'] = ''
# This is interpreted as Logical. But what to do with it?
# result_item['prop2'] = ''
- if result_item['driver'] is None:
- result_item['driver'] = 'unknown'
- if subsystem == 'pci':
+ elif subsystem == 'pci':
pci_class = device.get_property('PCI_ID')
if pci_class:
(result_item['prop1'], result_item['prop2']) =
pci_class.split(':')
pci_subsys = device.get_property('PCI_SUBSYS_ID')
if pci_subsys:
(result_item['prop3'], result_item['prop4']) =
pci_subsys.split(':')
+ elif subsystem =='scsi':
+ if device.get_devtype =='scsi_device':
+ type = _get_scsi_dev_type(device)
+ elif subsystem == 'usb':
+ if device.has_property('ID_VENDOR_ID'):
+ result_item['prop1'] =
device.get_property('ID_VENDOR_ID')
+ if device.has_property('ID_MODEL_ID'):
+ result_item['prop2'] =
device.get_property('ID_MODEL_ID')
+
if device.has_property('ID_BUS') and
device.get_property('ID_BUS') == 'scsi':
path = device.get_property('ID_PATH')
m = re.search('.*-scsi-(\d+):(\d+):(\d+):(\d+)', path)
@@ -81,14 +90,6 @@ def get_devices():
result_item['prop2'] = m.group(2) # DEV_ID
result_item['prop3'] = m.group(3) # DEV_CHANNEL
result_item['prop4'] = m.group(4) # DEV_LUN
- if subsystem =='scsi':
- if device.get_devtype =='scsi_device':
- type = _get_scsi_dev_type(device)
- if subsystem == 'usb':
- if device.has_property('ID_VENDOR_ID'):
- result_item['prop1'] =
device.get_property('ID_VENDOR_ID')
- if device.has_property('ID_MODEL_ID'):
- result_item['prop2'] =
device.get_property('ID_MODEL_ID')
result.append(result_item)
return result
Show replies by date