Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins: Add version info to CLI and server log output #17430

Merged
merged 3 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions command/auth_enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ func (c *AuthEnableCommand) Run(args []string) int {
if authType == "plugin" {
authThing = c.flagPluginName + " plugin"
}
if c.flagPluginVersion != "" {
authThing += " version " + c.flagPluginVersion
}
c.UI.Output(fmt.Sprintf("Success! Enabled %s at: %s", authThing, authPath))
return 0
}
3 changes: 3 additions & 0 deletions command/secrets_enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ func (c *SecretsEnableCommand) Run(args []string) int {
if engineType == "plugin" {
thing = c.flagPluginName + " plugin"
}
if c.flagPluginVersion != "" {
thing += " version " + c.flagPluginVersion
}
c.UI.Output(fmt.Sprintf("Success! Enabled the %s at: %s", thing, mountPath))
return 0
}
4 changes: 2 additions & 2 deletions vault/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (c *Core) enableCredentialInternal(ctx context.Context, entry *MountEntry,
}

if c.logger.IsInfo() {
c.logger.Info("enabled credential backend", "path", entry.Path, "type", entry.Type)
c.logger.Info("enabled credential backend", "path", entry.Path, "type", entry.Type, "version", entry.Version)
}
return nil
}
Expand Down Expand Up @@ -847,7 +847,7 @@ func (c *Core) setupCredentials(ctx context.Context) error {
}

if c.logger.IsInfo() {
c.logger.Info("successfully enabled credential backend", "type", entry.Type, "path", entry.Path, "namespace", entry.Namespace())
c.logger.Info("successfully enabled credential backend", "type", entry.Type, "version", entry.Version, "path", entry.Path, "namespace", entry.Namespace())
}

// Ensure the path is tainted if set in the mount table
Expand Down
4 changes: 2 additions & 2 deletions vault/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ func (c *Core) mountInternal(ctx context.Context, entry *MountEntry, updateStora
}

if c.logger.IsInfo() {
c.logger.Info("successful mount", "namespace", entry.Namespace().Path, "path", entry.Path, "type", entry.Type)
c.logger.Info("successful mount", "namespace", entry.Namespace().Path, "path", entry.Path, "type", entry.Type, "version", entry.Version)
}
return nil
}
Expand Down Expand Up @@ -1495,7 +1495,7 @@ func (c *Core) setupMounts(ctx context.Context) error {
}

if c.logger.IsInfo() {
c.logger.Info("successfully mounted backend", "type", entry.Type, "path", entry.Path)
c.logger.Info("successfully mounted backend", "type", entry.Type, "version", entry.Version, "path", entry.Path)
}

// Ensure the path is tainted if set in the mount table
Expand Down
8 changes: 8 additions & 0 deletions vault/plugin_reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ func (c *Core) reloadBackendCommon(ctx context.Context, entry *MountEntry, isAut
}
}

if c.logger.IsInfo() {
pluginType := "secrets"
if isAuth {
pluginType = "auth"
}
c.logger.Info(fmt.Sprintf("successfully reloaded %s backend", pluginType), "type", entry.Type, "version", entry.Version, "path", entry.Path)
}

return nil
}

Expand Down