Skip to content

Commit

Permalink
Also don't schedule tasks with confirmation=true
Browse files Browse the repository at this point in the history
This is a v2.1 policy
  • Loading branch information
cvaroqui committed Jul 25, 2024
1 parent b7796a8 commit 9115f95
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
15 changes: 10 additions & 5 deletions core/object/actor_print_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,17 @@ func (t *actor) Schedules() schedule.Table {
if r.IsDisabled() {
continue
}
if i, ok := r.(scheduleOptioner); ok {
opts := i.ScheduleOptions()
rid := r.RID()
e := t.newScheduleEntry(opts.Action, key.T{Section: rid, Option: opts.Option}.String(), rid, opts.Base, opts.RequireCollector, opts.RequireProvisioned)
table = table.Add(e)
i, ok := r.(scheduleOptioner)
if !ok {
continue
}
opts := i.ScheduleOptions()
if opts.RequireConfirmation {
continue
}
rid := r.RID()
e := t.newScheduleEntry(opts.Action, key.T{Section: rid, Option: opts.Option}.String(), rid, opts.Base, opts.RequireCollector, opts.RequireProvisioned)
table = table.Add(e)
}
if needResMon {
e := t.newScheduleEntry("resource_monitor", "monitor_schedule", "", "resource_monitor", false, true)
Expand Down
11 changes: 6 additions & 5 deletions core/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,12 @@ type (
// ScheduleOptions contains the information needed by the object to create a
// schedule.Entry to append to the object's schedule.Table.
ScheduleOptions struct {
Action string
Option string
Base string
RequireCollector bool
RequireProvisioned bool
Action string
Option string
Base string
RequireCollector bool
RequireProvisioned bool
RequireConfirmation bool
}
)

Expand Down
9 changes: 6 additions & 3 deletions drivers/restaskdocker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,11 @@ func (t T) notifyRunDone() error {

func (t T) ScheduleOptions() resource.ScheduleOptions {
return resource.ScheduleOptions{
Action: "run",
Option: "schedule",
Base: "",
Action: "run",
Option: "schedule",
Base: "",
RequireConfirmation: t.Confirmation,
RequireProvisioned: true,
RequireCollector: false,
}
}
9 changes: 6 additions & 3 deletions drivers/restaskhost/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,11 @@ func (t T) notifyRunDone() error {

func (t T) ScheduleOptions() resource.ScheduleOptions {
return resource.ScheduleOptions{
Action: "run",
Option: "schedule",
Base: "",
Action: "run",
Option: "schedule",
Base: "",
RequireConfirmation: t.Confirmation,
RequireProvisioned: true,
RequireCollector: false,
}
}

0 comments on commit 9115f95

Please sign in to comment.