Skip to content

Commit

Permalink
fix built-in adapters to toss response on error
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Harding <[email protected]>
  • Loading branch information
azdagron committed Jun 25, 2018
1 parent 1cc571d commit aecb68e
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 57 deletions.
24 changes: 20 additions & 4 deletions proto/agent/keymanager/keymanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,35 @@ func NewBuiltIn(plugin Plugin) *BuiltIn {
}

func (b BuiltIn) GenerateKeyPair(ctx context.Context, req *GenerateKeyPairRequest) (*GenerateKeyPairResponse, error) {
return b.plugin.GenerateKeyPair(ctx, req)
resp, err := b.plugin.GenerateKeyPair(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) FetchPrivateKey(ctx context.Context, req *FetchPrivateKeyRequest) (*FetchPrivateKeyResponse, error) {
return b.plugin.FetchPrivateKey(ctx, req)
resp, err := b.plugin.FetchPrivateKey(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) Configure(ctx context.Context, req *plugin.ConfigureRequest) (*plugin.ConfigureResponse, error) {
return b.plugin.Configure(ctx, req)
resp, err := b.plugin.Configure(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) GetPluginInfo(ctx context.Context, req *plugin.GetPluginInfoRequest) (*plugin.GetPluginInfoResponse, error) {
return b.plugin.GetPluginInfo(ctx, req)
resp, err := b.plugin.GetPluginInfo(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

var Handshake = go_plugin.HandshakeConfig{
Expand Down
12 changes: 10 additions & 2 deletions proto/agent/nodeattestor/nodeattestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,19 @@ func (b BuiltIn) FetchAttestationData(ctx context.Context) (FetchAttestationData
}

func (b BuiltIn) Configure(ctx context.Context, req *plugin.ConfigureRequest) (*plugin.ConfigureResponse, error) {
return b.plugin.Configure(ctx, req)
resp, err := b.plugin.Configure(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) GetPluginInfo(ctx context.Context, req *plugin.GetPluginInfoRequest) (*plugin.GetPluginInfoResponse, error) {
return b.plugin.GetPluginInfo(ctx, req)
resp, err := b.plugin.GetPluginInfo(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

var Handshake = go_plugin.HandshakeConfig{
Expand Down
18 changes: 15 additions & 3 deletions proto/agent/workloadattestor/workloadattestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,27 @@ func NewBuiltIn(plugin Plugin) *BuiltIn {
}

func (b BuiltIn) Attest(ctx context.Context, req *AttestRequest) (*AttestResponse, error) {
return b.plugin.Attest(ctx, req)
resp, err := b.plugin.Attest(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) Configure(ctx context.Context, req *plugin.ConfigureRequest) (*plugin.ConfigureResponse, error) {
return b.plugin.Configure(ctx, req)
resp, err := b.plugin.Configure(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) GetPluginInfo(ctx context.Context, req *plugin.GetPluginInfoRequest) (*plugin.GetPluginInfoResponse, error) {
return b.plugin.GetPluginInfo(ctx, req)
resp, err := b.plugin.GetPluginInfo(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

var Handshake = go_plugin.HandshakeConfig{
Expand Down
36 changes: 30 additions & 6 deletions proto/server/ca/serverca.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,51 @@ func NewBuiltIn(plugin Plugin) *BuiltIn {
}

func (b BuiltIn) SignCsr(ctx context.Context, req *SignCsrRequest) (*SignCsrResponse, error) {
return b.plugin.SignCsr(ctx, req)
resp, err := b.plugin.SignCsr(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) GenerateCsr(ctx context.Context, req *GenerateCsrRequest) (*GenerateCsrResponse, error) {
return b.plugin.GenerateCsr(ctx, req)
resp, err := b.plugin.GenerateCsr(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) FetchCertificate(ctx context.Context, req *FetchCertificateRequest) (*FetchCertificateResponse, error) {
return b.plugin.FetchCertificate(ctx, req)
resp, err := b.plugin.FetchCertificate(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) LoadCertificate(ctx context.Context, req *LoadCertificateRequest) (*LoadCertificateResponse, error) {
return b.plugin.LoadCertificate(ctx, req)
resp, err := b.plugin.LoadCertificate(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) Configure(ctx context.Context, req *plugin.ConfigureRequest) (*plugin.ConfigureResponse, error) {
return b.plugin.Configure(ctx, req)
resp, err := b.plugin.Configure(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

func (b BuiltIn) GetPluginInfo(ctx context.Context, req *plugin.GetPluginInfoRequest) (*plugin.GetPluginInfoResponse, error) {
return b.plugin.GetPluginInfo(ctx, req)
resp, err := b.plugin.GetPluginInfo(ctx, req)
if err != nil {
return nil, err
}
return resp, nil
}

var Handshake = go_plugin.HandshakeConfig{
Expand Down
Loading

0 comments on commit aecb68e

Please sign in to comment.