Commit d2231b8c authored by Iustin Pop's avatar Iustin Pop
Browse files

Change behaviour of ConfigWriter._WriteConfig

This patch changes the behaviour of _WriteConfig in case of
configuration errors:

- before, it used to abort the saving (even though the in-memory
  configuration used by current jobs has already changed)
- now, we log it (both to the log and to the user) but continue, since
  we can't revert to a good version of the config anyway

This should make the internal behaviour of the code more consistent with
the external world, even though the config might be “wrong”; we leave
the cleanup to the user. This should not be as bad as it sounds, since
we haven't actually seen this case except for the ugly master candidates
handling, and that was fixed recently by Guido's patch series.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 679008e7
......@@ -1195,15 +1195,23 @@ class ConfigWriter:
assert feedback_fn is None or callable(feedback_fn)
# first, cleanup the _temporary_ids set, if an ID is now in the
# First, cleanup the _temporary_ids set, if an ID is now in the
# other objects it should be discarded to prevent unbounded growth
# of that structure
# Warn on config errors, but don't abort the save - the
# configuration has already been modified, and we can't revert;
# the best we can do is to warn the user and save as is, leaving
# recovery to the user
config_errors = self._UnlockedVerifyConfig()
if config_errors:
raise errors.ConfigurationError("Configuration data is not"
" consistent: %s" %
(", ".join(config_errors)))
errmsg = ("Configuration data is not consistent: %s" %
(", ".join(config_errors)))
if feedback_fn:
if destination is None:
destination = self._cfg_file
Markdown is supported
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