Skip to content

Commit

Permalink
Validate the changes applied through the nodemgr and svcmgr set/unset…
Browse files Browse the repository at this point in the history
… actions

Example:

$ ha1 set --kw fs#10.type=cni
aubergine.ha1           E fs#10.dev is mandatory
aubergine.ha1           E the change was not saved
  • Loading branch information
cvaroqui committed Sep 28, 2018
1 parent 40b85ce commit 4a3db2b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/extconfig.py
Expand Up @@ -1158,6 +1158,10 @@ def _write_cf(self, buff):
with codecs.open(fpath, "w", "utf8") as ofile:
ofile.write(buff)
ofile.flush()
report = self._validate_config(fpath)
if report["errors"]:
os.unlink(fpath)
raise ex.excError("the change was not saved")
shutil.move(fpath, self.paths.cf)

def print_config_data(self, src_config=None, evaluate=False, impersonate=None):
Expand Down

0 comments on commit 4a3db2b

Please sign in to comment.