Skip to content

Commit

Permalink
Remove warning messages (vmware-tanzu#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
chandrareddyp authored Jul 13, 2023
1 parent 455ba1c commit 7dff533
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion pkg/discovery/oci_dbbacked.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ func (od *DBBackedOCIDiscovery) checkImageCache() (string, string, error) {
_, hashHexValInventoryImage, err := carvelhelpers.GetImageDigest(od.image)
if err != nil {
// This will happen when the user has configured an invalid image discovery URI
log.Warningf("Unable to resolve the plugin discovery image: %v", err)
return "", "", fmt.Errorf("plugins discovery image resolution failed. Please check that the repository image URL %q is correct ", od.image)
}

Expand Down
19 changes: 12 additions & 7 deletions pkg/pluginmanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,16 +723,19 @@ func installPlugin(pluginName, version string, target configtypes.Target, contex
OS: runtime.GOOS,
Arch: runtime.GOARCH,
}
errorList := make([]error, 0)
availablePlugins, err := discoverSpecificPlugins(discoveries, criteria)
if err != nil {
log.Warningf("There was an error while discovering plugins. Error information: '%v'", err.Error())
errorList = append(errorList, err)
}

if len(availablePlugins) == 0 {
if target != configtypes.TargetUnknown {
return errors.Errorf("unable to find plugin '%v' with version '%v' for target '%s'", pluginName, version, string(target))
errorList = append(errorList, errors.Errorf("unable to find plugin '%v' with version '%v' for target '%s'", pluginName, version, string(target)))
return kerrors.NewAggregate(errorList)
}
return errors.Errorf("unable to find plugin '%v' with version '%v'", pluginName, version)
errorList = append(errorList, errors.Errorf("unable to find plugin '%v' with version '%v'", pluginName, version))
return kerrors.NewAggregate(errorList)
}

// Deal with duplicates from different plugin discovery sources
Expand All @@ -751,9 +754,11 @@ func installPlugin(pluginName, version string, target configtypes.Target, contex
}
if len(matchedPlugins) == 0 {
if target != configtypes.TargetUnknown {
return errors.Errorf("unable to find plugin '%v' with version '%v' for target '%s'", pluginName, version, string(target))
errorList = append(errorList, errors.Errorf("unable to find plugin '%v' with version '%v' for target '%s'", pluginName, version, string(target)))
return kerrors.NewAggregate(errorList)
}
return errors.Errorf("unable to find plugin '%v' with version '%v'", pluginName, version)
errorList = append(errorList, errors.Errorf("unable to find plugin '%v' with version '%v'", pluginName, version))
return kerrors.NewAggregate(errorList)
}

if len(matchedPlugins) == 1 {
Expand All @@ -774,8 +779,8 @@ func installPlugin(pluginName, version string, target configtypes.Target, contex
return installOrUpgradePlugin(&matchedPlugins[i], version, false)
}
}

return errors.Errorf(missingTargetStr, pluginName)
errorList = append(errorList, errors.Errorf(missingTargetStr, pluginName))
return kerrors.NewAggregate(errorList)
}

// legacyInstallPlugin installs a plugin by name, version and target.
Expand Down

0 comments on commit 7dff533

Please sign in to comment.