From b213b8d1aeb485f5f613db60ba3d656ba0a0ee89 Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 6 Apr 2023 15:55:51 +0200 Subject: [PATCH] fix(module,app): handle non existent interface in app url resolver --- internal/agent/controller/app/app_handler.go | 2 ++ internal/agent/controller/app/app_handler_test.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/agent/controller/app/app_handler.go b/internal/agent/controller/app/app_handler.go index f5cb15a..2d9bcfd 100644 --- a/internal/agent/controller/app/app_handler.go +++ b/internal/agent/controller/app/app_handler.go @@ -151,6 +151,8 @@ func createResolveAppURL(specs *spec.Spec) (ResolveAppURLFunc, error) { ctx, "could not find interface", logger.E(errors.WithStack(err)), logger.F("iface", ifaceName), ) + + continue } addresses, err := iface.Addrs() diff --git a/internal/agent/controller/app/app_handler_test.go b/internal/agent/controller/app/app_handler_test.go index cef77aa..14a23c9 100644 --- a/internal/agent/controller/app/app_handler_test.go +++ b/internal/agent/controller/app/app_handler_test.go @@ -19,7 +19,8 @@ func TestCreateResolveAppURL(t *testing.T) { Config: &spec.Config{ AppURLResolving: &spec.AppURLResolving{ IfaceMappings: map[string]string{ - "lo": "http://{{ .DeviceIP }}:{{ .AppPort }}", + "lo": "http://{{ .DeviceIP }}:{{ .AppPort }}", + "does-not-exists": "http://{{ .DeviceIP }}:{{ .AppPort }}", }, DefaultURLTemplate: `http://{{ last ( splitList "." ( toString .Manifest.ID ) ) }}.arcad.local`, },