Small cleanup

This commit is contained in:
Alex Dadgar 2017-05-22 17:06:46 -07:00
parent 07b1c3e5db
commit d5ea5a16fd
1 changed files with 2 additions and 11 deletions

View File

@ -1515,6 +1515,7 @@ func (j *Job) Stopped() bool {
return j == nil || j.Stop return j == nil || j.Stop
} }
// HasUpdateStrategy returns if any task group in the job has an update strategy
func (j *Job) HasUpdateStrategy() bool { func (j *Job) HasUpdateStrategy() bool {
for _, tg := range j.TaskGroups { for _, tg := range j.TaskGroups {
if tg.Update != nil { if tg.Update != nil {
@ -3803,6 +3804,7 @@ type Deployment struct {
ModifyIndex uint64 ModifyIndex uint64
} }
// NewDeployment creates a new deployment given the job.
func NewDeployment(job *Job) *Deployment { func NewDeployment(job *Job) *Deployment {
return &Deployment{ return &Deployment{
ID: GenerateUUID(), ID: GenerateUUID(),
@ -4649,17 +4651,6 @@ func (p *Plan) AppendAlloc(alloc *Allocation) {
p.NodeAllocation[node] = append(existing, alloc) p.NodeAllocation[node] = append(existing, alloc)
} }
// AppendDeploymentUpdate attaches an deployment update to the plan for the
// given deployment ID.
func (p *Plan) AppendDeploymentUpdate(id, status, description string) {
update := &DeploymentStatusUpdate{
DeploymentID: id,
Status: status,
StatusDescription: description,
}
p.DeploymentUpdates = append(p.DeploymentUpdates, update)
}
// IsNoOp checks if this plan would do nothing // IsNoOp checks if this plan would do nothing
func (p *Plan) IsNoOp() bool { func (p *Plan) IsNoOp() bool {
return len(p.NodeUpdate) == 0 && return len(p.NodeUpdate) == 0 &&