Skip to content

Commit

Permalink
Fix the error message strings for TMC and TAE in CSP authentication
Browse files Browse the repository at this point in the history
Signed-off-by: Prem Kumar Kalle <[email protected]>
  • Loading branch information
prkalle committed Oct 5, 2023
1 parent 122d2b2 commit 9d2827e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/command/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,14 @@ func doCSPAuthAndUpdateContext(c *configtypes.Context, endpointType string) (cla
if apiTokenExists {
log.Info("API token env var is set")
} else {
apiTokenValue, err = promptAPIToken("TAE")
apiTokenValue, err = promptAPIToken(endpointType)
if err != nil {
return nil, err
}
}
token, err := csp.GetAccessTokenFromAPIToken(apiTokenValue, issuer)
if err != nil {
return nil, errors.Wrap(err, "failed to get token from CSP for TAE")
return nil, errors.Wrapf(err, "failed to get token from CSP for %s", endpointType)
}
claims, err = csp.ParseToken(&oauth2.Token{AccessToken: token.AccessToken})
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions pkg/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ func newRootCmd() *cobra.Command {
// Flag parsing must be deactivated because the root plugin won't know about all flags.
DisableFlagParsing: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// Ensure mutual exclusion in current contexts just in case if any plugins with old
// plugin-runtime sets k8s context as current when tae context is already set as current
if err := utils.EnsureMutualExclusiveCurrentContexts(); err != nil {
return err
}
return nil

if !shouldSkipTelemetryCollection(cmd) {
if err := telemetry.Client().UpdateCmdPreRunMetrics(cmd, args); err != nil {
telemetry.LogError(err, "")
Expand Down
7 changes: 0 additions & 7 deletions pkg/pluginmanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -975,13 +975,6 @@ func doDeletePluginFromCatalog(pluginName string, target configtypes.Target, cat
// If the central-repo is disabled, all discovered plugins will be installed.
func SyncPlugins() error {
log.Info("Checking for required plugins...")
// ensure the k8s and tae current contexts are mutually exclusive.
// This is required as plugins could call syncPlugins through plugin-runtime
err := utils.EnsureMutualExclusiveCurrentContexts()
if err != nil {
return err
}

errList := make([]error, 0)
// We no longer sync standalone plugins.
// With a centralized approach to discovering plugins, synchronizing
Expand Down

0 comments on commit 9d2827e

Please sign in to comment.