fix a bug about finding instance name
This commit is contained in:
parent
52ca7eda4d
commit
589832c221
@ -107,8 +107,8 @@ function ufw-docker--instance-name() {
|
|||||||
local INSTANCE_ID="$1"
|
local INSTANCE_ID="$1"
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
echo -n "$INSTANCE_ID" | grep "^${GREP_REGEXP_INSTANCE_NAME}\$" &>/dev/null &&
|
docker inspect --format='{{.Name}}' "$INSTANCE_ID" 2>/dev/null | sed -e 's,^/,,' |
|
||||||
docker inspect --format='{{.Name}}' "$INSTANCE_ID" 2>/dev/null | sed -e 's,^/,,';
|
grep "^${GREP_REGEXP_INSTANCE_NAME}\$" &>/dev/null
|
||||||
} || echo -n "$INSTANCE_ID";
|
} || echo -n "$INSTANCE_ID";
|
||||||
} | remove_blank_lines
|
} | remove_blank_lines
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ function ufw-docker--service-allow() {
|
|||||||
|
|
||||||
if ! docker service inspect "$service_name" \
|
if ! docker service inspect "$service_name" \
|
||||||
--format '{{range .Endpoint.Spec.Ports}}{{.TargetPort}}/{{.Protocol}}{{end}}' |
|
--format '{{range .Endpoint.Spec.Ports}}{{.TargetPort}}/{{.Protocol}}{{end}}' |
|
||||||
grep -E "^${port}/${proto}\$"; then
|
grep -E "^${port}/${proto}\$" &>/dev/null; then
|
||||||
die "Service $service_name does not publish port $service_port."
|
die "Service $service_name does not publish port $service_port."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user