12
12
using Elastic . Elasticsearch . Ephemeral . Tasks . InstallationTasks . XPack ;
13
13
using Elastic . Elasticsearch . Ephemeral . Tasks . ValidationTasks ;
14
14
using Elastic . Elasticsearch . Managed . FileSystem ;
15
+ using Elastic . Elasticsearch . Managed . ConsoleWriters ;
15
16
16
17
namespace Elastic . Elasticsearch . Ephemeral
17
18
{
@@ -73,9 +74,9 @@ public class EphemeralClusterComposer<TConfiguration> : EphemeralClusterComposer
73
74
74
75
private bool NodeStarted { get ; set ; }
75
76
76
- public void OnStop ( ) => Itterate ( NodeStoppedTasks , ( t , c , fs ) => t . Run ( c , NodeStarted ) , false ) ;
77
+ public void OnStop ( ) => Iterate ( NodeStoppedTasks , ( t , c , fs ) => t . Run ( c , NodeStarted ) , false ) ;
77
78
78
- public void Install ( ) => Itterate ( InstallationTasks , ( t , c , fs ) => t . Run ( c ) ) ;
79
+ public void Install ( ) => Iterate ( InstallationTasks , ( t , c , fs ) => t . Run ( c ) ) ;
79
80
80
81
public void OnBeforeStart ( )
81
82
{
@@ -86,7 +87,7 @@ public void OnBeforeStart()
86
87
if ( Cluster . ClusterConfiguration . PrintYamlFilesInConfigFolder )
87
88
tasks . Add ( new PrintYamlContents ( ) ) ;
88
89
89
- Itterate ( tasks , ( t , c , fs ) => t . Run ( c ) ) ;
90
+ Iterate ( tasks , ( t , c , fs ) => t . Run ( c ) ) ;
90
91
91
92
NodeStarted = true ;
92
93
}
@@ -97,10 +98,10 @@ public void OnAfterStart()
97
98
var tasks = new List < IClusterComposeTask > ( AfterStartedTasks ) ;
98
99
if ( Cluster . ClusterConfiguration . AdditionalAfterStartedTasks != null )
99
100
tasks . AddRange ( Cluster . ClusterConfiguration . AdditionalAfterStartedTasks ) ;
100
- Itterate ( tasks , ( t , c , fs ) => t . Run ( c ) , false ) ;
101
+ Iterate ( tasks , ( t , c , fs ) => t . Run ( c ) , false ) ;
101
102
}
102
103
103
- private void Itterate < T > ( IEnumerable < T > collection ,
104
+ private void Iterate < T > ( IEnumerable < T > collection ,
104
105
Action < T , IEphemeralCluster < TConfiguration > , INodeFileSystem > act , bool callOnStop = true )
105
106
{
106
107
lock ( _lock )
@@ -111,9 +112,10 @@ private void Itterate<T>(IEnumerable<T> collection,
111
112
{
112
113
act ( task , cluster , cluster . FileSystem ) ;
113
114
}
114
- catch ( Exception )
115
+ catch ( Exception ex )
115
116
{
116
117
if ( callOnStop ) OnStop ( ) ;
118
+ cluster . Writer . WriteError ( $ "{ ex . Message } { Environment . NewLine } { ex . StackTrace } ") ;
117
119
throw ;
118
120
}
119
121
}
0 commit comments