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

[PATCH 1/3 pykickstart] Add network --activate option (#638131)



So that we can activate more than one network device in installer
environment using kickstart.
The activating happens in loader (stage 2 is too late for iscsi).
---
 pykickstart/commands/network.py |   30 ++++++++++++++++++++++++++++++
 pykickstart/handlers/control.py |    4 ++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py
index e2a3101..b0a7026 100644
--- a/pykickstart/commands/network.py
+++ b/pykickstart/commands/network.py
@@ -156,6 +156,22 @@ class RHEL4_NetworkData(FC3_NetworkData):
 
         return retval
 
+class RHEL6_NetworkData(F8_NetworkData):
+    removedKeywords = F8_NetworkData.removedKeywords
+    removedAttrs = F8_NetworkData.removedAttrs
+
+    def __init__(self, *args, **kwargs):
+        F8_NetworkData.__init__(self, *args, **kwargs)
+        self.activate = kwargs.get("activate", False)
+
+    def _getArgsAsStr(self):
+        retval = F8_NetworkData._getArgsAsStr(self)
+
+        if self.activate:
+            retval += " --activate"
+
+        return retval
+
 class FC3_Network(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -287,3 +303,17 @@ class RHEL5_Network(FC6_Network):
                       default=BOOTPROTO_DHCP,
                       choices=self.bootprotoList)
         return op
+
+class RHEL6_Network(F9_Network):
+    removedKeywords = F9_Network.removedKeywords
+    removedAttrs = F9_Network.removedAttrs
+
+    def __init__(self, writePriority=0, *args, **kwargs):
+        F9_Network.__init__(self, writePriority, *args, **kwargs)
+        self.activate = kwargs.get("activate", False)
+
+    def _getParser(self):
+        op = F9_Network._getParser(self)
+        op.add_option("--activate", dest="activate", action="store_true",
+                      default=False)
+        return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index a3d9f1a..e89d10c 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -843,7 +843,7 @@ commandMap = {
         "mediacheck": mediacheck.FC4_MediaCheck,
         "monitor": monitor.F10_Monitor,
         "multipath": multipath.FC6_MultiPath,
-        "network": network.F9_Network,
+        "network": network.RHEL6_Network,
         "nfs": method.RHEL6_Method,
         "part": partition.F12_Partition,
         "partition": partition.F12_Partition,
@@ -1070,7 +1070,7 @@ dataMap = {
         "IscsiData": iscsi.F10_IscsiData,
         "LogVolData": logvol.F12_LogVolData,
         "MultiPathData": multipath.FC6_MultiPathData,
-        "NetworkData": network.F8_NetworkData,
+        "NetworkData": network.RHEL6_NetworkData,
         "PartData": partition.F12_PartData,
         "RaidData": raid.F13_RaidData,
         "RepoData": repo.RHEL6_RepoData,
-- 
1.7.2


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