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

PATCH: iscsi do missing value check only once



Hi all,

Currently the iscsi code checks for giving a password but not a username or
vica versa in both the interface and the iscsi code, this patch removes the
unneeded check from the interface code, this is a preparation patch for fixing
463156, 461830

Regards,

Hans

diff --git a/iscsi.py b/iscsi.py
index 6ff69f1..ec36b09 100644
--- a/iscsi.py
+++ b/iscsi.py
@@ -479,16 +479,16 @@ class iscsi(object):
         if user is not None or pw is not None:
             commentUser = ''
             if user is None:
-                raise ValueError, "user is required"
+                raise ValueError, _("CHAP username is required if CHAP password is defined.")
             if pw is None:
-                raise ValueError, "pw is required"
+                raise ValueError, _("CHAP password is required if CHAP username is defined.")
 
         if user_in is not None or pw_in is not None:
             commentUser_in = ''
             if user_in is None:
-                raise ValueError, "user_in is required"
+                raise ValueError, _("Reverse CHAP username is required if reverse CHAP password is defined.")
             if pw_in is None:
-                raise ValueError, "pw_in is required"
+                raise ValueError, _("Reverse CHAP password is required if reverse CHAP username is defined.")
 
         # If either a user/pw pair was specified or a user_in/pw_in was
         # specified, then CHAP is specified.
diff --git a/iw/autopart_type.py b/iw/autopart_type.py
index d745a1e..33efa5f 100644
--- a/iw/autopart_type.py
+++ b/iw/autopart_type.py
@@ -273,26 +273,6 @@ class PartitionTypeWindow(InstallWindow):
             if len(pw_in) == 0:
                 pw_in = None
 
-            if user is not None or pw is not None:
-                if user is None:
-                    self.intf.messageWindow(_("Missing value"),
-                        _("CHAP username is required if CHAP password is defined."))
-                    continue
-                if pw is None:
-                    self.intf.messageWindow(_("Missing value"),
-                        _("CHAP password is required if CHAP username is defined."))
-                    continue
-
-            if user_in is not None or pw_in is not None:
-                if user_in is None:
-                    self.intf.messageWindow(_("Missing value"),
-                        _("Reverse CHAP username is required if reverse CHAP password is defined."))
-                    continue
-                if pw_in is None:
-                    self.intf.messageWindow(_("Missing value"),
-                        _("Reverse CHAP password is required if reverse CHAP username is defined."))
-                    continue
-
             err = None
             try:
                 idx = target.rfind(":")
@@ -311,8 +291,12 @@ class PartitionTypeWindow(InstallWindow):
                 self.intf.messageWindow(_("Error with Data"), "%s" %(err,))
                 continue
 
-            self.anaconda.id.iscsi.addTarget(ip, port, user, pw, user_in, pw_in,
-                                             self.intf)
+            try:
+                self.anaconda.id.iscsi.addTarget(ip, port, user, pw, user_in, pw_in,
+                                                 self.intf)
+            except ValueError, e:
+                self.intf.messageWindow(_("Error"), str(e))
+                continue
             break
 
         dialog.destroy()
diff --git a/textw/partition_text.py b/textw/partition_text.py
index 0c4bd77..83638d0 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -1706,24 +1706,6 @@ class PartitionTypeWindow:
         if len(pw_in) == 0:
             pw_in = None
 
-        if user is not None or pw is not None:
-            if user is None:
-                ButtonChoiceWindow(screen, _("Missing value"),
-                    _("Username is required when password is present."))
-            if pw is None:
-                ButtonChoiceWindow(screen, _("Missing value"),
-                    _("Password is required when username is present."))
-
-        if user_in is not None or pw_in is not None:
-            if user_in is None:
-                ButtonChoiceWindow(screen, _("Missing value"),
-                                   _("Reverse username is required when"
-                                     "reverse password is present."))
-            if pw_in is None:
-                ButtonChoiceWindow(screen, _("Missing value"),
-                                   _("Reverse password is required when"
-                                     "reverse username is present."))
-
         target = entries[0].strip()
         try:
             idx = target.rfind(":")


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