[IMP]Docker / Odoo databses management with duplicate name and optional admin pass for database

This commit is contained in:
Fabien Bourgeois 2017-01-11 10:05:53 +01:00
parent fb83b0aeab
commit 89bb1948ce

View File

@ -15,18 +15,20 @@ def main():
parser = common.parser(parser)
parser.add_argument('-a', '--action', type=str, default='create',
help='action for the database,' +
'default to create')
'default to create (others are drop, duplicate)')
parser.add_argument('-d', '--database', type=str, required=True,
help='the targetted database')
parser.add_argument('-dn', '--duplicate-name', type=str,
help=('name for duplicated database (optional : '
'name_copy otherwise'))
parser.add_argument('-pw', '--password', type=str, required=True,
help='the odoo superadmin password')
parser.add_argument('-dm', '--demo', type=str, default='False',
help='demonstration data')
parser.add_argument('-l', '--lang', type=str, default='fr_FR',
help='default language')
parser.add_argument('-dbpw', '--database_password', type=str,
required=True,
help='the database admin password')
parser.add_argument('-dbpw', '--database_password', type=str, default='admin',
help='the database admin password, default to admin')
args = parser.parse_args()
# Connection
@ -46,8 +48,8 @@ def main():
elif args.action == 'drop':
odoo.db.drop(args.password, args.database)
elif args.action == 'duplicate':
odoo.db.duplicate(args.password, args.database, args.database +
'_copy')
name = args.duplicate_name or args.database + '_copy'
odoo.db.duplicate(args.password, args.database, name)
if __name__ == "__main__":
main()