|
8 | 8 | "path/filepath"
|
9 | 9 | "regexp"
|
10 | 10 | "runtime"
|
11 |
| - "slices" |
12 | 11 | "strings"
|
13 | 12 | "sync"
|
14 | 13 | "time"
|
@@ -690,75 +689,6 @@ func (mgr *Manager) ValidateConfig(ctx context.Context, conf resource.Config) ([
|
690 | 689 | // and modified resources. It also puts modular resources whose module has been modified or added in conf.Added if
|
691 | 690 | // they are not already there since the resources themselves are not necessarily new.
|
692 | 691 | func (mgr *Manager) ResolveImplicitDependenciesInConfig(ctx context.Context, conf *config.Diff) error {
|
693 |
| - // NOTE(benji): We could simplify some of the following `continue` |
694 |
| - // conditional clauses to a single clause, but we split them for readability. |
695 |
| - for _, c := range conf.Right.Components { |
696 |
| - mod, ok := mgr.getModule(c) |
697 |
| - if !ok { |
698 |
| - // continue if this component is not being provided by a module. |
699 |
| - continue |
700 |
| - } |
701 |
| - |
702 |
| - lenModified, lenAdded := len(conf.Modified.Modules), len(conf.Added.Modules) |
703 |
| - deltaModules := make([]config.Module, lenModified, lenModified+lenAdded) |
704 |
| - copy(deltaModules, conf.Modified.Modules) |
705 |
| - deltaModules = append(deltaModules, conf.Added.Modules...) |
706 |
| - |
707 |
| - if !slices.ContainsFunc(deltaModules, func(elem config.Module) bool { |
708 |
| - return elem.Name == mod.cfg.Name |
709 |
| - }) { |
710 |
| - // continue if this modular component is not being handled by a modified |
711 |
| - // or added module. |
712 |
| - continue |
713 |
| - } |
714 |
| - if slices.ContainsFunc(conf.Added.Components, func(elem resource.Config) bool { |
715 |
| - return elem.Name == c.Name |
716 |
| - }) { |
717 |
| - // continue if this modular component handled by a modified module is |
718 |
| - // already in conf.Added.Components. |
719 |
| - continue |
720 |
| - } |
721 |
| - |
722 |
| - // Add modular component to conf.Added.Components. |
723 |
| - conf.Added.Components = append(conf.Added.Components, c) |
724 |
| - // If component is in conf.Modified, the user modified a module and its |
725 |
| - // component at the same time. Remove that resource from conf.Modified so |
726 |
| - // the restarted module receives an AddResourceRequest and not a |
727 |
| - // ReconfigureResourceRequest. |
728 |
| - conf.Modified.Components = slices.DeleteFunc( |
729 |
| - conf.Modified.Components, func(elem resource.Config) bool { return elem.Name == c.Name }) |
730 |
| - } |
731 |
| - for _, s := range conf.Right.Services { |
732 |
| - mod, ok := mgr.getModule(s) |
733 |
| - if !ok { |
734 |
| - // continue if this service is not being provided by a module. |
735 |
| - continue |
736 |
| - } |
737 |
| - if !slices.ContainsFunc(conf.Modified.Modules, func(elem config.Module) bool { |
738 |
| - return elem.Name == mod.cfg.Name |
739 |
| - }) { |
740 |
| - // continue if this modular service is not being handled by a modified |
741 |
| - // module. |
742 |
| - continue |
743 |
| - } |
744 |
| - if slices.ContainsFunc(conf.Added.Services, func(elem resource.Config) bool { |
745 |
| - return elem.Name == s.Name |
746 |
| - }) { |
747 |
| - // continue if this modular service handled by a modified module is |
748 |
| - // already in conf.Added.Services. |
749 |
| - continue |
750 |
| - } |
751 |
| - |
752 |
| - // Add modular service to conf.Added.Services. |
753 |
| - conf.Added.Services = append(conf.Added.Services, s) |
754 |
| - // If service is in conf.Modified, the user modified a module and its |
755 |
| - // service at the same time. Remove that resource from conf.Modified so |
756 |
| - // the restarted module receives an AddResourceRequest and not a |
757 |
| - // ReconfigureResourceRequest. |
758 |
| - conf.Modified.Services = slices.DeleteFunc( |
759 |
| - conf.Modified.Services, func(elem resource.Config) bool { return elem.Name == s.Name }) |
760 |
| - } |
761 |
| - |
762 | 692 | // If something was added or modified, go through components and services in
|
763 | 693 | // diff.Added and diff.Modified, call Validate on all those that are modularized,
|
764 | 694 | // and store implicit dependencies.
|
|
0 commit comments