fixes issue with unassociated coreinterfaces.

This commit is contained in:
benbierens 2023-09-12 15:18:36 +02:00
parent 8849c4dfa7
commit 140dd37c6e
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 31 additions and 35 deletions

View File

@ -8,25 +8,20 @@ namespace CodexPlugin
{ {
private readonly IPluginTools pluginTools; private readonly IPluginTools pluginTools;
//public CodexStarter(TestLifecycle lifecycle) public CodexStarter(IPluginTools pluginTools)
// : base(lifecycle)
//{
//}
public CodexStarter(IPluginTools pluginActions)
{ {
this.pluginTools = pluginActions; this.pluginTools = pluginTools;
} }
public RunningContainers[] BringOnline(CodexSetup codexSetup) public RunningContainers[] BringOnline(CodexSetup codexSetup)
{ {
//LogSeparator(); LogSeparator();
//LogStart($"Starting {codexSetup.Describe()}..."); Log($"Starting {codexSetup.Describe()}...");
//var gethStartResult = lifecycle.GethStarter.BringOnlineMarketplaceFor(codexSetup); //var gethStartResult = lifecycle.GethStarter.BringOnlineMarketplaceFor(codexSetup);
var startupConfig = CreateStartupConfig(/*gethStartResult,*/ codexSetup); var startupConfig = CreateStartupConfig(/*gethStartResult,*/ codexSetup);
return StartCodexContainers(startupConfig, codexSetup.NumberOfNodes, codexSetup.Location); var containers = StartCodexContainers(startupConfig, codexSetup.NumberOfNodes, codexSetup.Location);
//var metricAccessFactory = CollectMetrics(codexSetup, containers); //var metricAccessFactory = CollectMetrics(codexSetup, containers);
@ -35,15 +30,11 @@ namespace CodexPlugin
//var group = CreateCodexGroup(codexSetup, containers, codexNodeFactory); //var group = CreateCodexGroup(codexSetup, containers, codexNodeFactory);
//lifecycle.SetCodexVersion(group.Version); //lifecycle.SetCodexVersion(group.Version);
//var nl = Environment.NewLine; var podInfos = string.Join(", ", containers.Containers().Select(c => $"Container: '{c.Name}' runs at '{c.Pod.PodInfo.K8SNodeName}'={c.Pod.PodInfo.Ip}"));
//var podInfos = string.Join(nl, containers.Containers().Select(c => $"Container: '{c.Name}' runs at '{c.Pod.PodInfo.K8SNodeName}'={c.Pod.PodInfo.Ip}")); Log($"Started {codexSetup.NumberOfNodes} nodes of image '{containers.Containers().First().Recipe.Image}'. ({podInfos})");
//LogEnd($"Started {codexSetup.NumberOfNodes} nodes " + LogSeparator();
// $"of image '{containers.Containers().First().Recipe.Image}' " +
// $"and version '{group.Version}'{nl}" +
// podInfos);
//LogSeparator();
//return group; return containers;
} }
public ICodexNodeGroup WrapCodexContainers(RunningContainers[] containers) public ICodexNodeGroup WrapCodexContainers(RunningContainers[] containers)
@ -52,18 +43,13 @@ namespace CodexPlugin
var codexNodeFactory = new CodexNodeFactory(pluginTools);// (lifecycle, metricAccessFactory, gethStartResult.MarketplaceAccessFactory); var codexNodeFactory = new CodexNodeFactory(pluginTools);// (lifecycle, metricAccessFactory, gethStartResult.MarketplaceAccessFactory);
return CreateCodexGroup(/*codexSetup,*/ containers, codexNodeFactory); var group = CreateCodexGroup(containers, codexNodeFactory);
Log($"Codex version: {group.Version}");
//lifecycle.SetCodexVersion(group.Version); //lifecycle.SetCodexVersion(group.Version);
//var nl = Environment.NewLine; return group;
//var podInfos = string.Join(nl, containers.Containers().Select(c => $"Container: '{c.Name}' runs at '{c.Pod.PodInfo.K8SNodeName}'={c.Pod.PodInfo.Ip}"));
//LogEnd($"Started {codexSetup.NumberOfNodes} nodes " +
// $"of image '{containers.Containers().First().Recipe.Image}' " +
// $"and version '{group.Version}'{nl}" +
// podInfos);
//LogSeparator();
//return group;
} }
public void BringOffline(CodexNodeGroup group) public void BringOffline(CodexNodeGroup group)
@ -132,7 +118,7 @@ namespace CodexPlugin
try try
{ {
Stopwatch.Measure(pluginTools.GetLog(), "EnsureOnline", group.EnsureOnline, debug: true); Stopwatch.Measure(pluginTools.GetLog(), "(CodexStarter) EnsureOnline", group.EnsureOnline); // log prefixer plz
} }
catch catch
{ {
@ -155,10 +141,15 @@ namespace CodexPlugin
// return lifecycle.WorkflowCreator.CreateWorkflow(); // return lifecycle.WorkflowCreator.CreateWorkflow();
//} //}
//private void LogSeparator() private void LogSeparator()
//{ {
// Log("----------------------------------------------------------------------------"); Log("----------------------------------------------------------------------------");
//} }
private void Log(string message)
{
pluginTools.GetLog().Log($"(CodexStarter) {message}");
}
//private void StopCrashWatcher(RunningContainers containers) //private void StopCrashWatcher(RunningContainers containers)
//{ //{

View File

@ -16,8 +16,13 @@
internal static void Desociate(EntryPoint entryPoint) internal static void Desociate(EntryPoint entryPoint)
{ {
var key = coreAssociations.Single(p => p.Value == entryPoint).Key; var keys = coreAssociations.Where(p => p.Value == entryPoint).ToArray();
coreAssociations.Remove(key); if (keys.Length == 0) return;
foreach (var key in keys)
{
coreAssociations.Remove(key.Key);
}
} }
} }
} }