Skip to content

Commit

Permalink
🐛 Don't render assessments for data queries (#1438)
Browse files Browse the repository at this point in the history
* 🐛 Don't render assessments for data queries

Boolean data queries had an assessment and would print that instead of
just the result

* update cnquery
  • Loading branch information
jaym authored Sep 25, 2024
1 parent dfff538 commit 2312224
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/reporter/print_compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ func (r *defaultReporter) printAssetQueries(resolved *policy.ResolvedPolicy, rep
dataQueriesOutput := ""
resolved.WithDataQueries(func(id string, query *policy.ExecutionQuery) {
data := query.Code.FilterResults(results)
result := r.Reporter.Printer.Results(query.Code, data)
result := r.Reporter.Printer.Datas(query.Code, data)
if result == "" {
return
}
Expand Down
2 changes: 1 addition & 1 deletion cli/reporter/render_asset_overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func renderAssetOverview(print *printer.Printer, policyObj *policy.Policy, repor

// print data results
filteredResults := codeBundle.FilterResults(results)
value := print.Results(codeBundle, filteredResults)
value := print.Datas(codeBundle, filteredResults)

table = append(table, row{
Title: query.Title,
Expand Down
2 changes: 1 addition & 1 deletion cli/reporter/render_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func renderDataQueries(print *printer.Printer, policyObj *policy.Policy, report
}
}

result := print.Results(codeBundle, filteredResults)
result := print.Datas(codeBundle, filteredResults)
result = strings.ReplaceAll(result, "\n", NewLineCharacter)
res.WriteString(" Result:")
writeQueryCompact(res, result)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
go.mondoo.com/cnquery/v11 v11.23.0
go.mondoo.com/cnquery/v11 v11.23.1-0.20240925141453-78405c55870a
go.mondoo.com/mondoo-go v0.0.0-20240819110653-687d75eb1183
go.mondoo.com/ranger-rpc v0.6.3
go.opentelemetry.io/otel v1.30.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3
go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs=
go.mondoo.com/cnquery/v11 v11.23.0 h1:DsC4JKSpG/lWHhI6rEgusUa+ukMq4EJAe3skXMR1ww4=
go.mondoo.com/cnquery/v11 v11.23.0/go.mod h1:genVEY+EytYTwhE9wW0A/Tq6bZysygBXXLPcthpto9Y=
go.mondoo.com/cnquery/v11 v11.23.1-0.20240925141453-78405c55870a h1:TdVoxRXpW7vj5Ehd0VyhTaZAxUCUoAX0K7NB4bXxeYg=
go.mondoo.com/cnquery/v11 v11.23.1-0.20240925141453-78405c55870a/go.mod h1:genVEY+EytYTwhE9wW0A/Tq6bZysygBXXLPcthpto9Y=
go.mondoo.com/mondoo-go v0.0.0-20240819110653-687d75eb1183 h1:IpUOrXDa31euZKYfbBEkyZTTUGK3CtF2l8Wy1T0YG/o=
go.mondoo.com/mondoo-go v0.0.0-20240819110653-687d75eb1183/go.mod h1:lF3LCT7QHJekrCjQjYkectEQ/atQ0UELtsuBuXHNRxo=
go.mondoo.com/ranger-rpc v0.6.3 h1:XpJatFv0m6FxiVwgwKVlDkO6EcjGf6TnoJSlNh3d7Ks=
Expand Down

0 comments on commit 2312224

Please sign in to comment.