mirror of
https://github.com/genuinetools/reg.git
synced 2024-06-30 11:04:16 -04:00
cleanup
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
6b207b0cf9
commit
1b3e6ee4b5
|
@ -7,10 +7,18 @@ import (
|
||||||
"github.com/coreos/clair/api/v3/clairpb"
|
"github.com/coreos/clair/api/v3/clairpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrNilGRPCConn = errors.New("grpcConn cannot be nil")
|
||||||
|
)
|
||||||
|
|
||||||
// GetAncestry displays an ancestry and all of its features and vulnerabilities.
|
// GetAncestry displays an ancestry and all of its features and vulnerabilities.
|
||||||
func (c *Clair) GetAncestry(name string) (*clairpb.GetAncestryResponse_Ancestry, error) {
|
func (c *Clair) GetAncestry(name string) (*clairpb.GetAncestryResponse_Ancestry, error) {
|
||||||
c.Logf("clair.ancestry.get name=%s", name)
|
c.Logf("clair.ancestry.get name=%s", name)
|
||||||
|
|
||||||
|
if c.grpcConn == nil {
|
||||||
|
return nil, ErrNilGRPCConn
|
||||||
|
}
|
||||||
|
|
||||||
client := clairpb.NewAncestryServiceClient(c.grpcConn)
|
client := clairpb.NewAncestryServiceClient(c.grpcConn)
|
||||||
|
|
||||||
resp, err := client.GetAncestry(context.Background(), &clairpb.GetAncestryRequest{
|
resp, err := client.GetAncestry(context.Background(), &clairpb.GetAncestryRequest{
|
||||||
|
@ -36,15 +44,11 @@ func (c *Clair) PostAncestry(name string, layers []*clairpb.PostAncestryRequest_
|
||||||
c.Logf("clair.ancestry.post name=%s", name)
|
c.Logf("clair.ancestry.post name=%s", name)
|
||||||
|
|
||||||
if c.grpcConn == nil {
|
if c.grpcConn == nil {
|
||||||
return errors.New("grpcConn cannot be nil")
|
return ErrNilGRPCConn
|
||||||
}
|
}
|
||||||
|
|
||||||
client := clairpb.NewAncestryServiceClient(c.grpcConn)
|
client := clairpb.NewAncestryServiceClient(c.grpcConn)
|
||||||
|
|
||||||
if client == nil {
|
|
||||||
return errors.New("could not establish connection to grpc clair api")
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.PostAncestry(context.Background(), &clairpb.PostAncestryRequest{
|
resp, err := client.PostAncestry(context.Background(), &clairpb.PostAncestryRequest{
|
||||||
AncestryName: name,
|
AncestryName: name,
|
||||||
Layers: layers,
|
Layers: layers,
|
||||||
|
|
Loading…
Reference in a new issue