summaryrefslogtreecommitdiff
path: root/baserockimport/mainloop.py
diff options
context:
space:
mode:
Diffstat (limited to 'baserockimport/mainloop.py')
-rw-r--r--baserockimport/mainloop.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/baserockimport/mainloop.py b/baserockimport/mainloop.py
index 345e45e..a84d547 100644
--- a/baserockimport/mainloop.py
+++ b/baserockimport/mainloop.py
@@ -327,17 +327,14 @@ class ImportLoop(object):
return lorry
def _run_lorry(self, lorry):
- f = tempfile.NamedTemporaryFile(delete=False)
- try:
+ with tempfile.NamedTemporaryFile() as f:
logging.debug(json.dumps(lorry))
json.dump(lorry, f)
- f.close()
+ f.flush()
cliapp.runcmd([
'lorry', '--working-area',
self.app.settings['lorry-working-dir'], '--pull-only',
'--bundle', 'never', '--tarball', 'never', f.name])
- finally:
- os.unlink(f.name)
def _fetch_or_update_source(self, lorry):
assert len(lorry) == 1