From 72ffb8abc4c4ce335383a287a44e54f5a0f15e4c Mon Sep 17 00:00:00 2001 From: Charan Kumar N <64530924+charan-kumar-137@users.noreply.github.com> Date: Mon, 19 Aug 2024 22:12:02 +0530 Subject: [PATCH] Update recursive_set_attributes with FileNotFoundError --- lib/ansible/modules/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/file.py b/lib/ansible/modules/file.py index 60f614698b0..eb6f47bcf3c 100644 --- a/lib/ansible/modules/file.py +++ b/lib/ansible/modules/file.py @@ -374,7 +374,7 @@ def recursive_set_attributes(b_path, follow, file_args, mtime, atime): tmp_file_args['path'] = to_native(b_fsname, errors='surrogate_or_strict') changed |= module.set_fs_attributes_if_different(tmp_file_args, changed, expand=False) changed |= update_timestamp_for_file(tmp_file_args['path'], mtime, atime) - except RuntimeError as e: + except (RuntimeError, FileNotFoundError) as e: # on Python3 "RecursionError" is raised which is derived from "RuntimeError" # TODO once this function is moved into the common file utilities, this should probably raise more general exception raise AnsibleModuleError(