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 1 commit
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
16 changes: 16 additions & 0 deletions 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 @@ -402,6 +414,10 @@ export default class Start extends Command {
await postInstallTasks.run(ctx)
this.log('Command server:start has completed successfully.')
} catch (err) {
const isEmptyDir = await this.isDirEmpty(ctx.directory)
if (isEmptyDir) {
this.error('There are no any logs available for the current installation')
flacatus marked this conversation as resolved.
Show resolved Hide resolved
}
this.error(`${err}\nInstallation failed, check logs in '${ctx.directory}'`)
}

Expand Down