From 303e085f8b385f8ef42ffb1ee60b1d989dc65711 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 12 Mar 2014 15:59:24 -0500 Subject: [PATCH] Only use cwd in run_command kwargs if the directory exists --- lib/ansible/module_utils/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 1988857610..f47347482f 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1069,7 +1069,7 @@ class AnsibleModule(object): if path_prefix: kwargs['env'] = env - if cwd: + if cwd and os.path.isdir(cwd): kwargs['cwd'] = cwd