Parcourir la source

fix; only initialize fully if it hasn't been done yet, otherwise only update the specifications and the configuration as known by the manager, not the local changes

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac285@2440 e5f2f494-b856-4b98-b285-d166d9295462
Jelte Jansen il y a 15 ans
Parent
commit
a8bd18ab0b
2 fichiers modifiés avec 11 ajouts et 2 suppressions
  1. 6 2
      src/bin/bindctl/bindcmd.py
  2. 5 0
      src/lib/python/isc/config/ccsession.py

+ 6 - 2
src/bin/bindctl/bindcmd.py

@@ -102,7 +102,8 @@ class BindCmdInterpreter(Cmd):
         self.conn = ValidatedHTTPSConnection(self.server_port,
         self.conn = ValidatedHTTPSConnection(self.server_port,
                                              ca_certs=pem_file)
                                              ca_certs=pem_file)
         self.session_id = self._get_session_id()
         self.session_id = self._get_session_id()
-
+        self.config_data = None
+        
     def _get_session_id(self):
     def _get_session_id(self):
         '''Generate one session id for the connection. '''
         '''Generate one session id for the connection. '''
         rand = os.urandom(16)
         rand = os.urandom(16)
@@ -252,7 +253,10 @@ class BindCmdInterpreter(Cmd):
         should be called before interpreting command line or complete-key
         should be called before interpreting command line or complete-key
         is entered. This may not be the best way to keep bindctl
         is entered. This may not be the best way to keep bindctl
         and cmdctl share same modules information, but it works.'''
         and cmdctl share same modules information, but it works.'''
-        self.config_data = isc.config.UIModuleCCSession(self)
+        if self.config_data is not None:
+            self.config_data.update_specs_and_config()
+        else:
+            self.config_data = isc.config.UIModuleCCSession(self)
         self._update_commands()
         self._update_commands()
 
 
     def precmd(self, line):
     def precmd(self, line):

+ 5 - 0
src/lib/python/isc/config/ccsession.py

@@ -323,6 +323,10 @@ class UIModuleCCSession(MultiConfigData):
         for module in specs.keys():
         for module in specs.keys():
             self.set_specification(isc.config.ModuleSpec(specs[module]))
             self.set_specification(isc.config.ModuleSpec(specs[module]))
 
 
+    def update_specs_and_config(self):
+        self.request_specifications();
+        self.request_current_config();
+
     def request_current_config(self):
     def request_current_config(self):
         """Requests the current configuration from the configuration
         """Requests the current configuration from the configuration
            manager through b10-cmdctl, and stores those as CURRENT"""
            manager through b10-cmdctl, and stores those as CURRENT"""
@@ -331,6 +335,7 @@ class UIModuleCCSession(MultiConfigData):
             raise ModuleCCSessionError("Bad config version")
             raise ModuleCCSessionError("Bad config version")
         self._set_current_config(config)
         self._set_current_config(config)
 
 
+
     def add_value(self, identifier, value_str):
     def add_value(self, identifier, value_str):
         """Add a value to a configuration list. Raises a DataTypeError
         """Add a value to a configuration list. Raises a DataTypeError
            if the value does not conform to the list_item_spec field
            if the value does not conform to the list_item_spec field