Skip to content

Commit

Permalink
🐛 Fix IDs for vulnmgmt rsources (#2875)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Zunker <[email protected]>
  • Loading branch information
czunker authored Dec 19, 2023
1 parent 7ef64ff commit d7d6d10
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ prep/tools: prep/tools/protolint

cnquery/generate: clean/proto llx/generate shared/generate providers explorer/generate sbom/generate

cnquery/generate/core: clean/proto llx/generate shared/generate providers/proto providers/build/mock providers/build/core explorer/generate
cnquery/generate/core: clean/proto llx/generate shared/generate providers/proto providers/build/mock providers/build/core explorer/generate sbom/generate

define buildProvider
$(eval $@_HOME = $(1))
Expand Down
6 changes: 3 additions & 3 deletions providers-sdk/v1/upstream/mvd/mvd.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions providers/os/resources/os.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions providers/os/resources/vulnmgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ func (v *mqlVulnmgmt) lastAssessment() (*time.Time, error) {
}

var mondooClient *gql.MondooClient
var err error
if v.gqlClient != nil {
mondooClient = v.gqlClient
} else {
// get new gql client
mondooClient, err := gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
mondooClient, err = gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -197,11 +198,12 @@ func (v *mqlVulnmgmt) getReport() (*gql.VulnReport, error) {
}

var mondooClient *gql.MondooClient
var err error
if v.gqlClient != nil {
mondooClient = v.gqlClient
} else {
// get new gql client
mondooClient, err := gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
mondooClient, err = gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -261,3 +263,16 @@ func (v *mqlVulnmgmt) getIncognitoReport(mondooClient *gql.MondooClient) (*gql.V

return gqlVulnReport, nil
}

func (a *mqlVulnAdvisory) id() (string, error) {
return a.Id.Data, a.Id.Error
}

func (c *mqlVulnCve) id() (string, error) {
return c.Id.Data, c.Id.Error
}

func (p *mqlVulnPackage) id() (string, error) {
id := p.Name.Data + "-" + p.Version.Data
return id, p.Name.Error
}
14 changes: 12 additions & 2 deletions providers/vsphere/resources/vsphere.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions providers/vsphere/resources/vulnmgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ func (v *mqlVulnmgmt) lastAssessment() (*time.Time, error) {
}

var mondooClient *gql.MondooClient
var err error
if v.gqlClient != nil {
mondooClient = v.gqlClient
} else {
// get new gql client
mondooClient, err := gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
mondooClient, err = gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -170,11 +171,12 @@ func (v *mqlVulnmgmt) getReport() (*gql.VulnReport, error) {
}

var mondooClient *gql.MondooClient
var err error
if v.gqlClient != nil {
mondooClient = v.gqlClient
} else {
// get new gql client
mondooClient, err := gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
mondooClient, err = gql.NewClient(mcc.UpstreamConfig, mcc.HttpClient)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -217,3 +219,11 @@ func (v *mqlVulnmgmt) getIncognitoReport(mondooClient *gql.MondooClient) (*gql.V

return gqlVulnReport, nil
}

func (a *mqlVulnAdvisory) id() (string, error) {
return a.Id.Data, a.Id.Error
}

func (c *mqlVulnCve) id() (string, error) {
return c.Id.Data, c.Id.Error
}

0 comments on commit d7d6d10

Please sign in to comment.