Fixing mounting of multiple sources to the same dest (#21413)

This commit is contained in:
Jiri Tyr 2017-02-14 17:09:48 +00:00 committed by Toshio Kuratomi
parent 8c6606aeee
commit 9008e8017b

View file

@ -454,11 +454,18 @@ def is_bind_mounted(module, linux_mounts, dest, src=None, fstype=None):
if get_platform() == 'Linux' and linux_mounts is not None:
if src is None:
# That's for unmounted/absent
if dest in linux_mounts:
is_mounted = True
for m in linux_mounts:
if m['dst'] == dest:
is_mounted = True
else:
mounted_src = None
for m in linux_mounts:
if m['dst'] == dest:
mounted_src = m['src']
# That's for mounted
if dest in linux_mounts and linux_mounts[dest]['src'] == src:
if mounted_src is not None and mounted_src == src:
is_mounted = True
else:
bin_path = module.get_bin_path('mount', required=True)
@ -518,7 +525,7 @@ def get_linux_mounts(module):
mntinfo.append(record)
mounts = {}
mounts = []
for mnt in mntinfo:
src = mnt['src']
@ -551,12 +558,15 @@ def get_linux_mounts(module):
break
mounts[mnt['dst']] = {
record = {
'dst': mnt['dst'],
'src': src,
'opts': mnt['opts'],
'fs': mnt['fs']
}
mounts.append(record)
return mounts