Do not overwrite initial-config IOU if client send an empty

Fix #140
This commit is contained in:
Julien Duponchelle committed 2015-04-06 21:30:57 +02:00
1 parent d16a389d1f
commit 7efb7c2978
2 files changed
+18 -1

No files matched your search

+6 -1
View File
@@ -952,8 +952,13 @@ class IOUVM(BaseVM):
try:
script_file = os.path.join(self.working_dir, "initial-config.cfg")
# We disallow erasing the initial config file
if len(initial_config) == 0 and os.path.exists(script_file):
return
with open(script_file, 'w+') as f:
if initial_config is None:
if len(initial_config) == 0:
f.write('')
else:
initial_config = initial_config.replace("%h", self._name)