From bd7ce236976800996817d9e143713b8c059d1ea9 Mon Sep 17 00:00:00 2001 From: kindermoumoute Date: Fri, 9 Sep 2016 14:06:57 -0700 Subject: [PATCH] Plugin name is not case sensitive All plugins names will load as lower case, even if they have an upper case in them. --- control/plugin/execution.go | 11 +++++++++++ scheduler/workflow.go | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/control/plugin/execution.go b/control/plugin/execution.go index b4bfdb207..18a32f2ed 100644 --- a/control/plugin/execution.go +++ b/control/plugin/execution.go @@ -26,6 +26,7 @@ import ( "io" "os/exec" "path" + "strings" "time" log "github.com/Sirupsen/logrus" @@ -146,6 +147,16 @@ func (e *ExecutablePlugin) Run(timeout time.Duration) (Response, error) { // Kill the plugin if we failed to load it. e.Kill() } + lowerName := strings.ToLower(resp.Meta.Name) + if lowerName != resp.Meta.Name { + execLogger.WithFields(log.Fields{ + "plugin-name": resp.Meta.Name, + "plugin-version": resp.Meta.Version, + "plugin-type": resp.Type.String(), + }).Warning("uppercase plugin name") + } + resp.Meta.Name = lowerName + return resp, err } diff --git a/scheduler/workflow.go b/scheduler/workflow.go index 76e537350..dddab4476 100644 --- a/scheduler/workflow.go +++ b/scheduler/workflow.go @@ -21,6 +21,7 @@ package scheduler import ( "errors" + "strings" "sync" log "github.com/Sirupsen/logrus" @@ -133,6 +134,7 @@ func convertProcessNode(pr []wmap.ProcessWorkflowMapNode) ([]*processNode, error if p.Version < 1 { p.Version = -1 } + p.Name = strings.ToLower(p.Name) prNodes[i] = &processNode{ name: p.Name, version: p.Version, @@ -148,6 +150,7 @@ func convertProcessNode(pr []wmap.ProcessWorkflowMapNode) ([]*processNode, error func convertPublishNode(pu []wmap.PublishWorkflowMapNode) ([]*publishNode, error) { puNodes := make([]*publishNode, len(pu)) for i, p := range pu { + cdn, err := p.GetConfigNode() if err != nil { return nil, err @@ -158,6 +161,7 @@ func convertPublishNode(pu []wmap.PublishWorkflowMapNode) ([]*publishNode, error if p.Version < 1 { p.Version = -1 } + p.Name = strings.ToLower(p.Name) puNodes[i] = &publishNode{ name: p.Name, version: p.Version,