diff options
author | Hans de Goede <hdegoede@redhat.com> | 2009-10-09 13:38:53 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2009-10-10 15:16:16 +0200 |
commit | 3f9accd3f4bbe345e95b84363381e2d8b4534831 (patch) | |
tree | 0058e3d8e7fbd8676caa0dac73d2bd0740e6c155 | |
parent | b1dd9e39ad58dd65f01032b81b5574140af64d42 (diff) | |
download | anaconda-3f9accd3f4bbe345e95b84363381e2d8b4534831.tar.gz anaconda-3f9accd3f4bbe345e95b84363381e2d8b4534831.tar.xz anaconda-3f9accd3f4bbe345e95b84363381e2d8b4534831.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.
-rw-r--r-- | iw/autopart_type.py | 11 | ||||
-rw-r--r-- | textw/partition_text.py | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/iw/autopart_type.py b/iw/autopart_type.py index fb5e5f29a..39d099658 100644 --- a/iw/autopart_type.py +++ b/iw/autopart_type.py @@ -295,10 +295,17 @@ class PartitionTypeWindow(InstallWindow): err = None 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" 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" |