[IMP]Odoo database script : allow full path when needed

This commit is contained in:
Fabien BOURGEOIS 2018-01-02 10:07:03 +01:00
parent 61df2a4f4d
commit a1f0529a25
1 changed files with 7 additions and 1 deletions

View File

@ -20,7 +20,10 @@ def dump(odoo, args):
def restore(odoo, args):
""" Restores database from local file to local or remote host """
dump_path = u'{}/{}_{}.zip'.format(args.dump_path, args.host, args.database)
if args.dump_full_path:
dump_path = args.dump_full_path
else:
dump_path = u'{}/{}_{}.zip'.format(args.dump_path, args.host, args.database)
with open(dump_path, 'rb') as dump_file:
if args.target_host and args.target_port and args.target_password:
connection = odoorpc.ODOO(args.target_host, port=args.target_port)
@ -53,6 +56,9 @@ def main():
parser.add_argument('-dp', '--dump-path', type=str, default='/tmp/',
help='the absolute path where to dump the database, '
'defaults to /tmp/')
parser.add_argument('-dfp', '--dump-full-path', type=str,
help='the absolute full path where to dump the database, '
'used if given, else dump path is used')
parser.add_argument('-dt', '--database-target', type=str,
help=('name for duplicated or restore targetted database '
' (optional : name_copy otherwise'))