summaryrefslogtreecommitdiffstats
path: root/textw
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-10-09 13:38:53 +0200
committerHans de Goede <hdegoede@redhat.com>2009-10-10 15:11:12 +0200
commitdfe1f3b83f40c6036beda4124f72c273f6369647 (patch)
tree4aeeb3078374ae0ef50d49ad25293c0706985852 /textw
parent207eacbd25707225592f175c367635836abed918 (diff)
downloadanaconda-dfe1f3b83f40c6036beda4124f72c273f6369647.tar.gz
anaconda-dfe1f3b83f40c6036beda4124f72c273f6369647.tar.xz
anaconda-dfe1f3b83f40c6036beda4124f72c273f6369647.zip
Fix parsing of optional portnr in iscsi target IP (#525118)
This patch fixes 2 issues with the parsing of the optional portnr in iscsi target IP's: 1) We don't want to include the : in the portno, so port = target[idx:] should be port = target[idx+1:] 2) An IPV6 IP always includes the : character, so specifying the port was mandatory with IPV6, this patch looks for "]:" inside the string to determine if a port is present for IPV6 strings.
Diffstat (limited to 'textw')
-rw-r--r--textw/partition_text.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/textw/partition_text.py b/textw/partition_text.py
index 412a7d75e..0024505b7 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -260,10 +260,17 @@ class PartitionTypeWindow:
target = entries[0].strip()
try:
- idx = target.rfind(":")
+ count = len(target.split(":"))
+ idx = target.rfind("]:")
+ # Check for IPV6 [IPV6-ip]:port
if idx != -1:
+ ip = target[1:idx]
+ port = target[idx+2:]
+ # Check for IPV4 aaa.bbb.ccc.ddd:port
+ elif count == 2:
+ idx = target.rfind(":")
ip = target[:idx]
- port = target[idx:]
+ port = target[idx+1:]
else:
ip = target
port = "3260"