os.rename fails if /tmp and authz are on different file systems
whitlockjc opened this issue · comments
os.rename
only works if source and destination are on the same file system which is usually not the case on properly configured *nix boxes. ;-)
The attached patch replaces os.rename
by shutil.move
.
Index: sync_ldap_groups_to_svn_authz.py
===================================================================
--- sync_ldap_groups_to_svn_authz.py (revision 26)
+++ sync_ldap_groups_to_svn_authz.py (working copy)
@@ -21,7 +21,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
################################################################################
-import ConfigParser, datetime, getpass, os, re, sys, tempfile
+import ConfigParser, datetime, getpass, os, re, sys, tempfile, shutil
from optparse import OptionParser
try:
@@ -358,7 +358,7 @@
if (os.path.exists(authz_path)):
os.rename(authz_path, authz_path + ".bak")
- os.rename(tmp_authz_path, authz_path)
+ shutil.move(tmp_authz_path, authz_path)
else:
tmpfile = open(tmp_authz_path, 'r')