[FIX] script db_restore: force exit when clean cache database
This commit is contained in:
parent
b4ca616104
commit
f91b62d3d7
2 changed files with 14 additions and 4 deletions
4
Makefile
4
Makefile
|
|
@ -107,6 +107,10 @@ db_drop_db_code_generator:
|
|||
db_drop_db_template:
|
||||
./.venv/bin/python3 ./odoo/odoo-bin db --drop --database template
|
||||
|
||||
.PHONY: db_clean_cache
|
||||
db_clean_cache:
|
||||
./script/db_restore.py --clean_cache
|
||||
|
||||
.PHONY: db_restore_erplibre_base_db_test
|
||||
db_restore_erplibre_base_db_test:
|
||||
./script/db_restore.py --database test
|
||||
|
|
|
|||
|
|
@ -60,6 +60,14 @@ def get_master_password():
|
|||
_logger.error("Password echoed, danger!")
|
||||
|
||||
|
||||
def get_list_db_cache(arg_base):
|
||||
arg = f"{arg_base} --list"
|
||||
out = check_output(arg.split(" ")).decode()
|
||||
lst_db = out.strip().split("\n")
|
||||
lst_db_cache = [a for a in lst_db if a.startswith("_cache_")]
|
||||
return lst_db, lst_db_cache
|
||||
|
||||
|
||||
def main():
|
||||
config = get_config()
|
||||
|
||||
|
|
@ -88,10 +96,7 @@ def main():
|
|||
_logger.info("No master password needed... Continue")
|
||||
|
||||
# Get list of database
|
||||
arg = f"{arg_base} --list"
|
||||
out = check_output(arg.split(" ")).decode()
|
||||
lst_db = out.strip().split("\n")
|
||||
lst_db_cache = [a for a in lst_db if a.startswith("_cache_")]
|
||||
lst_db, lst_db_cache = get_list_db_cache(arg_base)
|
||||
|
||||
if config.clean_cache:
|
||||
for db in lst_db_cache:
|
||||
|
|
@ -99,6 +104,7 @@ def main():
|
|||
arg = f"{arg_base} --drop --database {db}"
|
||||
out = check_output(arg.split(" ")).decode()
|
||||
print(out)
|
||||
lst_db, lst_db_cache = get_list_db_cache(arg_base)
|
||||
|
||||
if config.database:
|
||||
cache_database = f"_cache_{config.image}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue