Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update migrator params default value #2327

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions jobs/post-install-job/job/migrations/compliance/git_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ func (g *GitParser) ExtractControls(complianceControlsPath string, controlEnrich
} else {
paramsValues := make(map[string]string)
for _, pv := range control.Query.Parameters {
if pv.DefaultValue != nil {
paramsValues[pv.Key] = *pv.DefaultValue
if pv.DefaultValue != "" {
paramsValues[pv.Key] = pv.DefaultValue
}
}
var integrationTypes pq.StringArray
Expand Down Expand Up @@ -294,10 +294,10 @@ func (g *GitParser) ExtractControls(complianceControlsPath string, controlEnrich
Value: v,
})
} else {
if parameter.DefaultValue != nil {
if parameter.DefaultValue != "" {
g.queryParams = append(g.queryParams, models.QueryParameterValues{
Key: parameter.Key,
Value: *parameter.DefaultValue,
Value: parameter.DefaultValue,
})
}
}
Expand All @@ -323,10 +323,10 @@ func (g *GitParser) ExtractControls(complianceControlsPath string, controlEnrich
Required: parameter.Required,
})

if parameter.DefaultValue != nil {
if parameter.DefaultValue != "" {
g.queryParams = append(g.queryParams, models.QueryParameterValues{
Key: parameter.Key,
Value: *parameter.DefaultValue,
Value: parameter.DefaultValue,
})
}
}
Expand Down Expand Up @@ -775,8 +775,8 @@ func (g *GitParser) ExtractQueryViews(viewsPath string) error {
} else {
paramsValues := make(map[string]string)
for _, pv := range obj.Query.Parameters {
if pv.DefaultValue != nil {
paramsValues[pv.Key] = *pv.DefaultValue
if pv.DefaultValue != "" {
paramsValues[pv.Key] = pv.DefaultValue
}
}
var integrationTypes pq.StringArray
Expand Down Expand Up @@ -805,10 +805,10 @@ func (g *GitParser) ExtractQueryViews(viewsPath string) error {
Value: v,
})
} else {
if parameter.DefaultValue != nil {
if parameter.DefaultValue != "" {
g.queryParams = append(g.queryParams, models.QueryParameterValues{
Key: parameter.Key,
Value: *parameter.DefaultValue,
Value: parameter.DefaultValue,
})
}
}
Expand All @@ -832,10 +832,10 @@ func (g *GitParser) ExtractQueryViews(viewsPath string) error {
Required: parameter.Required,
})

if parameter.DefaultValue != nil {
if parameter.DefaultValue != "" {
g.queryParams = append(g.queryParams, models.QueryParameterValues{
Key: parameter.Key,
Value: *parameter.DefaultValue,
Value: parameter.DefaultValue,
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions jobs/post-install-job/job/migrations/inventory/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ func populateFinderItem(logger *zap.Logger, tx *gorm.DB, path string, info fs.Fi
Required: qp.Required,
QueryID: dbMetric.ID,
})
if qp.DefaultValue != nil {
if qp.DefaultValue != "" {
queryParamObj := models.QueryParameterValues{
Key: qp.Key,
Value: *qp.DefaultValue,
Value: qp.DefaultValue,
}
QueryParameters = append(QueryParameters, queryParamObj)
}
Expand Down
2 changes: 1 addition & 1 deletion jobs/post-install-job/job/migrations/shared/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ type Query struct {
type QueryParameter struct {
Key string `json:"Key" yaml:"Key"`
Required bool `json:"Required" yaml:"Required"`
DefaultValue *string `json:"DefaultValue" yaml:"DefaultValue"`
DefaultValue string `json:"DefaultValue" yaml:"DefaultValue"`
}
Loading