Log the output of mkfs (#769928)
This commit is contained in:
parent
084e0e032b
commit
92a145dd18
@ -24,6 +24,7 @@ import os, tempfile
|
|||||||
from os.path import join, dirname
|
from os.path import join, dirname
|
||||||
from pylorax.sysutils import cpfile
|
from pylorax.sysutils import cpfile
|
||||||
from subprocess import *
|
from subprocess import *
|
||||||
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
######## Functions for making container images (cpio, squashfs) ##########
|
######## Functions for making container images (cpio, squashfs) ##########
|
||||||
@ -267,8 +268,13 @@ def mkfsimage(fstype, rootdir, outfile, size=None, mkfsargs=[], mountargs="", gr
|
|||||||
if not size:
|
if not size:
|
||||||
size = estimate_size(rootdir, graft, fstype)
|
size = estimate_size(rootdir, graft, fstype)
|
||||||
with LoopDev(outfile, size) as loopdev:
|
with LoopDev(outfile, size) as loopdev:
|
||||||
check_call(["mkfs.%s" % fstype] + mkfsargs + [loopdev],
|
try:
|
||||||
stdout=PIPE, stderr=PIPE)
|
check_output(["mkfs.%s" % fstype] + mkfsargs + [loopdev])
|
||||||
|
except CalledProcessError as e:
|
||||||
|
logger.error("mkfs exited with a non-zero return code: %d" % e.returncode)
|
||||||
|
logger.error(e.output)
|
||||||
|
sys.exit(e.returncode)
|
||||||
|
|
||||||
with Mount(loopdev, mountargs) as mnt:
|
with Mount(loopdev, mountargs) as mnt:
|
||||||
if rootdir:
|
if rootdir:
|
||||||
copytree(rootdir, mnt, preserve)
|
copytree(rootdir, mnt, preserve)
|
||||||
|
Loading…
Reference in New Issue
Block a user