Implements bringOffline for codex nodes
This commit is contained in:
parent
53bb9968ff
commit
d1895bab02
|
@ -13,8 +13,11 @@ namespace CodexPlugin
|
||||||
|
|
||||||
public class CodexNodeGroup : ICodexNodeGroup
|
public class CodexNodeGroup : ICodexNodeGroup
|
||||||
{
|
{
|
||||||
public CodexNodeGroup(IPluginTools tools, RunningContainers[] containers, ICodexNodeFactory codexNodeFactory)
|
private readonly CodexStarter starter;
|
||||||
|
|
||||||
|
public CodexNodeGroup(CodexStarter starter, IPluginTools tools, RunningContainers[] containers, ICodexNodeFactory codexNodeFactory)
|
||||||
{
|
{
|
||||||
|
this.starter = starter;
|
||||||
Containers = containers;
|
Containers = containers;
|
||||||
Nodes = containers.Containers().Select(c => CreateOnlineCodexNode(c, tools, codexNodeFactory)).ToArray();
|
Nodes = containers.Containers().Select(c => CreateOnlineCodexNode(c, tools, codexNodeFactory)).ToArray();
|
||||||
Version = new CodexDebugVersionResponse();
|
Version = new CodexDebugVersionResponse();
|
||||||
|
@ -30,11 +33,8 @@ namespace CodexPlugin
|
||||||
|
|
||||||
public void BringOffline()
|
public void BringOffline()
|
||||||
{
|
{
|
||||||
//lifecycle.CodexStarter.BringOffline(this);
|
starter.BringOffline(this);
|
||||||
|
|
||||||
//var result = Setup;
|
|
||||||
// Clear everything. Prevent accidental use.
|
// Clear everything. Prevent accidental use.
|
||||||
//Setup = null!;
|
|
||||||
Nodes = Array.Empty<OnlineCodexNode>();
|
Nodes = Array.Empty<OnlineCodexNode>();
|
||||||
Containers = null!;
|
Containers = null!;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,27 +54,27 @@ namespace CodexPlugin
|
||||||
|
|
||||||
public void BringOffline(CodexNodeGroup group)
|
public void BringOffline(CodexNodeGroup group)
|
||||||
{
|
{
|
||||||
//LogStart($"Stopping {group.Describe()}...");
|
Log($"Stopping {group.Describe()}...");
|
||||||
//var workflow = CreateWorkflow();
|
var workflow = pluginTools.CreateWorkflow();
|
||||||
//foreach (var c in group.Containers)
|
foreach (var c in group.Containers)
|
||||||
|
{
|
||||||
|
StopCrashWatcher(c);
|
||||||
|
workflow.Stop(c);
|
||||||
|
}
|
||||||
|
Log("Stopped.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//public void DeleteAllResources()
|
||||||
//{
|
//{
|
||||||
// StopCrashWatcher(c);
|
// //var workflow = CreateWorkflow();
|
||||||
// workflow.Stop(c);
|
// //workflow.DeleteTestResources();
|
||||||
//}
|
//}
|
||||||
//LogEnd("Stopped.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteAllResources()
|
//public void DownloadLog(RunningContainer container, ILogHandler logHandler, int? tailLines)
|
||||||
{
|
//{
|
||||||
//var workflow = CreateWorkflow();
|
// //var workflow = CreateWorkflow();
|
||||||
//workflow.DeleteTestResources();
|
// //workflow.DownloadContainerLog(container, logHandler, tailLines);
|
||||||
}
|
//}
|
||||||
|
|
||||||
public void DownloadLog(RunningContainer container, ILogHandler logHandler, int? tailLines)
|
|
||||||
{
|
|
||||||
//var workflow = CreateWorkflow();
|
|
||||||
//workflow.DownloadContainerLog(container, logHandler, tailLines);
|
|
||||||
}
|
|
||||||
|
|
||||||
//private IMetricsAccessFactory CollectMetrics(CodexSetup codexSetup, RunningContainers[] containers)
|
//private IMetricsAccessFactory CollectMetrics(CodexSetup codexSetup, RunningContainers[] containers)
|
||||||
//{
|
//{
|
||||||
|
@ -114,7 +114,7 @@ namespace CodexPlugin
|
||||||
|
|
||||||
private CodexNodeGroup CreateCodexGroup(RunningContainers[] runningContainers, CodexNodeFactory codexNodeFactory)
|
private CodexNodeGroup CreateCodexGroup(RunningContainers[] runningContainers, CodexNodeFactory codexNodeFactory)
|
||||||
{
|
{
|
||||||
var group = new CodexNodeGroup(pluginTools, runningContainers, codexNodeFactory);
|
var group = new CodexNodeGroup(this, pluginTools, runningContainers, codexNodeFactory);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -151,12 +151,12 @@ namespace CodexPlugin
|
||||||
pluginTools.GetLog().Log(message);
|
pluginTools.GetLog().Log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void StopCrashWatcher(RunningContainers containers)
|
private void StopCrashWatcher(RunningContainers containers)
|
||||||
//{
|
{
|
||||||
// foreach (var c in containers.Containers)
|
foreach (var c in containers.Containers)
|
||||||
// {
|
{
|
||||||
// c.CrashWatcher?.Stop();
|
c.CrashWatcher?.Stop();
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ namespace Tests.BasicTests
|
||||||
{
|
{
|
||||||
var primary = Ci.SetupCodexNode();
|
var primary = Ci.SetupCodexNode();
|
||||||
|
|
||||||
//var setup = primary.BringOffline();
|
primary.BringOffline();
|
||||||
|
|
||||||
//primary = BringOnline(setup)[0];
|
primary = Ci.SetupCodexNode();
|
||||||
|
|
||||||
PerformOneClientTest(primary);
|
PerformOneClientTest(primary);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue