Script: retrieve the name of the container from 'docker ps' (closes #392)
This is required to work with the random suffix added by `docker-compose.1.23`
This commit is contained in:
parent
2cd1be9ee9
commit
d4864216b4
@ -133,7 +133,7 @@ exec_docker() {
|
|||||||
container_args+=("${arg}");
|
container_args+=("${arg}");
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
docker exec "$interactive_flags" "$docker_node_container" "${container_args[@]}"
|
docker exec "$interactive_flags" "$(container_name "$docker_node_container")" "${container_args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Container ###############################################################
|
## Container ###############################################################
|
||||||
@ -170,7 +170,7 @@ may_pull_image() {
|
|||||||
uptodate_container() {
|
uptodate_container() {
|
||||||
running_image=$(docker inspect \
|
running_image=$(docker inspect \
|
||||||
--format="{{ .Image }}" \
|
--format="{{ .Image }}" \
|
||||||
--type=container "$1")
|
--type=container "$(container_name "$1")")
|
||||||
latest_image=$(docker inspect \
|
latest_image=$(docker inspect \
|
||||||
--format="{{ .Id }}" \
|
--format="{{ .Id }}" \
|
||||||
--type=image "$docker_image")
|
--type=image "$docker_image")
|
||||||
@ -189,6 +189,10 @@ assert_container() {
|
|||||||
call_docker_compose up --no-start
|
call_docker_compose up --no-start
|
||||||
}
|
}
|
||||||
|
|
||||||
|
container_name() {
|
||||||
|
docker ps --filter "name=$1" --format "{{.Names}}"
|
||||||
|
}
|
||||||
|
|
||||||
## Node ####################################################################
|
## Node ####################################################################
|
||||||
|
|
||||||
check_node_volume() {
|
check_node_volume() {
|
||||||
@ -211,9 +215,8 @@ clear_node_volume() {
|
|||||||
check_node() {
|
check_node() {
|
||||||
res=$(docker inspect \
|
res=$(docker inspect \
|
||||||
--format="{{ .State.Running }}" \
|
--format="{{ .State.Running }}" \
|
||||||
--type=container "$docker_node_container" 2>/dev/null \
|
--type=container "$(container_name "$docker_node_container")" 2>/dev/null)
|
||||||
|| echo false)
|
[ -n "$res" ]
|
||||||
[ "$res" = true ]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_node() {
|
assert_node() {
|
||||||
@ -284,8 +287,8 @@ check_baker() {
|
|||||||
docker_baker_containers="$(sed "s/^\(.*\)$/${docker_compose_name}_baker-\1_1/g" "$active_protocol_versions")"
|
docker_baker_containers="$(sed "s/^\(.*\)$/${docker_compose_name}_baker-\1_1/g" "$active_protocol_versions")"
|
||||||
res=$(docker inspect \
|
res=$(docker inspect \
|
||||||
--format="{{ .State.Running }}" \
|
--format="{{ .State.Running }}" \
|
||||||
--type=container $docker_baker_containers 2>/dev/null | grep false)
|
--type=container "$(container_name "$docker_baker_containers")" 2>/dev/null)
|
||||||
[ -z "$res" ]
|
[ -n "$res" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_baker() {
|
assert_baker() {
|
||||||
@ -349,8 +352,8 @@ check_endorser() {
|
|||||||
docker_endorser_containers="$(sed "s/^\(.*\)$/${docker_compose_name}_endorser-\1_1/g" "$active_protocol_versions")"
|
docker_endorser_containers="$(sed "s/^\(.*\)$/${docker_compose_name}_endorser-\1_1/g" "$active_protocol_versions")"
|
||||||
res=$(docker inspect \
|
res=$(docker inspect \
|
||||||
--format="{{ .State.Running }}" \
|
--format="{{ .State.Running }}" \
|
||||||
--type=container $docker_endorser_containers 2>/dev/null | grep false)
|
--type=container "$(container_name "$docker_endorser_containers")" 2>/dev/null)
|
||||||
[ -z "$res" ]
|
[ -n "$res" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_endorser() {
|
assert_endorser() {
|
||||||
@ -414,8 +417,8 @@ check_accuser() {
|
|||||||
docker_accuser_containers="$(sed "s/^\(.*\)$/${docker_compose_name}_accuser-\1_1/g" "$active_protocol_versions")"
|
docker_accuser_containers="$(sed "s/^\(.*\)$/${docker_compose_name}_accuser-\1_1/g" "$active_protocol_versions")"
|
||||||
res=$(docker inspect \
|
res=$(docker inspect \
|
||||||
--format="{{ .State.Running }}" \
|
--format="{{ .State.Running }}" \
|
||||||
--type=container $docker_accuser_containers 2>/dev/null | grep false)
|
--type=container "$(container_name "$docker_accuser_containers")" 2>/dev/null)
|
||||||
[ -z "$res" ]
|
[ -n "$res" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_accuser() {
|
assert_accuser() {
|
||||||
|
Loading…
Reference in New Issue
Block a user