[pykickstart PATCH 1/2] Modify keyboard command to handle multiple layouts

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

 



We want to let the user to set up multiple keyboard layouts but
in the same time we want to preserve backwards compatibility.
---
 pykickstart/commands/keyboard.py |   37 +++++++++++++++++++++++
 pykickstart/handlers/control.py  |   61 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/pykickstart/commands/keyboard.py b/pykickstart/commands/keyboard.py
index babc2ac..ed4d7f6 100644
--- a/pykickstart/commands/keyboard.py
+++ b/pykickstart/commands/keyboard.py
@@ -53,3 +53,40 @@ class FC3_Keyboard(KickstartCommand):
 
         self.keyboard = extra[0]
         return self
+
+class F18_Keyboard(FC3_Keyboard):
+    def __init__(self, writePriority=0, *args, **kwargs):
+        FC3_Keyboard.__init__(self, writePriority, *args, **kwargs)
+        self.op = self._getParser()
+        self.layouts_list = kwargs.get("layouts_list", [])
+
+    def __str__(self):
+        if not self.layouts_list:
+            return ""
+
+        retval = "# Keyboard layouts\nkeyboard"
+        for layout in self.layouts_list:
+            retval += " %s" % layout
+
+        return retval
+
+    def parse(self, args):
+        (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
+
+        if len(extra) < 1:
+            raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires at least"\
+                                                                         "one argument") % "keyboard")
+        self.layouts_list = extra
+        return self
+
+    @property
+    def keyboard(self):
+        if self.layouts_list:
+            return self.layouts_list[0]
+
+        else:
+            return ""
+
+    @keyboard.setter
+    def keyboard(self, value):
+        self.layouts_list = [value]
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 7901ce3..a4af58b 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -884,6 +884,67 @@ commandMap = {
         "zfcp": zfcp.F14_ZFCP,
     },
 
+    # based on f17
+    F18: {
+        "auth": authconfig.FC3_Authconfig,
+        "authconfig": authconfig.FC3_Authconfig,
+        "autopart": autopart.F17_AutoPart,
+        "autostep": autostep.FC3_AutoStep,
+        "bootloader": bootloader.F17_Bootloader,
+        "btrfs": btrfs.F17_BTRFS,
+        "cdrom": method.F14_Method,
+        "clearpart": clearpart.F17_ClearPart,
+        "cmdline": displaymode.FC3_DisplayMode,
+        "device": device.F8_Device,
+        "deviceprobe": deviceprobe.FC3_DeviceProbe,
+        "dmraid": dmraid.FC6_DmRaid,
+        "driverdisk": driverdisk.F14_DriverDisk,
+        "fcoe": fcoe.F13_Fcoe,
+        "firewall": firewall.F14_Firewall,
+        "firstboot": firstboot.FC3_Firstboot,
+        "graphical": displaymode.FC3_DisplayMode,
+        "group": group.F12_Group,
+        "halt": reboot.FC6_Reboot,
+        "harddrive": method.F14_Method,
+        "ignoredisk": ignoredisk.F14_IgnoreDisk,
+        "install": upgrade.F11_Upgrade,
+        "iscsi": iscsi.F17_Iscsi,
+        "iscsiname": iscsiname.FC6_IscsiName,
+        "keyboard": keyboard.F18_Keyboard,
+        "lang": lang.FC3_Lang,
+        "logging": logging.FC6_Logging,
+        "logvol": logvol.F17_LogVol,
+        "mediacheck": mediacheck.FC4_MediaCheck,
+        "monitor": monitor.F10_Monitor,
+        "multipath": multipath.FC6_MultiPath,
+        "network": network.F16_Network,
+        "nfs": method.F14_Method,
+        "part": partition.F17_Partition,
+        "partition": partition.F17_Partition,
+        "poweroff": reboot.FC6_Reboot,
+        "raid": raid.F15_Raid,
+        "reboot": reboot.FC6_Reboot,
+        "repo": repo.F15_Repo,
+        "rescue": rescue.F10_Rescue,
+        "rootpw": rootpw.F8_RootPw,
+        "selinux": selinux.FC3_SELinux,
+        "services": services.FC6_Services,
+        "shutdown": reboot.FC6_Reboot,
+        "skipx": skipx.FC3_SkipX,
+        "sshpw": sshpw.F13_SshPw,
+        "text": displaymode.FC3_DisplayMode,
+        "timezone": timezone.FC6_Timezone,
+        "updates": updates.F7_Updates,
+        "upgrade": upgrade.F11_Upgrade,
+        "url": method.F14_Method,
+        "user": user.F12_User,
+        "vnc": vnc.F9_Vnc,
+        "volgroup": volgroup.FC16_VolGroup,
+        "xconfig": xconfig.F14_XConfig,
+        "zerombr": zerombr.F9_ZeroMbr,
+        "zfcp": zfcp.F14_ZFCP,
+    },
+
     # based on fc1
     RHEL3: {
         "auth": authconfig.FC3_Authconfig,
-- 
1.7.4.4

_______________________________________________
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