[IMP]Odoo database script : allow full path when needed
This commit is contained in:
parent
61df2a4f4d
commit
a1f0529a25
@ -20,7 +20,10 @@ def dump(odoo, args):
|
|||||||
|
|
||||||
def restore(odoo, args):
|
def restore(odoo, args):
|
||||||
""" Restores database from local file to local or remote host """
|
""" 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:
|
with open(dump_path, 'rb') as dump_file:
|
||||||
if args.target_host and args.target_port and args.target_password:
|
if args.target_host and args.target_port and args.target_password:
|
||||||
connection = odoorpc.ODOO(args.target_host, port=args.target_port)
|
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/',
|
parser.add_argument('-dp', '--dump-path', type=str, default='/tmp/',
|
||||||
help='the absolute path where to dump the database, '
|
help='the absolute path where to dump the database, '
|
||||||
'defaults to /tmp/')
|
'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,
|
parser.add_argument('-dt', '--database-target', type=str,
|
||||||
help=('name for duplicated or restore targetted database '
|
help=('name for duplicated or restore targetted database '
|
||||||
' (optional : name_copy otherwise'))
|
' (optional : name_copy otherwise'))
|
||||||
|
Loading…
Reference in New Issue
Block a user