提交 0fdb1db6 编写于 作者: C Cleber Rosa

avocado/utils/lv_utils.py: syntatic only change in favor of system_output()

avocado.utils.process.system_output() is a utility function that has the
goal of returning the process output only.  Let's use it instead when
that's the only goal of the calling code.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 2f368a60
......@@ -157,7 +157,7 @@ def vg_ramdisk_cleanup(ramdisk_filename=None, vg_ramdisk_dir=None,
errs = []
if vg_name is not None:
loop_device = re.search(r"([/\w-]+) +%s +lvm2" % vg_name,
process.run("pvs", sudo=True).stdout)
process.system_output("pvs", sudo=True))
if loop_device is not None:
loop_device = loop_device.group(1)
process.run("vgremove -f %s" %
......@@ -170,10 +170,10 @@ def vg_ramdisk_cleanup(ramdisk_filename=None, vg_ramdisk_dir=None,
errs.append("wipe pv")
LOGGER.error("Failed to wipe pv from %s: %s", loop_device, result)
if loop_device in process.run("losetup --all").stdout:
if loop_device in process.system_output("losetup --all"):
ramdisk_filename = re.search(r"%s: \[\d+\]:\d+ \(([/\w]+)\)" %
loop_device,
process.run("losetup --all").stdout)
process.system_output("losetup --all"))
if ramdisk_filename is not None:
ramdisk_filename = ramdisk_filename.group(1)
......@@ -487,7 +487,7 @@ def lv_revert(vg_name, lv_name, lv_snapshot_name):
# detect if merge of snapshot was postponed
# and attempt to reactivate the volume.
active_lv_pattern = re.escape("%s [active]" % lv_snapshot_name)
lvdisplay_output = process.run("lvdisplay", sudo=True).stdout
lvdisplay_output = process.system_output("lvdisplay", sudo=True)
if ('Snapshot could not be found' in ex and
re.search(active_lv_pattern, lvdisplay_output) or
"The Logical volume %s is still active" % lv_name in ex):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册