fix(pkger): make pkger skip system tasks when exporting all tasks
parent
fa3009d2f4
commit
5bdcfaee4d
|
@ -462,6 +462,15 @@ func (s *Service) cloneOrgNotificationRules(ctx context.Context, orgID influxdb.
|
|||
}
|
||||
|
||||
func (s *Service) cloneOrgTasks(ctx context.Context, orgID influxdb.ID) ([]ResourceToClone, error) {
|
||||
teles, _, err := s.taskSVC.FindTasks(ctx, influxdb.TaskFilter{OrganizationID: &orgID})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(teles) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
checks, _, err := s.checkSVC.FindChecks(ctx, influxdb.CheckFilter{
|
||||
OrgID: &orgID,
|
||||
})
|
||||
|
@ -469,14 +478,12 @@ func (s *Service) cloneOrgTasks(ctx context.Context, orgID influxdb.ID) ([]Resou
|
|||
return nil, err
|
||||
}
|
||||
|
||||
teles, _, err := s.taskSVC.FindTasks(ctx, influxdb.TaskFilter{OrganizationID: &orgID})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mTeles := make(map[influxdb.ID]*influxdb.Task)
|
||||
for i := range teles {
|
||||
t := teles[i]
|
||||
if t.Type == influxdb.TaskSystemType {
|
||||
continue
|
||||
}
|
||||
mTeles[t.ID] = t
|
||||
}
|
||||
for _, c := range checks {
|
||||
|
|
|
@ -2639,8 +2639,9 @@ func TestService(t *testing.T) {
|
|||
taskSVC.FindTasksFn = func(ctx context.Context, f influxdb.TaskFilter) ([]*influxdb.Task, int, error) {
|
||||
return []*influxdb.Task{
|
||||
{ID: 31},
|
||||
{ID: expectedCheck.TaskID}, // this one should be ignored in the return
|
||||
}, 2, nil
|
||||
{ID: expectedCheck.TaskID}, // this one should be ignored in the return
|
||||
{ID: 99, Type: influxdb.TaskSystemType}, // this one should be skipped since it is a system task
|
||||
}, 3, nil
|
||||
}
|
||||
taskSVC.FindTaskByIDFn = func(ctx context.Context, id influxdb.ID) (*influxdb.Task, error) {
|
||||
if id != 31 {
|
||||
|
|
Loading…
Reference in New Issue