#344772: instance backups should be done in instance_data_dir
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 24 Jul 2009 15:43:11 +0200
changeset 2489 37a747ad6fd4
parent 2488 cd007fc4f2ea
child 2492 c51be1cf8317
#344772: instance backups should be done in instance_data_dir
cwctl.py
misc/migration/3.4.0_common.py
server/migractions.py
server/serverconfig.py
--- a/cwctl.py	Fri Jul 24 15:28:03 2009 +0200
+++ b/cwctl.py	Fri Jul 24 15:43:11 2009 +0200
@@ -313,6 +313,7 @@
         # create the additional data directory for this instance
         if config.appdatahome != config.apphome: # true in dev mode
             create_dir(config.appdatahome)
+        create_dir(join(config.appdatahome, 'backup'))
         if config['uid']:
             from logilab.common.shellutils import chown
             # this directory should be owned by the uid of the server process
--- a/misc/migration/3.4.0_common.py	Fri Jul 24 15:28:03 2009 +0200
+++ b/misc/migration/3.4.0_common.py	Fri Jul 24 15:43:11 2009 +0200
@@ -1,1 +1,6 @@
+from os.path import join
+from cubicweb.toolsutils import create_dir
+
 option_renamed('pyro-application-id', 'pyro-instance-id')
+
+create_dir(join(config.appdatahome, 'backup'))
--- a/server/migractions.py	Fri Jul 24 15:28:03 2009 +0200
+++ b/server/migractions.py	Fri Jul 24 15:43:11 2009 +0200
@@ -113,7 +113,7 @@
         helper = get_adv_func_helper(source['db-driver'])
         date = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
         app = config.appid
-        backupfile = backupfile or join(config.backup_dir(),
+        backupfile = backupfile or join(config.appdatahome, 'backup',
                                         '%s-%s.dump' % (app, date))
         if exists(backupfile):
             if not self.confirm('a backup already exists for %s, overwrite it?' % app):
--- a/server/serverconfig.py	Fri Jul 24 15:28:03 2009 +0200
+++ b/server/serverconfig.py	Fri Jul 24 15:43:11 2009 +0200
@@ -211,11 +211,6 @@
         """instance schema directory"""
         return env_path('CW_SCHEMA_LIB', cls.SCHEMAS_LIB_DIR, 'schemas')
 
-    @classmethod
-    def backup_dir(cls):
-        """backup directory where a stored db backups before migration"""
-        return env_path('CW_BACKUP', cls.BACKUP_DIR, 'run time')
-
     def bootstrap_cubes(self):
         from logilab.common.textutils import get_csv
         for line in file(join(self.apphome, 'bootstrap_cubes')):