From eb69a1d011cb75ec03446c31ab99f5a32d31759c Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Sat, 11 Feb 2017 18:34:50 -0300 Subject: [PATCH] Fix rewrite annotation parser --- core/pkg/ingress/annotations/rewrite/main.go | 6 +----- core/pkg/ingress/annotations/rewrite/main_test.go | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/pkg/ingress/annotations/rewrite/main.go b/core/pkg/ingress/annotations/rewrite/main.go index c7e57c2532..14dec6616b 100644 --- a/core/pkg/ingress/annotations/rewrite/main.go +++ b/core/pkg/ingress/annotations/rewrite/main.go @@ -52,11 +52,7 @@ func NewParser(br resolver.DefaultBackend) parser.IngressAnnotation { // ParseAnnotations parses the annotations contained in the ingress // rule used to rewrite the defined paths func (a rewrite) Parse(ing *extensions.Ingress) (interface{}, error) { - rt, err := parser.GetStringAnnotation(rewriteTo, ing) - if err != nil { - return nil, err - } - + rt, _ := parser.GetStringAnnotation(rewriteTo, ing) sslRe, err := parser.GetBoolAnnotation(sslRedirect, ing) if err != nil { sslRe = a.backendResolver.GetDefaultBackend().SSLRedirect diff --git a/core/pkg/ingress/annotations/rewrite/main_test.go b/core/pkg/ingress/annotations/rewrite/main_test.go index 56ba6a9b75..f4f0ed973d 100644 --- a/core/pkg/ingress/annotations/rewrite/main_test.go +++ b/core/pkg/ingress/annotations/rewrite/main_test.go @@ -76,8 +76,8 @@ func (m mockBackend) GetDefaultBackend() defaults.Backend { func TestWithoutAnnotations(t *testing.T) { ing := buildIngress() _, err := NewParser(mockBackend{}).Parse(ing) - if err == nil { - t.Error("Expected error with ingress without annotations") + if err != nil { + t.Errorf("unexpected error with ingress without annotations: %v", err) } }