From: David Shea dshea@redhat.com
Search by Port / Target / LUN was usually returning an empty list since the port test was failing to compare a string to an int. Beyond that, do not return entries with no port when a port is selected, and do not return iscsi entries when a non-integer LUN is entered.
Add an empty entry to all of the filter combo boxes so that the combo box criterion can be cleared.
Replace a builder.get_object call with the already gotten object reference. --- pyanaconda/ui/gui/spokes/filter.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py index 83d3499..d3069a8 100644 --- a/pyanaconda/ui/gui/spokes/filter.py +++ b/pyanaconda/ui/gui/spokes/filter.py @@ -126,14 +126,18 @@ def visible_func(self, model, itr, *args): def setupCombo(self, combo, items): """Populate a given GtkComboBoxText instance with a list of items. The combo will first be cleared, so this method is suitable for calling - repeatedly. The first item in the list will be selected by default. + repeatedly. The first item in the list will be empty to allow the + combo box criterion to be cleared. The first non-empty item in the + list will be selected by default. """ combo.remove_all() + combo.append_text('') + for i in sorted(set(items)): combo.append_text(i)
if items: - combo.set_active(0) + combo.set_active(1)
def _long_identifier(self, disk): # For iSCSI devices, we want the long ip-address:port-iscsi-tgtname-lun-XX @@ -174,7 +178,7 @@ def setup(self, store, selectedNames, disks): if hasattr(disk, "node"): ports.append(str(disk.node.port))
- self.setupCombo(self.builder.get_object("searchPortCombo"), ports) + self.setupCombo(self._portCombo, ports)
def clear(self): self._lunEntry.set_text("") @@ -184,8 +188,11 @@ def clear(self):
def _port_equal(self, device): active = self._portCombo.get_active_text() - if active and hasattr(device, "node"): - return device.node.port == active + if active: + if hasattr(device, "node"): + return device.node.port == int(active) + else: + return False else: return True
@@ -198,13 +205,14 @@ def _target_equal(self, device):
def _lun_equal(self, device): active = self._lunEntry.get_text().strip() - if active and hasattr(device, "node"): - try: - return int(active) == device.node.tpgt - except ValueError: - return True - elif active and hasattr(device, "fcp_lun"): - return active in device.fcp_lun + if active: + if hasattr(device, "node"): + try: + return int(active) == device.node.tpgt + except ValueError: + return False + elif hasattr(device, "fcp_lun"): + return active in device.fcp_lun else: return True