From 17be5537d6f324e62ad5ff131fbef77c04c86dd6 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 28 Jul 2012 08:48:05 -0400 Subject: [PATCH] When sudoing to another user, the umask may be set such that the next user might not be able to read/execute the file. Deal with this. --- lib/ansible/runner/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index c0c3cecb318..acf41e5a988 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -210,7 +210,11 @@ class Runner(object): args = utils.jsonify(args,format=True) (remote_module_path, is_new_style) = self._copy_module(conn, tmp, module_name, inject) - self._low_level_exec_command(conn, "chmod +x %s" % remote_module_path, tmp) + cmd = "chmod +x %s" % remote_module_path + if self.sudo and self.sudo_user != 'root': + # deal with possible umask issues once sudo'ed to other user + cmd = "chmod 555 %s" % remote_module_path + self._low_level_exec_command(conn, cmd, tmp) cmd = "" if not is_new_style: