Fixed pylint errors in sysutils.py
This commit is contained in:
parent
5a3ff79726
commit
ea6139f125
@ -44,7 +44,7 @@ def joinpaths(*args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
def touch(fname):
|
def touch(fname):
|
||||||
with open(fname, "w") as fobj:
|
with open(fname, "w") as _:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -88,17 +88,17 @@ def chmod_(path, mode, recursive=False):
|
|||||||
|
|
||||||
def create_loop_dev(fname):
|
def create_loop_dev(fname):
|
||||||
cmd = ["losetup", "-f"]
|
cmd = ["losetup", "-f"]
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
rc = p.wait()
|
retcode = proc.wait()
|
||||||
if not rc == 0:
|
if not retcode == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
loopdev = p.stdout.read().strip()
|
loopdev = proc.stdout.read().strip()
|
||||||
|
|
||||||
cmd = ["losetup", loopdev, fname]
|
cmd = ["losetup", loopdev, fname]
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
rc = p.wait()
|
retcode = proc.wait()
|
||||||
if not rc == 0:
|
if not retcode == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return loopdev
|
return loopdev
|
||||||
@ -106,17 +106,17 @@ def create_loop_dev(fname):
|
|||||||
|
|
||||||
def remove_loop_dev(dev):
|
def remove_loop_dev(dev):
|
||||||
cmd = ["losetup", "-d", dev]
|
cmd = ["losetup", "-d", dev]
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
rc = p.wait()
|
return proc.wait()
|
||||||
|
|
||||||
|
|
||||||
def create_dm_dev(name, size, loopdev):
|
def create_dm_dev(name, size, loopdev):
|
||||||
table = '0 {0} linear {1} 0'.format(size, loopdev)
|
table = '0 {0} linear {1} 0'.format(size, loopdev)
|
||||||
|
|
||||||
cmd = ["dmsetup", "create", name, "--table", table]
|
cmd = ["dmsetup", "create", name, "--table", table]
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
rc = p.wait()
|
retcode = proc.wait()
|
||||||
if not rc == 0:
|
if not retcode == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return joinpaths("/dev/mapper", name)
|
return joinpaths("/dev/mapper", name)
|
||||||
@ -124,5 +124,5 @@ def create_dm_dev(name, size, loopdev):
|
|||||||
|
|
||||||
def remove_dm_dev(dev):
|
def remove_dm_dev(dev):
|
||||||
cmd = ["dmsetup", "remove", dev]
|
cmd = ["dmsetup", "remove", dev]
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
rc = p.wait()
|
return proc.wait()
|
||||||
|
Loading…
Reference in New Issue
Block a user