|
@ -6,7 +6,6 @@ |
|
|
|
|
|
|
|
|
import os |
|
|
import os |
|
|
import shutil |
|
|
import shutil |
|
|
import tempfile |
|
|
|
|
|
import traceback |
|
|
import traceback |
|
|
from contextlib import contextmanager |
|
|
from contextlib import contextmanager |
|
|
from datetime import datetime, timedelta |
|
|
from datetime import datetime, timedelta |
|
@ -165,8 +164,7 @@ class DbBackup(models.Model): |
|
|
if backup: |
|
|
if backup: |
|
|
cached = open(backup) |
|
|
cached = open(backup) |
|
|
else: |
|
|
else: |
|
|
cached = tempfile.TemporaryFile() |
|
|
|
|
|
db.dump_db(self.env.cr.dbname, cached) |
|
|
|
|
|
|
|
|
cached = db.dump_db(self.env.cr.dbname, None) |
|
|
|
|
|
|
|
|
with cached: |
|
|
with cached: |
|
|
for rec in sftp: |
|
|
for rec in sftp: |
|
@ -274,7 +272,7 @@ class DbBackup(models.Model): |
|
|
"Trying to connect to sftp://%(username)s@%(host)s:%(port)d", |
|
|
"Trying to connect to sftp://%(username)s@%(host)s:%(port)d", |
|
|
extra=params) |
|
|
extra=params) |
|
|
if self.sftp_private_key: |
|
|
if self.sftp_private_key: |
|
|
params["private_key"] = self.stfpprivatekey |
|
|
|
|
|
|
|
|
params["private_key"] = self.sftp_private_key |
|
|
if self.sftp_password: |
|
|
if self.sftp_password: |
|
|
params["private_key_pass"] = self.sftp_password |
|
|
params["private_key_pass"] = self.sftp_password |
|
|
else: |
|
|
else: |
|
|