Check the error return from AddPlugin

This commit is contained in:
Ted Yu
2019-09-11 10:38:28 -07:00
parent 2b7ceb215a
commit 156c5cb3d3
2 changed files with 6 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ go_library(
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@@ -23,6 +23,7 @@ package operationexecutor
import (
"context"
"fmt"
"k8s.io/klog"
"net"
"time"
@@ -112,11 +113,14 @@ func (og *operationGenerator) GenerateRegisterPluginFunc(
}
// We add the plugin to the actual state of world cache before calling a plugin consumer's Register handle
// so that if we receive a delete event during Register Plugin, we can process it as a DeRegister call.
actualStateOfWorldUpdater.AddPlugin(cache.PluginInfo{
err = actualStateOfWorldUpdater.AddPlugin(cache.PluginInfo{
SocketPath: socketPath,
FoundInDeprecatedDir: foundInDeprecatedDir,
Timestamp: timestamp,
})
if err != nil {
klog.Errorf("RegisterPlugin error -- failed to add plugin at socket %s, err: %v", socketPath, err)
}
if err := handler.RegisterPlugin(infoResp.Name, infoResp.Endpoint, infoResp.SupportedVersions); err != nil {
return og.notifyPlugin(client, false, fmt.Sprintf("RegisterPlugin error -- plugin registration failed with err: %v", err))
}