Browse Source

merged branches/trac285 (ticket #285, config set command doesn't work anymore)

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2452 e5f2f494-b856-4b98-b285-d166d9295462
Jelte Jansen 15 years ago
parent
commit
5e1e8cd224
3 changed files with 16 additions and 2 deletions
  1. 5 0
      ChangeLog
  2. 6 2
      src/bin/bindctl/bindcmd.py
  3. 5 0
      src/lib/python/isc/config/ccsession.py

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+  73.	[bug]		jelte
+  	Fixed a bug where in bindctl, locally changed settings were
+	reset when the list of running modules is updated. (Trac #285,
+	r2452)
+
   72.	[build]		jinmei
   72.	[build]		jinmei
 	Added -R when linking python wrapper modules to libpython when
 	Added -R when linking python wrapper modules to libpython when
 	possible.  This helps build BIND 10 on platforms that install
 	possible.  This helps build BIND 10 on platforms that install

+ 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