[PATCH] Fix parsing of optional portnr in iscsi target IP (#525118)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 counts the number of : inside the
   string to determine if a port is present for IPV6 strings.

This patch is meant for both F-12 and F-13
---
 iw/autopart_type.py     |    7 ++++---
 textw/partition_text.py |    7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/iw/autopart_type.py b/iw/autopart_type.py
index e41f618..2b22c64 100644
--- a/iw/autopart_type.py
+++ b/iw/autopart_type.py
@@ -297,10 +297,11 @@ class PartitionTypeWindow(InstallWindow):
 
             err = None
             try:
-                idx = target.rfind(":")
-                if idx != -1:
+                count = len(target.split(":"))
+                if count == 2 or count == 9:
+                    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 412a7d7..bb70922 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -260,10 +260,11 @@ class PartitionTypeWindow:
 
         target = entries[0].strip()
         try:
-            idx = target.rfind(":")
-            if idx != -1:
+            count = len(target.split(":"))
+            if count == 2 or count == 9:
+                idx = target.rfind(":")
                 ip = target[:idx]
-                port = target[idx:]
+                port = target[idx+1:]
             else:
                 ip = target
                 port = "3260"
-- 
1.6.5.rc2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux