13 :organization: Logilab |
13 :organization: Logilab |
14 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
14 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
15 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
15 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
16 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
16 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
17 """ |
17 """ |
|
18 from __future__ import with_statement |
|
19 |
18 __docformat__ = "restructuredtext en" |
20 __docformat__ = "restructuredtext en" |
19 |
21 |
20 import sys |
22 import sys |
21 import os |
23 import os |
22 import tarfile |
24 import tarfile |
38 from cubicweb import AuthenticationError |
40 from cubicweb import AuthenticationError |
39 from cubicweb.schema import (META_RTYPES, VIRTUAL_RTYPES, |
41 from cubicweb.schema import (META_RTYPES, VIRTUAL_RTYPES, |
40 CubicWebRelationSchema, order_eschemas) |
42 CubicWebRelationSchema, order_eschemas) |
41 from cubicweb.dbapi import get_repository, repo_connect |
43 from cubicweb.dbapi import get_repository, repo_connect |
42 from cubicweb.migration import MigrationHelper, yes |
44 from cubicweb.migration import MigrationHelper, yes |
43 |
45 from cubicweb.server.session import hooks_control |
44 try: |
46 try: |
45 from cubicweb.server import SOURCE_TYPES, schemaserial as ss |
47 from cubicweb.server import SOURCE_TYPES, schemaserial as ss |
46 from cubicweb.server.utils import manager_userpasswd, ask_source_config |
48 from cubicweb.server.utils import manager_userpasswd, ask_source_config |
47 from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX |
49 from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX |
48 except ImportError: # LAX |
50 except ImportError: # LAX |
94 if not options.fs_only: |
96 if not options.fs_only: |
95 if options.backup_db is None: |
97 if options.backup_db is None: |
96 self.backup_database() |
98 self.backup_database() |
97 elif options.backup_db: |
99 elif options.backup_db: |
98 self.backup_database(askconfirm=False) |
100 self.backup_database(askconfirm=False) |
99 super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options) |
101 # disable notification during migration |
|
102 with hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'notification'): |
|
103 super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options) |
100 |
104 |
101 def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs): |
105 def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs): |
102 """execute a migration script |
106 """execute a migration script |
103 in interactive mode, display the migration script path, ask for |
107 in interactive mode, display the migration script path, ask for |
104 confirmation and execute it if confirmed |
108 confirmation and execute it if confirmed |