[node-patches] Change in ovirt-node[master]: Extend system.Filesystem.mountpoints

rbarry at redhat.com rbarry at redhat.com
Fri Nov 7 04:02:07 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Extend system.Filesystem.mountpoints
......................................................................

Extend system.Filesystem.mountpoints

Return an empty list instead of an exception if it's not mounted
anywhere. Clean up the splitting so we don't get empty Mount()
objects in the list

Change-Id: I805a53873ad92fdb5cb474ade8ace7697be7dcdd
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/utils/system.py
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/11/34911/1

diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 5955a8b..0d6a11d 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -846,9 +846,12 @@
         return self._tokens().get("LABEL", None)
 
     def mountpoints(self):
-        targets = process.check_output(["findmnt", "-o", "target", "-n",
-                                        self.device]).split("\n")
-        return [Mount(t.strip()) for t in targets]
+        try:
+            targets = process.check_output(["findmnt", "-o", "target", "-n",
+                                            self.device]).strip().split("\n")
+            return [Mount(t.strip()) for t in targets]
+        except process.CalledProcessError:
+            return []
 
 
 class Mount(base.Base):


-- 
To view, visit http://gerrit.ovirt.org/34911
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I805a53873ad92fdb5cb474ade8ace7697be7dcdd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list