BIND 10 #2039: cfgmgr returns "success" to GET_MODULE_SPEC if the module is not found

BIND 10 Development do-not-reply at isc.org
Wed Jun 13 23:27:08 UTC 2012


#2039: cfgmgr returns "success" to GET_MODULE_SPEC if the module is not found
-------------------------------------+-------------------------------------
            Reporter:  jinmei        |                        Owner:
                Type:  defect        |                       Status:  new
            Priority:  medium        |                    Milestone:  Next-
           Component:  Inter-module  |  Sprint-Proposed
  communication                      |                     Keywords:
           Sensitive:  0             |              Defect Severity:  N/A
         Sub-Project:  Core          |  Feature Depending on Ticket:
Estimated Difficulty:  0             |          Add Hours to Ticket:  0
         Total Hours:  0             |                    Internal?:  0
-------------------------------------+-------------------------------------
 see its `__handle_get_module_spec` method:

 {{{#!python
                 if 'module_name' in cmd and cmd['module_name'] != '':
                     module_name = cmd['module_name']
                     spec = self.get_module_spec(cmd['module_name'])
                     if type(spec) != type({}):
                         # this is a ModuleSpec object.  Extract the
                         # internal spec.
                         spec = spec.get_full_spec()
                     answer = ccsession.create_answer(0, spec)
 }}}

 If get_module_spec cannot find the given name of module, it returns
 the code of 0 (success) with an empty dict.

 I don't know if it's the intended (or good) behavior, but at least it
 doesn't seem to be something different from what
 add_remote_config_by_name() expects.  It tries to construct
 `ModuleSpec` with whatever is returned by cfgmgr as long as the result
 code is 0:

 {{{#!python
             if rcode == 0:
                 module_spec = isc.config.module_spec.ModuleSpec(value)
                 if module_spec.get_module_name() != module_name:
                     raise ModuleCCSessionError("Module name mismatch: " +
                                                module_name + " and " +
 module_spec.get_module_name())
                 self._add_remote_config_internal(module_spec,
                                                  config_update_callback)

 }}}

 Then the constructor fails and raises an exception of
 `ModuleSpecError`, which will be propagated to the calling
 application.  I'd say it's quite surprising for the application, which
 would generally expect either success or getting
 `ModuleCCSessionError`.

 My first suggestion is to revise cfgmgr so it returns an error to
 GET_MODULE_SPEC if it cannot find the module.  The current behavior
 doesn't make sense to me at all because there shouldn't be any valid
 empty spec (there should be at least the module name).

 But if this behavior is really deemed to be reasonable, my second
 suggestion is to update add_remote_config_by_name() so it checks the
 returned spec and raises `ModuleCCSessionError` if it's empty.

 Having apps handle both exceptions just doesn't make sense to me.

-- 
Ticket URL: <http://bind10.isc.org/ticket/2039>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list