From 60a7f573002b38deecc89ae834f7fb245510613f Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 12 Mar 2014 14:33:31 -0500 Subject: [PATCH] Make sure the cwd exists in run_command before trying to use it --- lib/ansible/module_utils/basic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 3eace12eeb4..1988857610f 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1074,8 +1074,10 @@ class AnsibleModule(object): try: - if cwd: + # make sure we're in the right working directory + if cwd and os.path.isdir(cwd): os.chdir(cwd) + cmd = subprocess.Popen(args, **kwargs) if data: