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

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

 



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 |   52 +++++++++++++++++++++++++++++++++++++++
 pykickstart/handlers/control.py |    8 +++---
 2 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py
index e2a3101..6ba1a2d 100644
--- a/pykickstart/commands/network.py
+++ b/pykickstart/commands/network.py
@@ -140,6 +140,18 @@ class F8_NetworkData(FC6_NetworkData):
 
         return retval
 
+class F15_NetworkData(F8_NetworkData):
+    removedKeywords = F8_NetworkData.removedKeywords
+    removedAttrs = F8_NetworkData.removedAttrs
+
+    def _getArgsAsStr(self):
+        retval = F8_NetworkData._getArgsAsStr(self)
+
+        if self.activate:
+            retval += " --activate"
+
+        return retval
+
 class RHEL4_NetworkData(FC3_NetworkData):
     removedKeywords = FC3_NetworkData.removedKeywords
     removedAttrs = FC3_NetworkData.removedAttrs
@@ -156,6 +168,18 @@ class RHEL4_NetworkData(FC3_NetworkData):
 
         return retval
 
+class RHEL6_NetworkData(F8_NetworkData):
+    removedKeywords = F8_NetworkData.removedKeywords
+    removedAttrs = F8_NetworkData.removedAttrs
+
+    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
@@ -263,6 +287,20 @@ class F9_Network(F8_Network):
                       choices=self.bootprotoList)
         return op
 
+class F15_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
+
 class RHEL4_Network(FC3_Network):
     removedKeywords = FC3_Network.removedKeywords
     removedAttrs = FC3_Network.removedAttrs
@@ -287,3 +325,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 90aa89e..29a9248 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -735,7 +735,7 @@ commandMap = {
         "mediacheck": mediacheck.FC4_MediaCheck,
         "monitor": monitor.F10_Monitor,
         "multipath": multipath.FC6_MultiPath,
-        "network": network.F9_Network,
+        "network": network.F15_Network,
         "nfs": method.F14_Method,
         "part": partition.F14_Partition,
         "partition": partition.F14_Partition,
@@ -955,7 +955,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,
@@ -1167,7 +1167,7 @@ dataMap = {
         "IscsiData": iscsi.F10_IscsiData,
         "LogVolData": logvol.F15_LogVolData,
         "MultiPathData": multipath.FC6_MultiPathData,
-        "NetworkData": network.F8_NetworkData,
+        "NetworkData": network.F15_NetworkData,
         "PartData": partition.F14_PartData,
         "RaidData": raid.F15_RaidData,
         "RepoData": repo.F15_RepoData,
@@ -1217,7 +1217,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

_______________________________________________
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