[PATCH rhel6 pykickstart] Add network --activate option (#638131)

[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.

Note: I am using flag option instead of option with (yes/no) values
because the point of the option is allowing device activation.
Moreover we can't guarantee honoring of "no" setting in these two cases:
1) --onboot=yes activates device as side effect when we write out
ifcfg files before packages are downloaded.
2) If there is no active device and network method (repo) is used,
first device in ks will be activated.

If/when acked, I'd duplicate the bug for pykickstart so we can track
pykickstart build the bug is fixed in.

---
 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 2d4b11f..a90c262 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.F13_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.F13_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