@@ -145,7 +145,8 @@ public PluginDef UpdatePluginStatus(IServiceProvider services, string id, bool e
145
145
if ( enable )
146
146
{
147
147
var dependentPlugins = new HashSet < string > ( ) ;
148
- FindPluginDependency ( id , enable , ref dependentPlugins ) ;
148
+ var dependentAgentIds = new HashSet < string > ( ) ;
149
+ FindPluginDependency ( id , enable , ref dependentPlugins , ref dependentAgentIds ) ;
149
150
var missingPlugins = dependentPlugins . Where ( x => ! config . EnabledPlugins . Contains ( x ) ) . ToList ( ) ;
150
151
if ( ! missingPlugins . IsNullOrEmpty ( ) )
151
152
{
@@ -155,7 +156,7 @@ public PluginDef UpdatePluginStatus(IServiceProvider services, string id, bool e
155
156
156
157
// enable agents
157
158
var agentService = services . GetRequiredService < IAgentService > ( ) ;
158
- foreach ( var agentId in plugin . AgentIds )
159
+ foreach ( var agentId in dependentAgentIds )
159
160
{
160
161
var agent = agentService . LoadAgent ( agentId ) . Result ;
161
162
agent . Disabled = false ;
@@ -189,7 +190,7 @@ public PluginDef UpdatePluginStatus(IServiceProvider services, string id, bool e
189
190
return plugin ;
190
191
}
191
192
192
- private void FindPluginDependency ( string pluginId , bool enabled , ref HashSet < string > dependentPlugins )
193
+ private void FindPluginDependency ( string pluginId , bool enabled , ref HashSet < string > dependentPlugins , ref HashSet < string > dependentAgentIds )
193
194
{
194
195
var pluginDef = _plugins . FirstOrDefault ( x => x . Id == pluginId ) ;
195
196
if ( pluginDef == null ) return ;
@@ -198,6 +199,13 @@ private void FindPluginDependency(string pluginId, bool enabled, ref HashSet<str
198
199
{
199
200
pluginDef . Enabled = enabled ;
200
201
dependentPlugins . Add ( pluginId ) ;
202
+ if ( ! pluginDef . AgentIds . IsNullOrEmpty ( ) )
203
+ {
204
+ foreach ( var agentId in pluginDef . AgentIds )
205
+ {
206
+ dependentAgentIds . Add ( agentId ) ;
207
+ }
208
+ }
201
209
}
202
210
203
211
var foundPlugin = _modules . FirstOrDefault ( x => x . Id == pluginId ) ;
@@ -213,7 +221,7 @@ private void FindPluginDependency(string pluginId, bool enabled, ref HashSet<str
213
221
214
222
foreach ( var plugin in plugins )
215
223
{
216
- FindPluginDependency ( plugin . Id , enabled , ref dependentPlugins ) ;
224
+ FindPluginDependency ( plugin . Id , enabled , ref dependentPlugins , ref dependentAgentIds ) ;
217
225
}
218
226
}
219
227
}
0 commit comments