176 return cnx |
176 return cnx |
177 |
177 |
178 def backup_to_file(self, backupfile): |
178 def backup_to_file(self, backupfile): |
179 for cmd in self.dbhelper.backup_commands(self.dbname, self.dbhost, |
179 for cmd in self.dbhelper.backup_commands(self.dbname, self.dbhost, |
180 self.dbuser, backupfile, |
180 self.dbuser, backupfile, |
|
181 dbport=self.dbport, |
181 keepownership=False): |
182 keepownership=False): |
182 if _run_command(cmd): |
183 if _run_command(cmd): |
183 if not confirm(' [Failed] Continue anyway?', default='n'): |
184 if not confirm(' [Failed] Continue anyway?', default='n'): |
184 raise Exception('Failed command: %s' % cmd) |
185 raise Exception('Failed command: %s' % cmd) |
185 |
186 |
186 def restore_from_file(self, backupfile, confirm, drop=True): |
187 def restore_from_file(self, backupfile, confirm, drop=True): |
187 for cmd in self.dbhelper.restore_commands(self.dbname, self.dbhost, |
188 for cmd in self.dbhelper.restore_commands(self.dbname, self.dbhost, |
188 self.dbuser, backupfile, |
189 self.dbuser, backupfile, |
189 self.encoding, |
190 self.encoding, |
|
191 dbport=self.dbport, |
190 keepownership=False, |
192 keepownership=False, |
191 drop=drop): |
193 drop=drop): |
192 if _run_command(cmd): |
194 if _run_command(cmd): |
193 if not confirm(' [Failed] Continue anyway?', default='n'): |
195 if not confirm(' [Failed] Continue anyway?', default='n'): |
194 raise Exception('Failed command: %s' % cmd) |
196 raise Exception('Failed command: %s' % cmd) |