Add leader and timezone to conversion

This commit is contained in:
Alex Dadgar 2017-02-20 16:36:41 -08:00
parent 83c082dd74
commit 693dd21420
2 changed files with 3 additions and 1 deletions

View File

@ -257,7 +257,7 @@ type Task struct {
Vault *Vault Vault *Vault
Templates []*Template Templates []*Template
DispatchPayload *DispatchPayloadConfig DispatchPayload *DispatchPayloadConfig
Leader *bool Leader bool
} }
func (t *Task) Canonicalize() { func (t *Task) Canonicalize() {

View File

@ -419,6 +419,7 @@ func apiJobToStructJob(job *api.Job) *structs.Job {
Enabled: *job.Periodic.Enabled, Enabled: *job.Periodic.Enabled,
SpecType: *job.Periodic.SpecType, SpecType: *job.Periodic.SpecType,
ProhibitOverlap: *job.Periodic.ProhibitOverlap, ProhibitOverlap: *job.Periodic.ProhibitOverlap,
TimeZone: *job.Periodic.TimeZone,
} }
if job.Periodic.Spec != nil { if job.Periodic.Spec != nil {
j.Periodic.Spec = *job.Periodic.Spec j.Periodic.Spec = *job.Periodic.Spec
@ -476,6 +477,7 @@ func apiTaskToStructsTask(apiTask *api.Task, structsTask *structs.Task) {
structsTask.Name = apiTask.Name structsTask.Name = apiTask.Name
structsTask.Driver = apiTask.Driver structsTask.Driver = apiTask.Driver
structsTask.User = apiTask.User structsTask.User = apiTask.User
structsTask.Leader = apiTask.Leader
structsTask.Config = apiTask.Config structsTask.Config = apiTask.Config
structsTask.Constraints = make([]*structs.Constraint, len(apiTask.Constraints)) structsTask.Constraints = make([]*structs.Constraint, len(apiTask.Constraints))
for i, constraint := range apiTask.Constraints { for i, constraint := range apiTask.Constraints {