mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 15:45:20 +01:00
Add mode option for mount module
This commit is contained in:
parent
6663bf535a
commit
d9f85d3ce8
1 changed files with 8 additions and 3 deletions
|
|
@ -827,13 +827,18 @@ def main():
|
||||||
if not (ex.errno == errno.EEXIST and os.path.isdir(b_curpath)):
|
if not (ex.errno == errno.EEXIST and os.path.isdir(b_curpath)):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if mode is not None:
|
|
||||||
os.chmod(name, int(mode))
|
|
||||||
|
|
||||||
except (OSError, IOError) as e:
|
except (OSError, IOError) as e:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Error making dir %s: %s" % (name, to_native(e)))
|
msg="Error making dir %s: %s" % (name, to_native(e)))
|
||||||
|
|
||||||
|
# Set permissions to the newly created mount point.
|
||||||
|
if mode is not None:
|
||||||
|
try:
|
||||||
|
changed = module.set_mode_if_different(name, mode, changed)
|
||||||
|
except Exception as e:
|
||||||
|
module.fail_json(
|
||||||
|
msg="Error setting permissions %s: %s" % (name, to_native(e)))
|
||||||
|
|
||||||
name, backup_lines, changed = _set_mount_save_old(module, args)
|
name, backup_lines, changed = _set_mount_save_old(module, args)
|
||||||
res = 0
|
res = 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue