diff --git a/cmd/channel/email/main.go b/cmd/channel/email/main.go index a334ed4c..9124ef26 100644 --- a/cmd/channel/email/main.go +++ b/cmd/channel/email/main.go @@ -119,7 +119,6 @@ func (ch *Email) GetInfo() *plugin.Info { } return &plugin.Info{ - Type: "email", Name: "Email", Version: internal.Version.Version, Author: "Icinga GmbH", diff --git a/cmd/channel/rocketchat/main.go b/cmd/channel/rocketchat/main.go index 72b6b68f..a85b01bb 100644 --- a/cmd/channel/rocketchat/main.go +++ b/cmd/channel/rocketchat/main.go @@ -118,7 +118,6 @@ func (ch *RocketChat) GetInfo() *plugin.Info { } return &plugin.Info{ - Type: "rocketchat", Name: "Rocket.Chat", Version: internal.Version.Version, Author: "Icinga GmbH", diff --git a/internal/channel/plugin.go b/internal/channel/plugin.go index 32880e48..a51c0deb 100644 --- a/internal/channel/plugin.go +++ b/internal/channel/plugin.go @@ -172,6 +172,7 @@ func UpsertPlugins(channelPluginDir string, logger *logging.Logger, db *icingadb continue } p.Stop() + info.Type = pluginType pluginTypes = append(pluginTypes, pluginType) pluginInfos = append(pluginInfos, info) diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index e8ca0a2d..f3d946a5 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -66,7 +66,7 @@ type ConfigOption struct { // Info contains plugin information. type Info struct { - Type string `db:"type" json:"type"` + Type string `db:"type" json:"-"` Name string `db:"name" json:"name"` Version string `db:"version" json:"version"` Author string `db:"author" json:"author"` @@ -74,20 +74,10 @@ type Info struct { } // TableName implements the contracts.TableNamer interface. -func (c *Info) TableName() string { +func (i *Info) TableName() string { return "available_channel_type" } -// Upsert implements the contracts.Upserter interface. -func (c *Info) Upsert() interface{} { - return struct { - Name string `db:"name"` - Version string `db:"version"` - Author string `db:"author"` - ConfigAttributes json.RawMessage `db:"config_attrs"` - }{} -} - type Contact struct { FullName string `json:"full_name"` Addresses []*Address `json:"addresses"`