Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix chectl logs before che pods start #836

Merged
merged 2 commits into from
Aug 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/commands/server/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ export default class Start extends Command {
}
}

/**
* Determine if a directory is empty.
*/
async isDirEmpty(dirname: string): Promise<boolean> {
try {
return fs.readdirSync(dirname).length === 0
// Fails in case if directory doesn't exist
} catch {
return true
}
}

/**
* Checks if TLS is disabled via operator custom resource.
* Returns true if TLS is enabled (or omitted) and false if it is explicitly disabled.
Expand Down Expand Up @@ -383,7 +395,6 @@ export default class Start extends Command {
if (!ctx.isCheDeployed) {
this.checkPlatformCompatibility(flags)
await platformCheckTasks.run(ctx)
this.log(`Eclipse Che logs will be available in '${ctx.directory}'`)
await logsTasks.run(ctx)
await eventTasks.run(ctx)
await installTasks.run(ctx)
Expand All @@ -402,6 +413,10 @@ export default class Start extends Command {
await postInstallTasks.run(ctx)
this.log('Command server:start has completed successfully.')
} catch (err) {
const isDirEmpty = await this.isDirEmpty(ctx.directory)
if (isDirEmpty) {
this.error(`${err}\nInstallation failed. There are no available logs.`)
}
this.error(`${err}\nInstallation failed, check logs in '${ctx.directory}'`)
}

Expand Down