ansible-modules-core #530 fix - Mount module does not accept spaces in mount point path
This commit is contained in:
parent
170457413d
commit
aa99eade7e
1 changed files with 14 additions and 2 deletions
|
@ -114,6 +114,11 @@ def set_mount(**kwargs):
|
||||||
)
|
)
|
||||||
args.update(kwargs)
|
args.update(kwargs)
|
||||||
|
|
||||||
|
# save the mount name before space replacement
|
||||||
|
origname = args['name']
|
||||||
|
# replace any space in mount name with '\040' to make it fstab compatible (man fstab)
|
||||||
|
args['name'] = args['name'].replace(' ', r'\040')
|
||||||
|
|
||||||
new_line = '%(src)s %(name)s %(fstype)s %(opts)s %(dump)s %(passno)s\n'
|
new_line = '%(src)s %(name)s %(fstype)s %(opts)s %(dump)s %(passno)s\n'
|
||||||
|
|
||||||
to_write = []
|
to_write = []
|
||||||
|
@ -158,7 +163,8 @@ def set_mount(**kwargs):
|
||||||
if changed:
|
if changed:
|
||||||
write_fstab(to_write, args['fstab'])
|
write_fstab(to_write, args['fstab'])
|
||||||
|
|
||||||
return (args['name'], changed)
|
# mount function needs origname
|
||||||
|
return (origname, changed)
|
||||||
|
|
||||||
|
|
||||||
def unset_mount(**kwargs):
|
def unset_mount(**kwargs):
|
||||||
|
@ -173,6 +179,11 @@ def unset_mount(**kwargs):
|
||||||
)
|
)
|
||||||
args.update(kwargs)
|
args.update(kwargs)
|
||||||
|
|
||||||
|
# save the mount name before space replacement
|
||||||
|
origname = args['name']
|
||||||
|
# replace any space in mount name with '\040' to make it fstab compatible (man fstab)
|
||||||
|
args['name'] = args['name'].replace(' ', r'\040')
|
||||||
|
|
||||||
to_write = []
|
to_write = []
|
||||||
changed = False
|
changed = False
|
||||||
for line in open(args['fstab'], 'r').readlines():
|
for line in open(args['fstab'], 'r').readlines():
|
||||||
|
@ -201,7 +212,8 @@ def unset_mount(**kwargs):
|
||||||
if changed:
|
if changed:
|
||||||
write_fstab(to_write, args['fstab'])
|
write_fstab(to_write, args['fstab'])
|
||||||
|
|
||||||
return (args['name'], changed)
|
# umount needs origname
|
||||||
|
return (origname, changed)
|
||||||
|
|
||||||
|
|
||||||
def mount(module, **kwargs):
|
def mount(module, **kwargs):
|
||||||
|
|
Loading…
Add table
Reference in a new issue