+class AddonCommand(object):
Just curious... why not subclass pykickstart.base.KickstartCommand?
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 5ceaf19..b93be56 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1431,7 +1431,27 @@ class AnacondaKSHandler(superclass):
classes = collect(module_name, path, lambda cls: issubclass(cls,
self.AddonClassType))
if classes:
- addons[addon_id] = classes[0](name = addon_id)
+ addon_class = classes[0]
+
+ # create data structure
+ addons[addon_id] = addon_class(name = addon_id)
+ for commandName, commandClass in addon_class.COMMAND_MAP.iteritems():
+ # check for conflicts
+ if commandName in self.commands:
+ raise KeyError("Trying to override kickstart command
%s" % commandName)
+
+ # register all commands
+ cmdObj = commandClass(commandName = commandName, data =
addons[addon_id])
+ self.commands[commandName] = cmdObj
+
+ # Also, add the object into the _writeOrder dict in the right
place.
+ if cmdObj.writePriority is not None:
+ if not self._writeOrder.has_key(cmdObj.writePriority):
+ self._writeOrder[cmdObj.writePriority] = [cmdObj]
+ else:
+ self._writeOrder[cmdObj.writePriority].append(cmdObj)
+
+
# Prepare the structure to track configured spokes
self.configured_spokes = SpokeRegistry()
And then here, it seems like an awful lot of duplication of what
pykickstart is already doing. You could build up a dict and pass it to
_registerCommands, or at least use _setCommand. You don't know what
else I'll need to do in pykickstart in the future.
- Chris