Commits

Anonymous committed 7fc9e5e

Remove old userconfs before installing new.

  • Participants
  • Parent commits 29ebdf3

Comments (0)

Files changed (1)

File rac/dhandler.py

     :license: BSD license.
 """
 
-import os, pwd, time, tempfile
+import os, pwd, time, shutil, tempfile
 import socket, threading, subprocess, struct
 
 from rac.check import validate, ValidationError
     try:
         targetdir = os.path.join(config.get('sysconfdir', '/etc/apache2/vhosts'),
                                  user)
-        try:
-            os.mkdir(targetdir)
-        except OSError, err:
-            if err.errno != 17: # file exists
-                raise
+        if os.path.isdir(targetdir):
+            shutil.rmtree(targetdir)
+        os.mkdir(targetdir)
         for b, fn in files:
             log.debug('installing %r to %s', fn, targetdir)
             sf = open(fn, 'r')