Skip to content

Commit

Permalink
Fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmkn committed Jan 7, 2023
1 parent 80b6490 commit f7068e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

NEW FEATURES:

* added validation for the cron expression length to only allow 6-7 characters expressions. PR [#25](https://github.com/jfrog/terraform-provider-shared/pull/25)
* added validation for the cron expression length to only allow 6-7 parts expressions. PR [#25](https://github.com/jfrog/terraform-provider-shared/pull/25)

## 1.8.0 (December 21, 2022)

Expand Down
6 changes: 3 additions & 3 deletions validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ func Cron(value interface{}, _ cty.Path) diag.Diagnostics {

func CronLength(value interface{}, _ cty.Path) diag.Diagnostics {
var diags diag.Diagnostics
cron := regexp.MustCompile("[^\\s]+").FindAllString(value.(string), -1)
cron := strings.Split(value.(string), " ")

if len(cron) > 7 || len(cron) < 6 {
if len(cron) < 6 || len(cron) > 7 {
diags = append(diags, diag.Diagnostic{
Severity: diag.Error,
Summary: "Invalid Cron expression, value should be between 6 and 7 characters long",
Summary: "Invalid Cron expression, value should be between 6 and 7 parts long",
Detail: fmt.Sprintf("%s is not a valid cron", value),
})
}
Expand Down

0 comments on commit f7068e3

Please sign in to comment.