|
|
@ -1604,7 +1604,9 @@ cmdline.spec:odoo:cmd:restore:run() { |
|
|
|
(can be a local file or an url)' |
|
|
|
|
|
|
|
: :optval: --service,-s "The service (defaults to 'odoo')" |
|
|
|
: :optval: --database,-d 'Target database (default if not specified)' |
|
|
|
: :optval: --database,-D 'Target database (default if not specified)' |
|
|
|
: :optfla: --neutralize,-n "Restore database in neutralized state." |
|
|
|
: :optfla: --debug,-d "Display more information." |
|
|
|
|
|
|
|
local out |
|
|
|
|
|
|
@ -1633,21 +1635,37 @@ cmdline.spec:odoo:cmd:restore:run() { |
|
|
|
exit 1 |
|
|
|
} |
|
|
|
|
|
|
|
opts_compose=() |
|
|
|
[ -t 1 ] && opts_compose+=("--color") |
|
|
|
[ "$opt_debug" ] && { |
|
|
|
VERBOSE=1 |
|
|
|
opts_compose+=("--debug") |
|
|
|
} |
|
|
|
opts_load=() |
|
|
|
[ "$opt_neutralize" ] && opts_load+=("--neutralize") |
|
|
|
|
|
|
|
#cmdline.spec:odoo:cmd:restart:run --service "$odoo_service" || exit 1 |
|
|
|
|
|
|
|
msg_dbname=default |
|
|
|
[ -n "$opt_database" ] && msg_dbname="'$opt_database'" |
|
|
|
compose --no-hooks drop "$odoo_service" $opt_database || { |
|
|
|
err "Error dropping $msg_dbname database of service ${DARKYELLOW}$odoo_service${NORMAL}." |
|
|
|
Wrap -vsd "drop $msg_dbname database of service ${DARKYELLOW}$odoo_service${NORMAL}" -- \ |
|
|
|
compose --no-hooks "${opts_compose[@]}" drop "$odoo_service" $opt_database || { |
|
|
|
err "Error dropping $msg_dbname database of service ${DARKYELLOW}$odoo_service${NORMAL}:" |
|
|
|
[ -z "$opt_debug" ] && { |
|
|
|
echo " Use \`\`--debug\`\` (or \`\`-d\`\`) to get more information." >&2 |
|
|
|
} |
|
|
|
exit 1 |
|
|
|
} |
|
|
|
compose --no-hooks load "$odoo_service" $opt_database < "$ZIP_DUMP_LOCATION" || { |
|
|
|
Wrap -vsd "restore $msg_dbname database of service ${DARKYELLOW}$odoo_service${NORMAL}" -- \ |
|
|
|
compose --no-hooks "${opts_compose[@]}" \ |
|
|
|
load "$odoo_service" $opt_database "${opts_load[@]}" < "$ZIP_DUMP_LOCATION" || { |
|
|
|
err "Error restoring service ${DARKYELLOW}$odoo_service${NORMAL} to $msg_dbname database." |
|
|
|
[ -z "$opt_debug" ] && { |
|
|
|
echo " Use \`\`--debug\`\` (or \`\`-d\`\`) to get more information." >&2 |
|
|
|
} |
|
|
|
exit 1 |
|
|
|
} |
|
|
|
|
|
|
|
info "Successfully restored ${DARKYELLOW}$odoo_service${NORMAL} to $msg_dbname database." |
|
|
|
|
|
|
|
## Restart odoo, ensure there is no bugs lingering on it. |
|
|
|
cmdline.spec:odoo:cmd:restart:run --service "$odoo_service" || exit 1 |
|
|
|
|
|
|
|