From a9e04cc7ee472112259eb0868c43d118c2f09a92 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 8 Aug 2008 15:57:41 -0400 Subject: Fix LVM error handling so the exceptions actually get into the namespace. --- errors.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'errors.py') diff --git a/errors.py b/errors.py index b0f663c4d..e7bc3ce5f 100644 --- a/errors.py +++ b/errors.py @@ -24,7 +24,8 @@ # import string -from lvm import output +import os +from constants import lvmErrorOutput """Exceptions for use in lvm operations.""" @@ -36,7 +37,9 @@ class LvmError(Exception): self.log = self.getLvmOutput() def getLvmOutput(self): - f = open(output, "r") + if not os.access(lvmErrorOutput, os.R_OK): + return "" + f = open(lvmErrorOutput, "r") lines = reduce(lambda x,y: x + [string.strip(y),], f.readlines(), []) lines = string.join(reduce(lambda x,y: x + [" %s" % (y,)], \ lines, []), "\n") -- cgit