fix wrong type of service_env

This commit is contained in:
Chai Feng 2018-10-05 18:22:22 +08:00
parent 965659601c
commit 8116401b7c
No known key found for this signature in database
GPG Key ID: 2DCD9A24E523FFD2

View File

@ -185,13 +185,11 @@ function ufw-docker--service-allow() {
declare service_id="$(ufw-docker--get-service-id "${service_name}")" declare service_id="$(ufw-docker--get-service-id "${service_name}")"
service_name="$(ufw-docker--get-service-name "${service_name}")" service_name="$(ufw-docker--get-service-name "${service_name}")"
declare -a service_env
exec 9< <(docker service inspect "$service_name" \ exec 9< <(docker service inspect "$service_name" \
--format '{{range .Endpoint.Spec.Ports}}{{.PublishedPort}} {{.TargetPort}}/{{.Protocol}}{{"\n"}}{{end}}') --format '{{range .Endpoint.Spec.Ports}}{{.PublishedPort}} {{.TargetPort}}/{{.Protocol}}{{"\n"}}{{end}}')
while read -u 9 port target_port; do while read -u 9 port target_port; do
if [[ "$target_port" = "${service_port}/${service_proto}" ]]; then if [[ "$target_port" = "${service_port}/${service_proto}" ]]; then
service_env="ufw_public_${service_id}=${service_name}/${port}/${service_proto}" declare service_env="ufw_public_${service_id}=${service_name}/${port}/${service_proto}"
break; break;
fi fi
done done