Use of proper fstab file on FreeBSD
This commit is contained in:
parent
a657e80bc8
commit
6e4c5e0a12
1 changed files with 19 additions and 3 deletions
|
@ -226,13 +226,29 @@ def unset_mount(**kwargs):
|
||||||
|
|
||||||
def mount(module, **kwargs):
|
def mount(module, **kwargs):
|
||||||
""" mount up a path or remount if needed """
|
""" mount up a path or remount if needed """
|
||||||
|
|
||||||
|
# kwargs: name, src, fstype, opts, dump, passno, state, fstab=/etc/fstab
|
||||||
|
args = dict(
|
||||||
|
opts = 'default',
|
||||||
|
dump = '0',
|
||||||
|
passno = '0',
|
||||||
|
fstab = '/etc/fstab'
|
||||||
|
)
|
||||||
|
args.update(kwargs)
|
||||||
|
|
||||||
mount_bin = module.get_bin_path('mount')
|
mount_bin = module.get_bin_path('mount')
|
||||||
|
|
||||||
name = kwargs['name']
|
name = kwargs['name']
|
||||||
|
|
||||||
|
cmd = [ mount_bin, ]
|
||||||
|
|
||||||
if os.path.ismount(name):
|
if os.path.ismount(name):
|
||||||
cmd = [ mount_bin , '-o', 'remount', name ]
|
cmd += [ '-o', 'remount', ]
|
||||||
else:
|
|
||||||
cmd = [ mount_bin, name ]
|
if get_platform().lower() == 'freebsd':
|
||||||
|
cmd += [ '-F', args['fstab'], ]
|
||||||
|
|
||||||
|
cmd += [ name, ]
|
||||||
|
|
||||||
rc, out, err = module.run_command(cmd)
|
rc, out, err = module.run_command(cmd)
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
|
|
Loading…
Reference in a new issue