partial backport of support for adbh's new interface to backup_command and restore_command stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Wed, 27 Jan 2010 16:08:51 +0100
branchstable
changeset 4416 94a3a2dec8fc
parent 4332 70943fcff808
child 4417 8cd447d11aed
partial backport of support for adbh's new interface to backup_command and restore_command these methods can return lists or strings which are passed to subprocess.call without or with the shell=True parameter respectively.
server/sqlutils.py
--- a/server/sqlutils.py	Fri Jan 22 12:25:54 2010 +0100
+++ b/server/sqlutils.py	Wed Jan 27 16:08:51 2010 +0100
@@ -174,7 +174,7 @@
         cmd = self.dbhelper.backup_command(self.dbname, self.dbhost,
                                            self.dbuser, backupfile,
                                            keepownership=False)
-        if subprocess.call(cmd):
+        if subprocess.call(cmd, shell=isinstance(cmd, str)):
             raise Exception('Failed command: %s' % cmd)
 
     def restore_from_file(self, backupfile, confirm, drop=True):
@@ -183,7 +183,7 @@
                                                   self.encoding,
                                                   keepownership=False,
                                                   drop=drop):
-            if subprocess.call(cmd):
+            if subprocess.call(cmd, shell=isinstance(cmd, str)):
                 print '-> Failed command: %s' % cmd
                 if not confirm('Continue anyway?', default='n'):
                     raise Exception('Failed command: %s' % cmd)