ccsession.py 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. # Copyright (C) 2009 Internet Systems Consortium.
  2. #
  3. # Permission to use, copy, modify, and distribute this software for any
  4. # purpose with or without fee is hereby granted, provided that the above
  5. # copyright notice and this permission notice appear in all copies.
  6. #
  7. # THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
  8. # DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
  9. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  10. # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
  11. # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
  12. # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  13. # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  14. # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. #
  16. # Client-side functionality for configuration and commands
  17. #
  18. # It keeps a cc-channel session with the configuration manager daemon,
  19. # and handles configuration updates and direct commands
  20. # modeled after ccsession.h/cc 'protocol' changes here need to be
  21. # made there as well
  22. """Classes and functions for handling configuration and commands
  23. This module provides the ModuleCCSession and UIModuleCCSession
  24. classes, as well as a set of utility functions to create and parse
  25. messages related to commands and configuration
  26. Modules should use the ModuleCCSession class to connect to the
  27. configuration manager, and receive updates and commands from
  28. other modules.
  29. Configuration user interfaces should use the UIModuleCCSession
  30. to connect to b10-cmdctl, and receive and send configuration and
  31. commands through that to the configuration manager.
  32. """
  33. from isc.cc import Session
  34. from isc.config.config_data import ConfigData, MultiConfigData, BIND10_CONFIG_DATA_VERSION
  35. import isc
  36. from isc.util.file import path_search
  37. import bind10_config
  38. from isc.log import log_config_update
  39. import json
  40. from config_messages import *
  41. logger = isc.log.Logger("config")
  42. class ModuleCCSessionError(Exception): pass
  43. def parse_answer(msg):
  44. """Returns a tuple (rcode, value), where value depends on the
  45. command that was called. If rcode != 0, value is a string
  46. containing an error message"""
  47. if type(msg) != dict:
  48. raise ModuleCCSessionError("Answer message is not a dict: " + str(msg))
  49. if 'result' not in msg:
  50. raise ModuleCCSessionError("answer message does not contain 'result' element")
  51. elif type(msg['result']) != list:
  52. raise ModuleCCSessionError("wrong result type in answer message")
  53. elif len(msg['result']) < 1:
  54. raise ModuleCCSessionError("empty result list in answer message")
  55. elif type(msg['result'][0]) != int:
  56. raise ModuleCCSessionError("wrong rcode type in answer message")
  57. else:
  58. if len(msg['result']) > 1:
  59. if (msg['result'][0] != 0 and type(msg['result'][1]) != str):
  60. raise ModuleCCSessionError("rcode in answer message is non-zero, value is not a string")
  61. return msg['result'][0], msg['result'][1]
  62. else:
  63. return msg['result'][0], None
  64. def create_answer(rcode, arg = None):
  65. """Creates an answer packet for config&commands. rcode must be an
  66. integer. If rcode == 0, arg is an optional value that depends
  67. on what the command or option was. If rcode != 0, arg must be
  68. a string containing an error message"""
  69. if type(rcode) != int:
  70. raise ModuleCCSessionError("rcode in create_answer() must be an integer")
  71. if rcode != 0 and type(arg) != str:
  72. raise ModuleCCSessionError("arg in create_answer for rcode != 0 must be a string describing the error")
  73. if arg != None:
  74. return { 'result': [ rcode, arg ] }
  75. else:
  76. return { 'result': [ rcode ] }
  77. # 'fixed' commands
  78. """Fixed names for command and configuration messages"""
  79. COMMAND_CONFIG_UPDATE = "config_update"
  80. COMMAND_MODULE_SPECIFICATION_UPDATE = "module_specification_update"
  81. COMMAND_GET_COMMANDS_SPEC = "get_commands_spec"
  82. COMMAND_GET_STATISTICS_SPEC = "get_statistics_spec"
  83. COMMAND_GET_CONFIG = "get_config"
  84. COMMAND_SET_CONFIG = "set_config"
  85. COMMAND_GET_MODULE_SPEC = "get_module_spec"
  86. COMMAND_MODULE_SPEC = "module_spec"
  87. COMMAND_SHUTDOWN = "shutdown"
  88. def parse_command(msg):
  89. """Parses what may be a command message. If it looks like one,
  90. the function returns (command, value) where command is a
  91. string. If it is not, this function returns None, None"""
  92. if type(msg) == dict and len(msg.items()) == 1:
  93. cmd, value = msg.popitem()
  94. if cmd == "command" and type(value) == list:
  95. if len(value) == 1 and type(value[0]) == str:
  96. return value[0], None
  97. elif len(value) > 1 and type(value[0]) == str:
  98. return value[0], value[1]
  99. return None, None
  100. def create_command(command_name, params = None):
  101. """Creates a module command message with the given command name (as
  102. specified in the module's specification, and an optional params
  103. object"""
  104. # TODO: validate_command with spec
  105. if type(command_name) != str:
  106. raise ModuleCCSessionError("command in create_command() not a string")
  107. cmd = [ command_name ]
  108. if params:
  109. cmd.append(params)
  110. msg = { 'command': cmd }
  111. return msg
  112. def default_logconfig_handler(new_config, config_data):
  113. errors = []
  114. if config_data.get_module_spec().validate_config(False, new_config, errors):
  115. isc.log.log_config_update(json.dumps(new_config),
  116. json.dumps(config_data.get_module_spec().get_full_spec()))
  117. else:
  118. logger.error(CONFIG_LOG_CONFIG_ERRORS, errors)
  119. class ModuleCCSession(ConfigData):
  120. """This class maintains a connection to the command channel, as
  121. well as configuration options for modules. The module provides
  122. a specification file that contains the module name, configuration
  123. options, and commands. It also gives the ModuleCCSession two callback
  124. functions, one to call when there is a direct command to the
  125. module, and one to update the configuration run-time. These
  126. callbacks are called when 'check_command' is called on the
  127. ModuleCCSession"""
  128. def __init__(self, spec_file_name, config_handler, command_handler, cc_session=None, handle_logging_config=True):
  129. """Initialize a ModuleCCSession. This does *NOT* send the
  130. specification and request the configuration yet. Use start()
  131. for that once the ModuleCCSession has been initialized.
  132. specfile_name is the path to the specification file.
  133. config_handler and command_handler are callback functions,
  134. see set_config_handler and set_command_handler for more
  135. information on their signatures.
  136. cc_session can be used to pass in an existing CCSession,
  137. if it is None, one will be set up. This is mainly intended
  138. for testing purposes.
  139. handle_logging_config: if True, the module session will
  140. automatically handle logging configuration for the module;
  141. it will read the system-wide Logging configuration and call
  142. the logger manager to apply it. It will also inform the
  143. logger manager when the logging configuration gets updated.
  144. The module does not need to do anything except intializing
  145. its loggers, and provide log messages. Defaults to true.
  146. """
  147. module_spec = isc.config.module_spec_from_file(spec_file_name)
  148. ConfigData.__init__(self, module_spec)
  149. self._module_name = module_spec.get_module_name()
  150. self.set_config_handler(config_handler)
  151. self.set_command_handler(command_handler)
  152. if not cc_session:
  153. self._session = Session()
  154. else:
  155. self._session = cc_session
  156. self._session.group_subscribe(self._module_name, "*")
  157. self._remote_module_configs = {}
  158. self._remote_module_callbacks = {}
  159. if handle_logging_config:
  160. self.add_remote_config(path_search('logging.spec', bind10_config.PLUGIN_PATHS),
  161. default_logconfig_handler)
  162. def __del__(self):
  163. # If the CC Session obejct has been closed, it returns
  164. # immediately.
  165. if self._session._closed: return
  166. self._session.group_unsubscribe(self._module_name, "*")
  167. for module_name in self._remote_module_configs:
  168. self._session.group_unsubscribe(module_name)
  169. def start(self):
  170. """Send the specification for this module to the configuration
  171. manager, and request the current non-default configuration.
  172. The config_handler will be called with that configuration"""
  173. self.__send_spec()
  174. self.__request_config()
  175. def get_socket(self):
  176. """Returns the socket from the command channel session. This
  177. should *only* be used for select() loops to see if there
  178. is anything on the channel. If that loop is not completely
  179. time-critical, it is strongly recommended to only use
  180. check_command(), and not look at the socket at all."""
  181. return self._session._socket
  182. def close(self):
  183. """Close the session to the command channel"""
  184. self._session.close()
  185. def check_command(self, nonblock=True):
  186. """Check whether there is a command or configuration update on
  187. the channel. This function does a read on the cc session, and
  188. returns nothing.
  189. It calls check_command_without_recvmsg()
  190. to parse the received message.
  191. If nonblock is True, it just checks if there's a command
  192. and does nothing if there isn't. If nonblock is False, it
  193. waits until it arrives. It temporarily sets timeout to infinity,
  194. because commands may not come in arbitrary long time."""
  195. timeout_orig = self._session.get_timeout()
  196. self._session.set_timeout(0)
  197. try:
  198. msg, env = self._session.group_recvmsg(nonblock)
  199. finally:
  200. self._session.set_timeout(timeout_orig)
  201. self.check_command_without_recvmsg(msg, env)
  202. def check_command_without_recvmsg(self, msg, env):
  203. """Parse the given message to see if there is a command or a
  204. configuration update. Calls the corresponding handler
  205. functions if present. Responds on the channel if the
  206. handler returns a message."""
  207. # should we default to an answer? success-by-default? unhandled error?
  208. if msg is not None and not 'result' in msg:
  209. answer = None
  210. try:
  211. module_name = env['group']
  212. cmd, arg = isc.config.ccsession.parse_command(msg)
  213. if cmd == COMMAND_CONFIG_UPDATE:
  214. new_config = arg
  215. # If the target channel was not this module
  216. # it might be in the remote_module_configs
  217. if module_name != self._module_name:
  218. if module_name in self._remote_module_configs:
  219. # no checking for validity, that's up to the
  220. # module itself.
  221. newc = self._remote_module_configs[module_name].get_local_config()
  222. isc.cc.data.merge(newc, new_config)
  223. self._remote_module_configs[module_name].set_local_config(newc)
  224. if self._remote_module_callbacks[module_name] != None:
  225. self._remote_module_callbacks[module_name](new_config,
  226. self._remote_module_configs[module_name])
  227. # For other modules, we're not supposed to answer
  228. return
  229. # ok, so apparently this update is for us.
  230. errors = []
  231. if not self._config_handler:
  232. answer = create_answer(2, self._module_name + " has no config handler")
  233. elif not self.get_module_spec().validate_config(False, new_config, errors):
  234. answer = create_answer(1, ", ".join(errors))
  235. else:
  236. isc.cc.data.remove_identical(new_config, self.get_local_config())
  237. answer = self._config_handler(new_config)
  238. rcode, val = parse_answer(answer)
  239. if rcode == 0:
  240. newc = self.get_local_config()
  241. isc.cc.data.merge(newc, new_config)
  242. self.set_local_config(newc)
  243. else:
  244. # ignore commands for 'remote' modules
  245. if module_name == self._module_name:
  246. if self._command_handler:
  247. answer = self._command_handler(cmd, arg)
  248. else:
  249. answer = create_answer(2, self._module_name + " has no command handler")
  250. except Exception as exc:
  251. answer = create_answer(1, str(exc))
  252. if answer:
  253. self._session.group_reply(env, answer)
  254. def set_config_handler(self, config_handler):
  255. """Set the config handler for this module. The handler is a
  256. function that takes the full configuration and handles it.
  257. It should return an answer created with create_answer()"""
  258. self._config_handler = config_handler
  259. # should we run this right now since we've changed the handler?
  260. def set_command_handler(self, command_handler):
  261. """Set the command handler for this module. The handler is a
  262. function that takes a command as defined in the .spec file
  263. and return an answer created with create_answer()"""
  264. self._command_handler = command_handler
  265. def add_remote_config(self, spec_file_name, config_update_callback = None):
  266. """Gives access to the configuration of a different module.
  267. These remote module options can at this moment only be
  268. accessed through get_remote_config_value(). This function
  269. also subscribes to the channel of the remote module name
  270. to receive the relevant updates. It is not possible to
  271. specify your own handler for this right now.
  272. start() must have been called on this CCSession
  273. prior to the call to this method.
  274. Returns the name of the module."""
  275. module_spec = isc.config.module_spec_from_file(spec_file_name)
  276. module_cfg = ConfigData(module_spec)
  277. module_name = module_spec.get_module_name()
  278. self._session.group_subscribe(module_name)
  279. # Get the current config for that module now
  280. seq = self._session.group_sendmsg(create_command(COMMAND_GET_CONFIG, { "module_name": module_name }), "ConfigManager")
  281. try:
  282. answer, env = self._session.group_recvmsg(False, seq)
  283. except isc.cc.SessionTimeout:
  284. raise ModuleCCSessionError("No answer from ConfigManager when "
  285. "asking about Remote module " +
  286. module_name)
  287. if answer:
  288. rcode, value = parse_answer(answer)
  289. if rcode == 0:
  290. if value != None and module_spec.validate_config(False, value):
  291. module_cfg.set_local_config(value)
  292. if config_update_callback is not None:
  293. config_update_callback(value, module_cfg)
  294. # all done, add it
  295. self._remote_module_configs[module_name] = module_cfg
  296. self._remote_module_callbacks[module_name] = config_update_callback
  297. return module_name
  298. def remove_remote_config(self, module_name):
  299. """Removes the remote configuration access for this module"""
  300. if module_name in self._remote_module_configs:
  301. self._session.group_unsubscribe(module_name)
  302. del self._remote_module_configs[module_name]
  303. del self._remote_module_callbacks[module_name]
  304. def get_remote_config_value(self, module_name, identifier):
  305. """Returns the current setting for the given identifier at the
  306. given module. If the module has not been added with
  307. add_remote_config, a ModuleCCSessionError is raised"""
  308. if module_name in self._remote_module_configs:
  309. return self._remote_module_configs[module_name].get_value(identifier)
  310. else:
  311. raise ModuleCCSessionError("Remote module " + module_name +
  312. " not found")
  313. def __send_spec(self):
  314. """Sends the data specification to the configuration manager"""
  315. msg = create_command(COMMAND_MODULE_SPEC, self.get_module_spec().get_full_spec())
  316. seq = self._session.group_sendmsg(msg, "ConfigManager")
  317. try:
  318. answer, env = self._session.group_recvmsg(False, seq)
  319. except isc.cc.SessionTimeout:
  320. # TODO: log an error?
  321. pass
  322. def __request_config(self):
  323. """Asks the configuration manager for the current configuration, and call the config handler if set.
  324. Raises a ModuleCCSessionError if there is no answer from the configuration manager"""
  325. seq = self._session.group_sendmsg(create_command(COMMAND_GET_CONFIG, { "module_name": self._module_name }), "ConfigManager")
  326. try:
  327. answer, env = self._session.group_recvmsg(False, seq)
  328. if answer:
  329. rcode, value = parse_answer(answer)
  330. if rcode == 0:
  331. errors = []
  332. if value != None:
  333. if self.get_module_spec().validate_config(False,
  334. value,
  335. errors):
  336. self.set_local_config(value)
  337. if self._config_handler:
  338. self._config_handler(value)
  339. else:
  340. raise ModuleCCSessionError(
  341. "Wrong data in configuration: " +
  342. " ".join(errors))
  343. else:
  344. logger.error(CONFIG_GET_FAILED, value)
  345. else:
  346. raise ModuleCCSessionError("No answer from configuration manager")
  347. except isc.cc.SessionTimeout:
  348. raise ModuleCCSessionError("CC Session timeout waiting for configuration manager")
  349. class UIModuleCCSession(MultiConfigData):
  350. """This class is used in a configuration user interface. It contains
  351. specific functions for getting, displaying, and sending
  352. configuration settings through the b10-cmdctl module."""
  353. def __init__(self, conn):
  354. """Initialize a UIModuleCCSession. The conn object that is
  355. passed must have send_GET and send_POST functions"""
  356. MultiConfigData.__init__(self)
  357. self._conn = conn
  358. self.request_specifications()
  359. self.request_current_config()
  360. def request_specifications(self):
  361. """Request the module specifications from b10-cmdctl"""
  362. # this step should be unnecessary but is the current way cmdctl returns stuff
  363. # so changes are needed there to make this clean (we need a command to simply get the
  364. # full specs for everything, including commands etc, not separate gets for that)
  365. specs = self._conn.send_GET('/module_spec')
  366. for module in specs.keys():
  367. self.set_specification(isc.config.ModuleSpec(specs[module]))
  368. def update_specs_and_config(self):
  369. self.request_specifications()
  370. self.request_current_config()
  371. def request_current_config(self):
  372. """Requests the current configuration from the configuration
  373. manager through b10-cmdctl, and stores those as CURRENT"""
  374. config = self._conn.send_GET('/config_data')
  375. if 'version' not in config or config['version'] != BIND10_CONFIG_DATA_VERSION:
  376. raise ModuleCCSessionError("Bad config version")
  377. self._set_current_config(config)
  378. def _add_value_to_list(self, identifier, value, module_spec):
  379. cur_list, status = self.get_value(identifier)
  380. if not cur_list:
  381. cur_list = []
  382. if value is None:
  383. if "item_default" in module_spec["list_item_spec"]:
  384. value = module_spec["list_item_spec"]["item_default"]
  385. if value is None:
  386. raise isc.cc.data.DataNotFoundError(
  387. "No value given and no default for " + str(identifier))
  388. if value not in cur_list:
  389. cur_list.append(value)
  390. self.set_value(identifier, cur_list)
  391. else:
  392. raise isc.cc.data.DataAlreadyPresentError(value +
  393. " already in "
  394. + identifier)
  395. def _add_value_to_named_set(self, identifier, value, item_value):
  396. if type(value) != str:
  397. raise isc.cc.data.DataTypeError("Name for named_set " +
  398. identifier +
  399. " must be a string")
  400. # fail on both None and empty string
  401. if not value:
  402. raise isc.cc.data.DataNotFoundError(
  403. "Need a name to add a new item to named_set " +
  404. str(identifier))
  405. else:
  406. cur_map, status = self.get_value(identifier)
  407. if not cur_map:
  408. cur_map = {}
  409. if value not in cur_map:
  410. cur_map[value] = item_value
  411. self.set_value(identifier, cur_map)
  412. else:
  413. raise isc.cc.data.DataAlreadyPresentError(value +
  414. " already in "
  415. + identifier)
  416. def add_value(self, identifier, value_str = None, set_value_str = None):
  417. """Add a value to a configuration list. Raises a DataTypeError
  418. if the value does not conform to the list_item_spec field
  419. of the module config data specification. If value_str is
  420. not given, we add the default as specified by the .spec
  421. file. Raises a DataNotFoundError if the given identifier
  422. is not specified in the specification as a map or list.
  423. Raises a DataAlreadyPresentError if the specified element
  424. already exists."""
  425. module_spec = self.find_spec_part(identifier)
  426. if module_spec is None:
  427. raise isc.cc.data.DataNotFoundError("Unknown item " + str(identifier))
  428. # the specified element must be a list or a named_set
  429. if 'list_item_spec' in module_spec:
  430. value = None
  431. # in lists, we might get the value with spaces, making it
  432. # the third argument. In that case we interpret both as
  433. # one big string meant as the value
  434. if value_str is not None:
  435. if set_value_str is not None:
  436. value_str += set_value_str
  437. value = isc.cc.data.parse_value_str(value_str)
  438. self._add_value_to_list(identifier, value, module_spec)
  439. elif 'named_set_item_spec' in module_spec:
  440. item_name = None
  441. item_value = None
  442. if value_str is not None:
  443. item_name = isc.cc.data.parse_value_str(value_str)
  444. if set_value_str is not None:
  445. item_value = isc.cc.data.parse_value_str(set_value_str)
  446. else:
  447. if 'item_default' in module_spec['named_set_item_spec']:
  448. item_value = module_spec['named_set_item_spec']['item_default']
  449. self._add_value_to_named_set(identifier, item_name,
  450. item_value)
  451. else:
  452. raise isc.cc.data.DataNotFoundError(str(identifier) + " is not a list or a named set")
  453. def _remove_value_from_list(self, identifier, value):
  454. if value is None:
  455. # we are directly removing an list index
  456. id, list_indices = isc.cc.data.split_identifier_list_indices(identifier)
  457. if list_indices is None:
  458. raise DataTypeError("identifier in remove_value() does not contain a list index, and no value to remove")
  459. else:
  460. self.set_value(identifier, None)
  461. else:
  462. cur_list, status = self.get_value(identifier)
  463. if not cur_list:
  464. cur_list = []
  465. elif value in cur_list:
  466. cur_list.remove(value)
  467. self.set_value(identifier, cur_list)
  468. def _remove_value_from_named_set(self, identifier, value):
  469. if value is None:
  470. raise isc.cc.data.DataNotFoundError("Need a name to remove an item from named_set " + str(identifier))
  471. elif type(value) != str:
  472. raise isc.cc.data.DataTypeError("Name for named_set " + identifier + " must be a string")
  473. else:
  474. cur_map, status = self.get_value(identifier)
  475. if not cur_map:
  476. cur_map = {}
  477. if value in cur_map:
  478. del cur_map[value]
  479. else:
  480. raise isc.cc.data.DataNotFoundError(value + " not found in named_set " + str(identifier))
  481. def remove_value(self, identifier, value_str):
  482. """Remove a value from a configuration list or named set.
  483. The value string must be a string representation of the full
  484. item. Raises a DataTypeError if the value at the identifier
  485. is not a list, or if the given value_str does not match the
  486. list_item_spec """
  487. module_spec = self.find_spec_part(identifier)
  488. if module_spec is None:
  489. raise isc.cc.data.DataNotFoundError("Unknown item " + str(identifier))
  490. value = None
  491. if value_str is not None:
  492. value = isc.cc.data.parse_value_str(value_str)
  493. if 'list_item_spec' in module_spec:
  494. if value is not None:
  495. isc.config.config_data.check_type(module_spec['list_item_spec'], value)
  496. self._remove_value_from_list(identifier, value)
  497. elif 'named_set_item_spec' in module_spec:
  498. self._remove_value_from_named_set(identifier, value)
  499. else:
  500. raise isc.cc.data.DataNotFoundError(str(identifier) + " is not a list or a named_set")
  501. def commit(self):
  502. """Commit all local changes, send them through b10-cmdctl to
  503. the configuration manager"""
  504. if self.get_local_changes():
  505. response = self._conn.send_POST('/ConfigManager/set_config',
  506. [ self.get_local_changes() ])
  507. answer = isc.cc.data.parse_value_str(response.read().decode())
  508. # answer is either an empty dict (on success), or one
  509. # containing errors
  510. if answer == {}:
  511. self.request_current_config()
  512. self.clear_local_changes()
  513. elif "error" in answer:
  514. raise ModuleCCSessionError("Error: " + str(answer["error"]) + "\n" + "Configuration not committed")
  515. else:
  516. raise ModuleCCSessionError("Unknown format of answer in commit(): " + str(answer))