[node-patches] Change in ovirt-node[master]: utils.system.LVM().vgs() should return [] if no volume groups

rbarry at redhat.com rbarry at redhat.com
Thu Jun 26 16:11:07 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: utils.system.LVM().vgs() should return [] if no volume groups
......................................................................

utils.system.LVM().vgs() should return [] if no volume groups

Return an empty list instead of "No volume groups found" if there
aren't any.

Change-Id: I3e79deb820557896d110bc1a406ec2ab49e9491b
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/99/29299/1

diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 7b771fc..42412f7 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -474,6 +474,7 @@
         """
         return int(self.version_major) > 0
 
+
 class Keyboard(base.Base):
     """Configure the system wide keyboard layout
     FIXME what is the recommended way to do this on F18+ with localectl
@@ -938,7 +939,8 @@
     """
 
     def vgs(self):
-        return self._query_lvm("vg_name")
+        return self._query_lvm("vg_name") if "No volume groups found" not in \
+            self._query_lvm("vg_name") else []
 
     class VG(base.Base):
         def __init__(self, name):
@@ -956,7 +958,8 @@
     def _query_lvm(self, option, pv=None):
         if pv:
             return [x.strip() for x in process.check_output(["lvm",
-                    "vgs", "--noheadings", "-o", option, pv]).split("\n")]
+                    "vgs", "--noheadings", "-o", option, pv]).strip().split(
+                    "\n")]
         else:
             return [x.strip() for x in process.check_output(["lvm",
-                    "vgs", "--noheadings", "-o", option]).split("\n")]
+                    "vgs", "--noheadings", "-o", option]).strip().split("\n")]


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e79deb820557896d110bc1a406ec2ab49e9491b
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