kickstart: add an alias for installerfw
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 8 Aug 2013 12:01:59 +0000 (15:01 +0300)
committerGerrit Code Review <gerrit2@otctools.jf.intel.com>
Wed, 14 Aug 2013 06:49:24 +0000 (23:49 -0700)
In commit "d52080c kickstart: add the installerfw KS command" we introduced the
"installerfw" option. However, the later feed-back was that the name is very
confusing and non-intuitive, and we agreed to re-name this option to
"installerfw_plugins". With this name it is more obvious that this command
enables a list of plugins.

The name of the "extlinux" option of this command was also criticized, and we
agreed to rename it to more generic "bootloader" name.

We agreed that we do the following.

1. Add "installerfw_plugins" alias for "installerfw"
2. Add "bootloader" alias for "extlinux"
3. When users use the old "installerfw" and "extlinux" names, accept this,
   but print a warning which says that these obsolete names will be removed in
   future releases
4. Remove the old keywords later, after a couple releases.

This patch implements just that - introduces the aliases, prints warnings, makes
sure that internally we only use the new names, amends commentaries.

Base on suggestions and the initial patch from Alexander Kanevskiy.

Change-Id: I4646d437833f5252061cb963385269dc240f5792
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
mic/imager/raw.py
mic/kickstart/__init__.py
mic/kickstart/custom_commands/installerfw.py

index d10d59a..d9ec54a 100644 (file)
@@ -56,7 +56,7 @@ class RawImageCreator(BaseImageCreator):
         self.appliance_release = None
         self.compress_image = compress_image
         self.bmap_needed = generate_bmap
-        self._need_extlinux = not kickstart.use_installerfw(self.ks, "extlinux")
+        self._need_extlinux = not kickstart.use_installerfw(self.ks, "bootloader")
         #self.getsource = False
         #self.listpkg = False
 
index f9a5334..392a05e 100644 (file)
@@ -102,6 +102,7 @@ def read_kickstart(path):
     commandMap[using_version]["part"] = partition.Mic_Partition
     commandMap[using_version]["partition"] = partition.Mic_Partition
     commandMap[using_version]["installerfw"] = installerfw.Mic_installerfw
+    commandMap[using_version]["installerfw_plugins"] = installerfw.Mic_installerfw
     dataMap[using_version]["RepoData"] = micrepo.Mic_RepoData
     dataMap[using_version]["PartData"] = partition.Mic_PartData
     superclass = ksversion.returnClassForVersion(version=using_version)
index 2466f1d..1f4b5e7 100644 (file)
 
 from pykickstart.base import *
 from pykickstart.options import *
+from mic import msger
 
 class Mic_installerfw(KickstartCommand):
-    """ This class implements the "installerfw" KS option. The argument
+    """ This class implements the "installerfw_plugins" KS option. The argument
     of the option is a comman-separated list of MIC features which have to be
     disabled and instead, will be done in the installer. For example,
-    "installerfw=extlinux" disables all the MIC code which installs extlinux to
-    the target images, and instead, the extlinux or whatever boot-loader will
-    be installed by the installer instead.
+    "installerfw_plugins=bootloader" disables all the MIC code which installs
+    the bootloader to the target images, and instead, the bootlodaer will be
+    installed by the installer framework plugin.
 
-    The installer is a tool which is external to MIC, it comes from the
+    The plugin is a program which is external to MIC, it comes from the
     installation repositories and can be executed by MIC in order to perform
     various configuration actions. The main point here is to make sure MIC has
     no hard-wired knoledge about the target OS configuration. """
@@ -37,13 +38,12 @@ class Mic_installerfw(KickstartCommand):
     def __init__(self, *args, **kwargs):
         KickstartCommand.__init__(self, *args, **kwargs)
         self.op = self._getParser()
-        self.features = kwargs.get("installerfw", None)
 
     def __str__(self):
         retval = KickstartCommand.__str__(self)
 
         if self.features:
-            retval += "# Enable installer framework features\ninstallerfw\n"
+            retval += "# Enable installer framework plugins\ninstallerfw_plugins\n"
 
         return retval
 
@@ -52,12 +52,26 @@ class Mic_installerfw(KickstartCommand):
         return op
 
     def parse(self, args):
+        if self.currentCmd == "installerfw":
+            msger.warning("please, use 'installerfw_plugins' instead of " \
+                          "'installerfw', the latter is obsolete and will be " \
+                          "removed in future releases")
+
         (_, extra) = self.op.parse_args(args=args, lineno=self.lineno)
 
         if len(extra) != 1:
-            msg = "Kickstart command \"installerfw\" requires one " \
-                  "argumet - a list of legacy features to disable"
+            msg = "Kickstart command \"%s\" requires one " \
+                  "argumet - a list of legacy features to disable" % self.currentCmd
             raise KickstartValueError, formatErrorMsg(self.lineno, msg = msg)
 
         self.features = extra[0].split(",")
+
+        if "extlinux" in self.features:
+            msger.warning("please, use 'bootloader' installer framework " \
+                          "plugin name instead of 'extlinux', the latter " \
+                          "is obsolete and will be removed in future releases")
+            # Rename all occurances of "extlinux" to "bootloader"
+            self.reatures = [ "bootloader" if x == "extlinux" else x
+                              for x in self.features ]
+
         return self