From 4ed664f4d0d28c42f055412e99001d31bf879955 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Tue, 30 Sep 2014 08:56:57 +0200 Subject: [PATCH] Forbid copy: content="" with a directory destination Fixes #9107, closes PR #9212 --- lib/ansible/plugins/action/copy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/plugins/action/copy.py b/lib/ansible/plugins/action/copy.py index 0bf19f50696..34fd7b1dbb2 100644 --- a/lib/ansible/plugins/action/copy.py +++ b/lib/ansible/plugins/action/copy.py @@ -49,6 +49,8 @@ class ActionModule(ActionBase): return dict(failed=True, msg="src (or content) and dest are required") elif (source is not None or faf is not None) and content is not None: return dict(failed=True, msg="src and content are mutually exclusive") + elif content is not None and dest is not None and dest.endswith("/"): + return dict(failed=True, msg="dest must be a file if content is defined") # Check if the source ends with a "/" source_trailing_slash = False