Add mode option for mount module

This commit is contained in:
satken2 2021-06-14 21:06:59 +09:00
parent 6663bf535a
commit d9f85d3ce8

View file

@ -827,13 +827,18 @@ def main():
if not (ex.errno == errno.EEXIST and os.path.isdir(b_curpath)):
raise
if mode is not None:
os.chmod(name, int(mode))
except (OSError, IOError) as e:
module.fail_json(
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)
res = 0