diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-11-17 17:45:43 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-11-17 17:45:43 +0000 |
commit | edd18a77973d8cd12b09bc6e3ac06fecd72a7e45 (patch) | |
tree | 802046a1b53941cb15e325dd9685745aed4a0163 /baserockimport/mainloop.py | |
parent | 86487edbf05f712bf6b351ae639cd10bcf87ba63 (diff) | |
parent | 80c60bf65cf0dda67e959d4d2ffc51e1c6cb94f8 (diff) | |
download | import-edd18a77973d8cd12b09bc6e3ac06fecd72a7e45.tar.gz |
Merge branch 'sam/post-review-changes'
Thanks to Richard Maw for finding most of these issues.
Diffstat (limited to 'baserockimport/mainloop.py')
-rw-r--r-- | baserockimport/mainloop.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/baserockimport/mainloop.py b/baserockimport/mainloop.py index 345e45e..99fb8d2 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 @@ -574,7 +571,6 @@ class ImportLoop(object): 'chunks': chunk_entries, } - morphology = self.morphloader.load_from_string( - json.dumps(stratum), filename=filename) - self.morphloader.unset_defaults(morphology) + morphology = self.morphology.Morphology(stratum) + morphology.filename = filename self.morphloader.save_to_file(filename, morphology) |