Add some useful debug logging info to various functions in
pylorax.imgutils.
---
src/pylorax/imgutils.py | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
@@ -106,24 +110,32 @@ def mount(dev, opts="", mnt=None):
raises CalledProcessError if mount fails.'
if mnt is None:
mnt = tempfile.mkdtemp(prefix="lorax.imgutils.")
+ logger.debug("make tmp mountdir %s", mnt)
mount = ["mount"]
if opts:
mount += ["-o", opts]
- check_call(mount + [dev, mnt])
+ mount += [dev, mnt]
+ logger.debug(" ".join(mount))
+ check_call(mount)
return mnt
def umount(mnt):
'Unmount the given mountpoint. If the mount was a temporary dir created
by mount, it will be deleted. Returns false if the unmount fails.'
- rv = call(["umount", mnt])
+ umount = ["umount"]
+ umount += [mnt]
+ logger.debug(" ".join(umount))
+ rv = call(umount)
if 'lorax.imgutils' in mnt:
os.rmdir(mnt)
+ logger.debug("remove tmp mountdir %s", mnt)
return (rv == 0)
def copytree(src, dest, preserve=True):
'Copy a tree of files using cp -a, thus preserving modes, timestamps,
links, acls, sparse files, xattrs, selinux contexts, etc.
If preserve is False, uses cp -R (useful for modeless filesystems)'
+ logger.debug("copytree %s %s", src, dest)
chdir = lambda: os.chdir(src)
cp = ["cp", "-a"] if preserve else ["cp", "-R", "-L"]
check_call(cp + [".", os.path.abspath(dest)], preexec_fn=chdir)
--
1.7.10.2
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list