c
This commit is contained in:
1 parent
10f0422155
commit
de583713da
2 files changed
-39
No files matched your search
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Usage: odoo <UUID> [odoo args...]
|
||||
# Example: odoo 001-003-abcdef -u my_custom_module --stop-after-init
|
||||
#
|
||||
# Thin wrapper around `docker exec <UUID> odoo` that injects the database login
|
||||
# parameters (database, host, port, user, password) so callers only pass the
|
||||
# Odoo CLI options they care about.
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <UUID> [odoo args...]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UUID="$1"
|
||||
shift
|
||||
|
||||
source /4server/sbin/helpers
|
||||
get_contract_info
|
||||
|
||||
# The container talks to the shared Postgres as its own per-UUID user.
|
||||
ODOO_DB_USER="$UUID"
|
||||
|
||||
if ! doas docker ps --format '{{.Names}}' | grep -q "^${UUID}$"; then
|
||||
echo "Error: container $UUID is not running" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Attach a TTY only when we have one, so piped/non-interactive use still works.
|
||||
DOCKER_TTY=""
|
||||
[ -t 0 ] && DOCKER_TTY="-it"
|
||||
|
||||
doas docker exec $DOCKER_TTY -u odoo "$UUID" odoo \
|
||||
-d "$UUID" \
|
||||
--db_host="$POSTGRES_HOST" \
|
||||
--db_port="$POSTGRES_PORT" \
|
||||
--db_user="$ODOO_DB_USER" \
|
||||
--db_password="$ODOO_DB_PASSWORD" \
|
||||
"$@"
|
||||
Reference in new issue
Block a user