From 933b395de482a00a73693b11381f2f5d49b4255b Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 16 May 2017 12:57:23 +0000 Subject: [PATCH] Report plugin version status via the Config object --- plugin/status.go | 7 ++----- prog/weaver/http.go | 6 ++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugin/status.go b/plugin/status.go index d22863a7..bdaf894c 100644 --- a/plugin/status.go +++ b/plugin/status.go @@ -1,9 +1,9 @@ package plugin type Status struct { + Config Config DriverName string MeshDriverName string `json:"MeshDriverName,omitempty"` - Version int } func (plugin *Plugin) NewStatus() *Status { @@ -13,10 +13,7 @@ func (plugin *Plugin) NewStatus() *Status { status := &Status{ DriverName: pluginNameFromAddress(plugin.Socket), MeshDriverName: pluginNameFromAddress(plugin.MeshSocket), - Version: 1, - } - if plugin.EnableV2 { - status.Version = 2 + Config: plugin.Config, } return status } diff --git a/prog/weaver/http.go b/prog/weaver/http.go index 2df37562..ce59a843 100644 --- a/prog/weaver/http.go +++ b/prog/weaver/http.go @@ -212,8 +212,10 @@ var statusTemplate = defTemplate("status", `\ {{end}}\ {{if .Plugin}}\ - Service: plugin (v{{.Plugin.Version}}) -{{if eq .Plugin.Version 1}}\ +{{if .Plugin.Config.EnableV2}}\ + Service: plugin (v2) +{{else}}\ + Service: plugin (legacy) DriverName: {{.Plugin.DriverName}} {{end}}\ {{end}}\