Browse Source

Fix the bug report by ticket 92: bindctl can't all available modules.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac127@2263 e5f2f494-b856-4b98-b285-d166d9295462
Likun Zhang 15 years ago
parent
commit
77fcdf53d3
1 changed files with 14 additions and 4 deletions
  1. 14 4
      src/bin/bindctl/bindcmd.py

+ 14 - 4
src/bin/bindctl/bindcmd.py

@@ -113,9 +113,6 @@ class BindCmdInterpreter(Cmd):
             if not self.login_to_cmdctl():
                 return False
 
-            # Get all module information from cmd-ctrld
-            self.config_data = isc.config.UIModuleCCSession(self)
-            self._update_commands()
             self.cmdloop()
         except KeyboardInterrupt:
             return True
@@ -226,7 +223,19 @@ class BindCmdInterpreter(Cmd):
         headers = {"cookie" : self.session_id}
         self.conn.request('POST', url, param, headers)
         return self.conn.getresponse()
-        
+
+    def _update_all_modules_info(self):
+        ''' Get all modules' information from cmdctl, including
+        specification file and configuration data. This function
+        should be called before interpreting command line or complete-key
+        is entered. This may not be the best way to keep bindctl
+        and cmdctl share same modules information, but it works.'''
+        self.config_data = isc.config.UIModuleCCSession(self)
+        self._update_commands()
+
+    def precmd(self, line):
+        self._update_all_modules_info()
+        return line 
 
     def postcmd(self, stop, line):
         '''Update the prompt after every command'''
@@ -371,6 +380,7 @@ class BindCmdInterpreter(Cmd):
 
     def complete(self, text, state):
         if 0 == state:
+            self._update_all_modules_info()
             text = text.strip()
             hints = []
             cur_line = my_readline()