ansible/ansible — pull request #3878 by sjahl (2013-08-18 15:09:22+00:00)
Title: setting 0644 permissions on mkstemp file handles. Fixes issue #3857

New apt_repository files were being created with 0600 permissions, should be 0644 permissions.

tempfile.mkstemp() will only create files that are read/write by the owner. This patch sets 0644 permissions on the temporary filehandle, so that the atomic_move() retains them later. Putting a chmod elsewhere in the save() method resulted in existing repo files also getting chmodded, which may result in unexpected behavior, if an administrator has set permissions on their sources lists by hand for whatever reason.