Commit 8223760b authored by Jelte Jansen's avatar Jelte Jansen
Browse files

need deepcopy() instead of shallow copy() for reverting to older data when new...

need deepcopy() instead of shallow copy() for reverting to older data when new config is not accepted


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1186 e5f2f494-b856-4b98-b285-d166d9295462
parent 51ef32bb
......@@ -24,6 +24,7 @@ import signal
import ast
import pprint
import os
import copy
from isc.cc import data
class ConfigManagerDataReadError(Exception):
......@@ -237,6 +238,7 @@ class ConfigManager:
return isc.config.ccsession.create_answer(1, "Wrong number of arguments")
if len(cmd) == 2:
# todo: use api (and check the data against the definition?)
old_data = copy.deepcopy(self.config.data)
module_name = cmd[0]
conf_part = data.find_no_exc(self.config.data, module_name)
if conf_part:
......@@ -256,9 +258,10 @@ class ConfigManager:
rcode, val = isc.config.ccsession.parse_answer(answer)
if rcode == 0:
self.write_config()
else:
self.config.data = old_data
elif len(cmd) == 1:
# todo: use api (and check the data against the definition?)
old_data = self.config.data.copy()
old_data = copy.deepcopy(self.config.data)
data.merge(self.config.data, cmd[0])
# send out changed info
got_error = False
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment