Skip to content

Commit

Permalink
Merge pull request #2327 from opengovern/fix-tasks
Browse files Browse the repository at this point in the history
fix: update migrator params default value
  • Loading branch information
artaasadi authored Dec 29, 2024
2 parents 1af0828 + 5c58e7d commit 59811af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
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"`
}

0 comments on commit 59811af

Please sign in to comment.