Chown doesn't work on mounted vfat.
As reported by a user. Resolves bug 1092560. Change-Id: I44c847d5e7f3242ca46a7436bcbc6e519baa88fc
This commit is contained in:
@@ -67,11 +67,9 @@ class ConfigDriveTestCase(test.TestCase):
|
|||||||
|
|
||||||
utils.mkfs('vfat', mox.IgnoreArg(),
|
utils.mkfs('vfat', mox.IgnoreArg(),
|
||||||
label='config-2').AndReturn(None)
|
label='config-2').AndReturn(None)
|
||||||
utils.trycmd('mount', '-o', 'loop', mox.IgnoreArg(),
|
utils.trycmd('mount', '-o', mox.IgnoreArg(), mox.IgnoreArg(),
|
||||||
mox.IgnoreArg(),
|
mox.IgnoreArg(),
|
||||||
run_as_root=True).AndReturn((None, None))
|
run_as_root=True).AndReturn((None, None))
|
||||||
utils.trycmd('chown', mox.IgnoreArg(), mox.IgnoreArg(),
|
|
||||||
run_as_root=True).AndReturn((None, None))
|
|
||||||
utils.execute('umount', mox.IgnoreArg(),
|
utils.execute('umount', mox.IgnoreArg(),
|
||||||
run_as_root=True).AndReturn(None)
|
run_as_root=True).AndReturn(None)
|
||||||
|
|
||||||
|
|||||||
@@ -129,20 +129,16 @@ class _ConfigDriveBuilder(object):
|
|||||||
try:
|
try:
|
||||||
mountdir = tempfile.mkdtemp(dir=CONF.config_drive_tempdir,
|
mountdir = tempfile.mkdtemp(dir=CONF.config_drive_tempdir,
|
||||||
prefix='cd_mnt_')
|
prefix='cd_mnt_')
|
||||||
_out, err = utils.trycmd('mount', '-o', 'loop', path, mountdir,
|
_out, err = utils.trycmd('mount', '-o',
|
||||||
|
'loop,uid=%d,gid=%d' % (os.getuid(),
|
||||||
|
os.getgid()),
|
||||||
|
path, mountdir,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
if err:
|
if err:
|
||||||
raise exception.ConfigDriveMountFailed(operation='mount',
|
raise exception.ConfigDriveMountFailed(operation='mount',
|
||||||
error=err)
|
error=err)
|
||||||
mounted = True
|
mounted = True
|
||||||
|
|
||||||
_out, err = utils.trycmd('chown',
|
|
||||||
'%s.%s' % (os.getuid(), os.getgid()),
|
|
||||||
mountdir, run_as_root=True)
|
|
||||||
if err:
|
|
||||||
raise exception.ConfigDriveMountFailed(operation='chown',
|
|
||||||
error=err)
|
|
||||||
|
|
||||||
# NOTE(mikal): I can't just use shutils.copytree here, because the
|
# NOTE(mikal): I can't just use shutils.copytree here, because the
|
||||||
# destination directory already exists. This is annoying.
|
# destination directory already exists. This is annoying.
|
||||||
for ent in os.listdir(self.tempdir):
|
for ent in os.listdir(self.tempdir):
|
||||||
|
|||||||
Reference in New Issue
Block a user