[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 02/11] Device class does not have a path member



The generic createParents() method in the Device class reference path, but
path is not a member of Device (only of StorageDevice and derived classes).

This error was caught by pylint and chances are we will never hit it, still
it is better to fix it.

While at it also report which parent exaclt does not exist in the
exception message.
---
 storage/devices.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index d11fce5..2be684f 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -298,7 +298,9 @@ class Device(object):
         log.info("NOTE: recursive device creation disabled")
         for parent in self.parents:
             if not parent.exists:
-                raise DeviceError("parent device does not exist", self.path)
+                raise DeviceError("parent device %s does not exist" %
+                                  getattr(parent, "path", None),
+                                  getattr(self, "path", None))
             #parent.create()
 
     def dependsOn(self, dep):
-- 
1.6.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]