提交 30dcc3b7 编写于 作者: L Lukáš Doktor 提交者: Cleber Rosa

utils.partition: Use encoding instead of bytes

The mountpoints are user-facing values and should be reported decoded.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 6323ad5e
...@@ -109,9 +109,9 @@ class Partition(object): ...@@ -109,9 +109,9 @@ class Partition(object):
""" """
# list mounted file systems # list mounted file systems
devices = [line.split()[0] devices = [line.split()[0]
for line in process.system_output('mount').splitlines()] for line in process.getoutput('mount').splitlines()]
# list mounted swap devices # list mounted swap devices
swaps = process.system_output('swapon -s').splitlines() swaps = process.getoutput('swapon -s').splitlines()
devices.extend([line.split()[0] for line in swaps devices.extend([line.split()[0] for line in swaps
if line.startswith('/')]) if line.startswith('/')])
return devices return devices
...@@ -122,7 +122,7 @@ class Partition(object): ...@@ -122,7 +122,7 @@ class Partition(object):
Lists the mount points. Lists the mount points.
""" """
return [line.split()[2] return [line.split()[2]
for line in process.system_output('mount').splitlines()] for line in process.getoutput('mount').splitlines()]
def get_mountpoint(self, filename=None): def get_mountpoint(self, filename=None):
""" """
...@@ -254,7 +254,7 @@ class Partition(object): ...@@ -254,7 +254,7 @@ class Partition(object):
# Try to kill all pids # Try to kill all pids
for pid in (line.split()[1] for line in out.splitlines()[1:]): for pid in (line.split()[1] for line in out.splitlines()[1:]):
try: try:
process.system("kill -9 %s" % pid, ignore_status=True, process.system("kill -9 %d" % int(pid), ignore_status=True,
sudo=True) sudo=True)
except OSError: except OSError:
pass pass
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册