|
|
@ -154,6 +154,18 @@ compose:service:exists() { |
|
|
|
[ -n "$service_cfg" ] |
|
|
|
} |
|
|
|
|
|
|
|
docker:container:name() { |
|
|
|
local container_id="$1" |
|
|
|
docker inspect --format '{{.Name}}' "$container_id" | cut -f 2 -d "/" |
|
|
|
} |
|
|
|
|
|
|
|
compose:service:container:get() { |
|
|
|
local project="$1" service="$2" container_id |
|
|
|
container_id=$(compose:service:container_one "$project" "$service") || return 1 |
|
|
|
container_name=$(docker:container:name "$container_id") || return 1 |
|
|
|
echo "$container_name" |
|
|
|
} |
|
|
|
|
|
|
|
compose:file:value-change() { |
|
|
|
local key="$1" value="$2" |
|
|
|
local compose_yml |
|
|
@ -1635,22 +1647,26 @@ cmdline.spec:odoo:cmd:restart:run() { |
|
|
|
|
|
|
|
odoo_service="${opt_service:-odoo}" |
|
|
|
project_name=$(compose:project_name) || return 1 |
|
|
|
|
|
|
|
if ! out=$(docker restart "${project_name}_${odoo_service}_1" 2>&1); then |
|
|
|
container_name=$(compose:service:container:get "${project_name}" "${odoo_service}") || return 1 |
|
|
|
if ! out=$(docker restart "${container_name}" 2>/dev/null); then |
|
|
|
if [[ "$out" == *"no matching entries in passwd file" ]]; then |
|
|
|
warn "Catched docker bug. Restarting once more." |
|
|
|
if ! out=$(docker restart "${project_name}_${odoo_service}_1"); then |
|
|
|
err "Can't restart container ${project_name}_${odoo_service}_1 (restarted twice)." |
|
|
|
if ! out=$(docker restart "${container_name}" 2>&1); then |
|
|
|
err "Can't restart container ${container_name}." |
|
|
|
echo " output:" >&2 |
|
|
|
echo "$out" | prefix " ${GRAY}|${NORMAL} " >&2 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
else |
|
|
|
err "Couldn't restart container ${project_name}_${odoo_service}_1 (and no restart bug detected)." |
|
|
|
err "Couldn't restart container ${container_name} (and no restart bug detected)." |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
info "Container ${project_name}_${odoo_service}_1 was ${DARKGREEN}successfully${NORMAL} restarted." |
|
|
|
info "Container ${CYAN}${container_name}${NORMAL} was ${DARKGREEN}successfully${NORMAL} restarted." |
|
|
|
if [[ "${container_name}" == "${project_name}_${odoo_service}_run_"* ]]; then |
|
|
|
echo " ${WHITE}Note:${NORMAL} You can re-attach to your container with:" >&2 |
|
|
|
echo " docker container attach ${container_name}" >&2 |
|
|
|
fi |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -1703,15 +1719,17 @@ cmdline.spec:odoo:cmd:restore:run() { |
|
|
|
[ "$opt_neutralize" ] && opts_load+=("--neutralize") |
|
|
|
|
|
|
|
project_name=$(compose:project_name) || exit 1 |
|
|
|
container:health:check-fix:no-matching-entries "${project_name}_${odoo_service}_1" |
|
|
|
container_name=$(compose:service:container:get "${project_name}" "${odoo_service}") || exit 1 |
|
|
|
info "Found container ${CYAN}${container_name}${NORMAL} for service ${DARKYELLOW}$odoo_service${NORMAL}." |
|
|
|
container:health:check-fix:no-matching-entries "${container_name}" |
|
|
|
case "$?" in |
|
|
|
0) |
|
|
|
debug "Container ${project_name}_${odoo_service}_1 is healthy." |
|
|
|
debug "Container ${CYAN}${container_name}${NORMAL} is ${DARKGREEN}healthy${NORMAL}." |
|
|
|
;; |
|
|
|
1) err "Container ${project_name}_${odoo_service}_1 is not healthy." |
|
|
|
1) err "Container ${CYAN}${container_name}${NORMAL} is not healthy." |
|
|
|
exit 1 |
|
|
|
;; |
|
|
|
2) info "Container ${project_name}_${odoo_service}_1 was fixed." |
|
|
|
2) info "Container ${CYAN}${container_name}${NORMAL} was ${DARKYELLOW}fixed${NORMAL}." |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|