mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-02 11:22:47 +00:00
execute the mount after path validation
This avoids a stale situation where name/path contains some impossible path, but gets configured (faultly) in fstab, and the module only fails after that, when creating that path.
This commit is contained in:
@@ -307,7 +307,6 @@ def main():
|
||||
module.exit_json(changed=changed, **args)
|
||||
|
||||
if state in ['mounted', 'present']:
|
||||
name, changed = set_mount(**args)
|
||||
if state == 'mounted':
|
||||
if not os.path.exists(name):
|
||||
try:
|
||||
@@ -315,6 +314,8 @@ def main():
|
||||
except (OSError, IOError), e:
|
||||
module.fail_json(msg="Error making dir %s: %s" % (name, str(e)))
|
||||
|
||||
name, changed = set_mount(**args)
|
||||
if state == 'mounted':
|
||||
res = 0
|
||||
if os.path.ismount(name):
|
||||
if changed:
|
||||
|
||||
Reference in New Issue
Block a user