include LockTimeout message into the fail_json's one

This commit is contained in:
quidame 2021-06-11 22:14:41 +02:00
parent 6181b4d784
commit f27575934e

View file

@ -766,7 +766,7 @@ def main():
lock_timeout = 2 lock_timeout = 2
lock_tempdir = '/tmp' lock_tempdir = '/tmp'
lock_message = 'another instance of the module holds the %s lock' % os.path.basename(args['fstab']) lock_message = 'another instance of the module holds the %s lock: timeout (%s)'
_fstab = FileLock() _fstab = FileLock()
try: try:
@ -872,8 +872,8 @@ def main():
else: else:
module.fail_json(msg='Unexpected position reached') module.fail_json(msg='Unexpected position reached')
except LockTimeout: except LockTimeout as e:
module.fail_json(msg=lock_message) module.fail_json(msg=lock_message % (os.path.basename(args['fstab']), to_native(e)))
# If the managed node is Solaris, convert the boot value type to Boolean # If the managed node is Solaris, convert the boot value type to Boolean
# to match the type of return value with the module argument. # to match the type of return value with the module argument.