Skip to content

Commit

Permalink
only checking weekday when the schedule is weekly (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjh-yext authored Dec 7, 2022
1 parent 13ffc9a commit b9be503
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions teamcity/resource_build_trigger_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package teamcity
import (
"fmt"
"strings"
"time"

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
Expand Down Expand Up @@ -195,10 +196,7 @@ func resourceBuildTriggerScheduleCreate(d *schema.ResourceData, meta interface{}
timezone := d.Get("timezone").(string)
rules := expandStringSlice(d.Get("rules").([]interface{}))
schedule := d.Get("schedule").(string)
weekday, err := parseWeekday(d.Get("weekday").(string))
if err != nil {
return err
}
weekday := time.Sunday

opt, err := expandTriggerScheduleOptions(d)
if err != nil {
Expand All @@ -218,6 +216,10 @@ func resourceBuildTriggerScheduleCreate(d *schema.ResourceData, meta interface{}
if _, ok := d.GetOk("weekday"); !ok {
return fmt.Errorf("weekday is required if a schedule of weekly is chosen")
}
weekday, err = parseWeekday(d.Get("weekday").(string))
if err != nil {
return err
}
}

dt, err := api.NewTriggerSchedule(schedule, buildConfigID, weekday, uint(hour), uint(minute), timezone, rules, cronSchedule, opt)
Expand Down

0 comments on commit b9be503

Please sign in to comment.