|
|
@ -215,13 +215,13 @@ def main():
|
|
|
|
if os.path.ismount(name):
|
|
|
|
if os.path.ismount(name):
|
|
|
|
res,msg = umount(**args)
|
|
|
|
res,msg = umount(**args)
|
|
|
|
if res:
|
|
|
|
if res:
|
|
|
|
fail_json(msg="Error unmounting %s: %s" % (name, msg))
|
|
|
|
module.fail_json(msg="Error unmounting %s: %s" % (name, msg))
|
|
|
|
|
|
|
|
|
|
|
|
if os.path.exists(name):
|
|
|
|
if os.path.exists(name):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
os.rmdir(name)
|
|
|
|
os.rmdir(name)
|
|
|
|
except (OSError, IOError), e:
|
|
|
|
except (OSError, IOError), e:
|
|
|
|
fail_json(msg="Error rmdir %s: %s" % (name, str(e)))
|
|
|
|
module.fail_json(msg="Error rmdir %s: %s" % (name, str(e)))
|
|
|
|
|
|
|
|
|
|
|
|
module.exit_json(changed=changed, **args)
|
|
|
|
module.exit_json(changed=changed, **args)
|
|
|
|
|
|
|
|
|
|
|
@ -229,7 +229,7 @@ def main():
|
|
|
|
if os.path.ismount(name):
|
|
|
|
if os.path.ismount(name):
|
|
|
|
res,msg = umount(**args)
|
|
|
|
res,msg = umount(**args)
|
|
|
|
if res:
|
|
|
|
if res:
|
|
|
|
fail_json(msg="Error unmounting %s: %s" % (name, msg))
|
|
|
|
module.fail_json(msg="Error unmounting %s: %s" % (name, msg))
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
|
|
|
|
module.exit_json(changed=changed, **args)
|
|
|
|
module.exit_json(changed=changed, **args)
|
|
|
@ -241,7 +241,7 @@ def main():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
os.makedirs(name)
|
|
|
|
os.makedirs(name)
|
|
|
|
except (OSError, IOError), e:
|
|
|
|
except (OSError, IOError), e:
|
|
|
|
fail_json(msg="Error making dir %s: %s" % (name, str(e)))
|
|
|
|
module.fail_json(msg="Error making dir %s: %s" % (name, str(e)))
|
|
|
|
|
|
|
|
|
|
|
|
res = 0
|
|
|
|
res = 0
|
|
|
|
if os.path.ismount(name):
|
|
|
|
if os.path.ismount(name):
|
|
|
@ -252,7 +252,7 @@ def main():
|
|
|
|
res,msg = mount(**args)
|
|
|
|
res,msg = mount(**args)
|
|
|
|
|
|
|
|
|
|
|
|
if res:
|
|
|
|
if res:
|
|
|
|
fail_json(msg="Error mounting %s: %s" % (name, msg))
|
|
|
|
module.fail_json(msg="Error mounting %s: %s" % (name, msg))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exit_json(changed=changed, **args)
|
|
|
|
module.exit_json(changed=changed, **args)
|
|
|
|