File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
src/Elastic.Managed.Ephemeral Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ protected EphemeralClusterComposerBase() { }
2323 new EnsureJavaHomeEnvironmentVariableIsSet ( ) ,
2424 new DownloadElasticsearchVersion ( ) ,
2525 new UnzipElasticsearch ( ) ,
26+ new SetElasticsearchBundledJdkJavaHome ( ) ,
2627 new InstallPlugins ( ) ,
2728
2829 new EnsureElasticsearchBatWorksAcrossDrives ( ) ,
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . IO ;
3+ using Elastic . Managed . ConsoleWriters ;
4+
5+ namespace Elastic . Managed . Ephemeral . Tasks . InstallationTasks
6+ {
7+ public class SetElasticsearchBundledJdkJavaHome : ClusterComposeTask
8+ {
9+ public override void Run ( IEphemeralCluster < EphemeralClusterConfiguration > cluster )
10+ {
11+
12+ var fs = cluster . FileSystem ;
13+ var jdkFolder = Path . Combine ( fs . ElasticsearchHome , "jdk" ) ;
14+ if ( Directory . Exists ( jdkFolder ) )
15+ {
16+ cluster . Writer ? . WriteDiagnostic ( $ "{{{nameof(SetElasticsearchBundledJdkJavaHome)}}} [JAVA_HOME] is set to bundled jdk: {{{jdkFolder}}} ") ;
17+ Environment . SetEnvironmentVariable ( "JAVA_HOME" , jdkFolder ) ;
18+ }
19+ else
20+ cluster . Writer ? . WriteDiagnostic ( $ "{{{nameof(SetElasticsearchBundledJdkJavaHome)}}} [No bundled jdk found] looked in: {{{jdkFolder}}} ") ;
21+ }
22+ }
23+ }
Original file line number Diff line number Diff line change 1- using System ;
2- using System . IO ;
1+ using System . IO ;
32using System . IO . Compression ;
43using Elastic . Managed . ConsoleWriters ;
54using Elastic . Managed . FileSystem ;
@@ -30,7 +29,7 @@ public override void Run(IEphemeralCluster<EphemeralClusterConfiguration> cluste
3029
3130 cluster . Writer ? . WriteDiagnostic ( $ "{{{nameof(UnzipElasticsearch)}}} extracted version [{ v } ] to {{{fs.LocalFolder}}}") ;
3231 }
33-
32+
3433 if ( extractedFolder == fs . ElasticsearchHome ) return ;
3534
3635 cluster . Writer ? . WriteDiagnostic ( $ "{{{nameof(UnzipElasticsearch)}}} Copying extracted folder {{{extractedFolder}}} => { fs . ElasticsearchHome } ") ;
You can’t perform that action at this time.
0 commit comments