[PATCH 4/8] Fix issues with advanced storage searching.
David Shea
dshea at redhat.com
Thu Jun 4 19:57:40 UTC 2015
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.
(cherry picked from commit e13a970648b88c9b25b70763dd39478e59aa0355)
Resolves: rhbz#1168950
---
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 bbd7f0c..0e31796 100644
--- a/pyanaconda/ui/gui/spokes/filter.py
+++ b/pyanaconda/ui/gui/spokes/filter.py
@@ -127,14 +127,18 @@ class FilterPage(object):
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
@@ -175,7 +179,7 @@ class SearchPage(FilterPage):
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("")
@@ -185,8 +189,11 @@ class SearchPage(FilterPage):
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
@@ -199,13 +206,14 @@ class SearchPage(FilterPage):
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
--
2.1.0
More information about the anaconda-patches
mailing list