|
@ -71,38 +71,22 @@ if [ -z "$dbname" ]; then |
|
|
} |
|
|
} |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
. "$CHARM_PATH/lib/common" |
|
|
|
|
|
|
|
|
set -e |
|
|
set -e |
|
|
|
|
|
|
|
|
curl_opts=() |
|
|
curl_opts=() |
|
|
|
|
|
|
|
|
## Ensure odoo is launched |
|
|
|
|
|
service_def=$(get_compose_service_def "$SERVICE_NAME") |
|
|
|
|
|
|
|
|
|
|
|
## XXXvlab: should be moved to lib |
|
|
|
|
|
CONFIG=$SERVICE_CONFIGSTORE/etc/odoo-server.conf |
|
|
|
|
|
ADMIN_PASSWORD=$(echo "$service_def" | shyaml -q get-value options.admin-password) || { |
|
|
|
|
|
if [ -e "$CONFIG" ]; then |
|
|
|
|
|
ADMIN_PASSWORD=$(grep ^admin_passwd "$CONFIG" | sed -r 's/^admin_passwd\s+=\s+(.+)$/\1/g') |
|
|
|
|
|
fi |
|
|
|
|
|
if [ -z "$ADMIN_PASSWORD" ]; then |
|
|
|
|
|
err "Could not find 'admin-password' in $SERVICE_NAME service definition nor in config file." |
|
|
|
|
|
|
|
|
ADMIN_PASSWORD=$(odoo:get-admin-password) || { |
|
|
|
|
|
err "Couldn't retrieve admin password for ${DARKYELLOW}$SERVICE_NAME${NORMAL}." |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
containers="$(get_running_containers_for_service "$SERVICE_NAME")" |
|
|
|
|
|
if [ -z "$containers" ]; then |
|
|
|
|
|
err "No containers running for service $DARKYELLOW$SERVICE_NAME$NORMAL." |
|
|
|
|
|
|
|
|
container="$(get_running_container_for_service "$SERVICE_NAME")" || { |
|
|
|
|
|
err "Couldn't find running container for service ${DARKYELLOW}$SERVICE_NAME${NORMAL}." |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ "$(echo "$containers" | wc -l)" -gt 1 ]; then |
|
|
|
|
|
err "More than 1 container running for service $DARKYELLOW$SERVICE_NAME$NORMAL." |
|
|
|
|
|
echo " Please contact administrator to fix this issue." >&2 |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
container="$(echo "$containers" | head -n 1)" |
|
|
|
|
|
odoo_version=$(docker exec "$container" python -c 'import odoo.release; print(odoo.release.version)') || { |
|
|
odoo_version=$(docker exec "$container" python -c 'import odoo.release; print(odoo.release.version)') || { |
|
|
err "Failed to get odoo version." |
|
|
err "Failed to get odoo version." |
|
|
exit 1 |
|
|
exit 1 |
|
|