Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.rename fails if /tmp and authz are on different file systems #6

Open
whitlockjc opened this issue Nov 15, 2015 · 0 comments
Open

Comments

@whitlockjc
Copy link
Owner

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant