Skip to content

Commit b7c3786

Browse files
committed
feat(task): add stop-container step and refactor rename-production logic
1 parent e75d548 commit b7c3786

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

task

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,7 @@ upgrade-odoo() {
23232323
echo "shell"
23242324
echo "psql"
23252325
echo "rename-production"
2326+
echo "stop-container"
23262327
exit
23272328
fi
23282329
if [[ -z "$2" ]]; then
@@ -2372,6 +2373,7 @@ upgrade-odoo() {
23722373
echo "---------------------"
23732374
echo "Init Addons: $ODOO_ADDONS_INIT"
23742375
echo "Uninstall Addons: $ODOO_ADDONS_UNINSTALL"
2376+
echo ""
23752377
echo "Test Config: $ODOO_CONFIGURE_TEST"
23762378
echo "Production Config: $ODOO_CONFIGURE_PRODUCTION"
23772379
echo ""
@@ -2502,16 +2504,20 @@ upgrade-odoo() {
25022504
$ssh_target_server docker exec "$containe_id" cat /etc/odoo/odoo.conf
25032505
fi
25042506

2507+
if [[ "$2" = "stop-container" ]]; then
2508+
log-warning "Run step 'stop-container' on $TARGET_SERVER."
2509+
$ssh_server docker stop "$ODOO_CONTAINER"
2510+
fi
2511+
25052512
if [[ "$2" = "rename-production" ]]; then
25062513
log-warning "Run step 'rename-production' on $TARGET_SERVER."
2507-
2508-
echo "#FIXME: implement this command."
2509-
2510-
# ssh -p "$PORT" "$SERVER" docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$DATABASE" -t "${DATABASE}-old"
2511-
# ssh -p "$PORT" "$SERVER" docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$TARGET_DATABASE" -t "$DATABASE"
2512-
# ssh -p "$PORT" "$SERVER" docker-postgres-list -c "$TARGET_POSTGRES_CONTAINER"
2513-
2514-
# ssh -p "$PORT" "$SERVER" docker exec "$TARGET_ODOO_CONTAINER" mv "/var/lib/odoo/filestore/$TARGET_DATABASE" "/var/lib/odoo/filestore/$DATABASE"
2514+
if [[ "$POSTGRES_CONTAINER" != "$TARGET_POSTGRES_CONTAINER" ]]; then
2515+
ssh -p "$PORT" "$SERVER" docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$TARGET_DATABASE" -t "$DATABASE"
2516+
else
2517+
ssh -p "$PORT" "$SERVER" docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$DATABASE" -t "${DATABASE}-old"
2518+
ssh -p "$PORT" "$SERVER" docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$TARGET_DATABASE" -t "$DATABASE"
2519+
fi
2520+
ssh -p "$PORT" "$SERVER" docker-postgres-list -c "$TARGET_POSTGRES_CONTAINER"
25152521
fi
25162522

25172523
}

0 commit comments

Comments
 (0)