Commit 9aa4974d authored by Marco Mariani's avatar Marco Mariani

slapconfiguration.jsondump: added O_TRUNC to fix rewrites with a shorter file

parent d354e98f
...@@ -171,7 +171,7 @@ class JsonDump(Recipe): ...@@ -171,7 +171,7 @@ class JsonDump(Recipe):
def __init__(self, buildout, name, options): def __init__(self, buildout, name, options):
parameter_dict = self.fetch_parameter_dict(options) parameter_dict = self.fetch_parameter_dict(options)
self._json_output = options['json-output'] self._json_output = options['json-output']
with os.fdopen(os.open(self._json_output, os.O_WRONLY | os.O_CREAT, 0600), 'w') as fout: with os.fdopen(os.open(self._json_output, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0600), 'w') as fout:
fout.write(json.dumps(parameter_dict, indent=2, sort_keys=True)) fout.write(json.dumps(parameter_dict, indent=2, sort_keys=True))
def install(self): def install(self):
......
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