[PATCH] Initialize cmd.handler earlier; fixes repo.methodToRepo()

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

 



FC8_Repo.methodToRepo() references self.handler.method
which, since a commands "handler" attribute is only
initialized by BaseHandler.dispatcher(), means that a "repo"
command must have been parsed before methodToRepo() is
called.

Clearly this is an invalid assumption - a kickstart may not
contain any "repo" commands if e.g. it only has a "url"
command.

Fix this by making a commands "handler" attribute be
initialized as soon as the command is registered during the
BaseHandler constructor.

Signed-off-by: Mark McLoughlin <markmc@xxxxxxxxxx>
---
 pykickstart/base.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pykickstart/base.py b/pykickstart/base.py
index 54ce86d..26e8d58 100644
--- a/pykickstart/base.py
+++ b/pykickstart/base.py
@@ -302,6 +302,7 @@ class BaseHandler:
 
             # Finally, add the mapping to the commands dict.
             self.commands[cmdName] = cmdObj
+            self.commands[cmdName].handler = self
 
         # We also need to create attributes for the various data objects.
         # No checks here because dMap is a bijection.  At least, that's what
@@ -323,7 +324,6 @@ class BaseHandler:
         elif self.commands[cmd] != None:
             self.commands[cmd].currentCmd = cmd
             self.commands[cmd].currentLine = self.currentLine
-            self.commands[cmd].handler = self
             self.commands[cmd].lineno = lineno
             self.commands[cmd].parse(args[1:])
 
-- 
1.5.4.5

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux