Fix errant changelog entries when executing a script without committing

This commit is contained in:
Jeremy Stretch
2019-08-26 11:59:38 -04:00
parent 6a8f256a56
commit 9a9660a765
3 changed files with 40 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ from ipam.formfields import IPFormField
from utilities.exceptions import AbortTransaction
from .constants import LOG_DEFAULT, LOG_FAILURE, LOG_INFO, LOG_SUCCESS, LOG_WARNING
from .forms import ScriptForm
from .signals import purge_changelog
__all__ = [
@@ -310,6 +311,8 @@ def run_script(script, data, files, commit=True):
commit = False
finally:
if not commit:
# Delete all pending changelog entries
purge_changelog.send(Script)
script.log_info(
"Database changes have been reverted automatically."
)