Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispatrick committed Mar 8, 2024
1 parent f7dc75e commit 2021a9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions policy/data/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func NewSubscriptionDataSource(queryIndexes map[string]int, subscriptionResults
}

func (ds SubscriptionDataSource) Query(_ context.Context, queryName string, _ string, _ map[string]interface{}, output interface{}) (*QueryResponse, error) {
if len(ds.subscriptionResults) == 0 {
return nil, nil
}

result, ok := ds.subscriptionResults[0][edn.Keyword(queryName)]
if !ok {
return nil, nil
Expand Down
8 changes: 4 additions & 4 deletions policy/policy_handler/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ func getLocalSubscriptionData(_ context.Context, req skill.RequestContext) (*goa
return nil, skill.Configuration{}, nil, err
}

var mockCommonSubscriptionData goals.ImageSubscriptionQueryResult
var commonSubscriptionData goals.ImageSubscriptionQueryResult
if sbom != nil {
mockCommonSubscriptionData = goals.ImageSubscriptionQueryResult{
commonSubscriptionData = goals.ImageSubscriptionQueryResult{
ImageDigest: sbom.Source.Image.Digest,
ImagePlatforms: []goals.ImagePlatform{{
Architecture: sbom.Source.Image.Platform.Architecture,
Os: sbom.Source.Image.Platform.Os,
}},
}
} else {
mockCommonSubscriptionData = goals.ImageSubscriptionQueryResult{
commonSubscriptionData = goals.ImageSubscriptionQueryResult{
ImageDigest: "localDigest",
}

Expand Down Expand Up @@ -95,7 +95,7 @@ func getLocalSubscriptionData(_ context.Context, req skill.RequestContext) (*goa
}
}

subscriptionData, err := edn.Marshal(mockCommonSubscriptionData)
subscriptionData, err := edn.Marshal(commonSubscriptionData)
if err != nil {
return nil, skill.Configuration{}, nil, err
}
Expand Down

0 comments on commit 2021a9d

Please sign in to comment.