From c54c9fdc083fdb8d7f903d264d1b842230afe0b6 Mon Sep 17 00:00:00 2001 From: Marco Mariani Date: Fri, 16 May 2014 14:40:08 +0200 Subject: [PATCH] generatepassword recipe: added missing O_TRUNC --- slapos/recipe/generatepassword.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slapos/recipe/generatepassword.py b/slapos/recipe/generatepassword.py index 3cb83ee..1d362a6 100644 --- a/slapos/recipe/generatepassword.py +++ b/slapos/recipe/generatepassword.py @@ -60,7 +60,7 @@ class Recipe(object): try: with open(self.storage_path) as f: passwd = f.read() - except IOError, e: + except IOError as e: if e.errno != errno.ENOENT: raise passwd = None @@ -79,11 +79,11 @@ class Recipe(object): if self.storage_path: try: os.unlink(self.storage_path) - except OSError, e: + except OSError as e: if e.errno != errno.ENOENT: raise fd = os.open(self.storage_path, - os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0600) + os.O_CREAT | os.O_EXCL | os.O_WRONLY | os.O_TRUNC, 0600) try: os.write(fd, self.passwd) finally: -- 2.1.4