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

[master 1/3] Simplify the way we hook to the iscsi kickstart command parsing.



more precisely: override execute() of the command or data, not parse().
---
 pyanaconda/kickstart.py |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index bc1d8b6..7e5480c 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -382,25 +382,21 @@ class IgnoreDisk(commands.ignoredisk.RHEL6_IgnoreDisk):
         if not self.interactive:
             anaconda.ksdata.skipSteps.extend(["filter", "filtertype"])
 
-class Iscsi(commands.iscsi.F10_Iscsi):
-    def parse(self, args):
-        tg = commands.iscsi.F10_Iscsi.parse(self, args)
-
+class IscsiData(commands.iscsi.F10_IscsiData):
+    def execute(self, anaconda):
         try:
-            storage.iscsi.iscsi().addTarget(tg.ipaddr, tg.port,
-                tg.user, tg.password, tg.user_in, tg.password_in)
-            log.info("added iscsi target: %s" %(tg.ipaddr,))
+            storage.iscsi.iscsi().addTarget(self.ipaddr, self.port,
+                                            self.user, self.password, 
+                                            self.user_in, self.password_in,
+                                            anaconda.intf)
+            log.info("added iscsi target: %s" %(self.ipaddr,))
         except (IOError, ValueError), e:
             raise KickstartValueError, formatErrorMsg(self.lineno,
                                                       msg=str(e))
-        return tg
 
 class IscsiName(commands.iscsiname.FC6_IscsiName):
-    def parse(self, args):
-        retval = commands.iscsiname.FC6_IscsiName.parse(self, args)
-
+    def execute(self, anaconda):
         storage.iscsi.iscsi().initiator = self.iscsiname
-        return retval
 
 class Keyboard(commands.keyboard.FC3_Keyboard):
     def execute(self, anaconda):
@@ -1092,7 +1088,6 @@ commandMap = {
         "halt": Reboot,
         "ignoredisk": IgnoreDisk,
         "install": Upgrade,
-        "iscsi": Iscsi,
         "iscsiname": IscsiName,
         "keyboard": Keyboard,
         "lang": Lang,
@@ -1111,6 +1106,7 @@ commandMap = {
 }
 
 dataMap = {
+        "IscsiData" : IscsiData,
         "LogVolData": LogVolData,
         "NetworkData": NetworkData,
         "PartData": PartitionData,
-- 
1.7.1.1


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