-
Notifications
You must be signed in to change notification settings - Fork 9
Widget | Log Viewer - preview #414
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
base: master
Are you sure you want to change the base?
Conversation
cogboard-app/src/main/kotlin/com/cognifide/cogboard/ssh/auth/SSHAuthData.kt
Outdated
Show resolved
Hide resolved
cogboard-app/src/main/kotlin/com/cognifide/cogboard/ssh/auth/SSHAuthData.kt
Outdated
Show resolved
Hide resolved
cogboard-app/src/main/kotlin/com/cognifide/cogboard/ssh/auth/SSHAuthData.kt
Show resolved
Hide resolved
| } | ||
|
|
||
| fun createCommand(): String { | ||
| val logLines = config.getString(CogboardConstants.Props.LOG_LINES) ?: "0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the overloaded getString method that uses the second parameter:
config.getString(CogboardConstants.Props.LOG_LINES, "0")
| connect(config) | ||
| } catch (e: JSchException) { | ||
| LOGGER.error(e.message) | ||
| vertx.eventBus().send(eventBusAddress, e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we extract method here:
sendError(e)
|
|
||
| private fun initSSHSession(authData: SSHAuthData) { | ||
| jsch = JSch() | ||
| jsch.setKnownHosts("~/.ssh/known_hosts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this line mean? - does it requires some configuration?
cogboard-app/src/main/kotlin/com/cognifide/cogboard/ssh/session/SessionStrategyFactory.kt
Show resolved
Hide resolved
|
|
||
| class SSHKeyAuthSessionStrategy(jSch: JSch, authData: SSHAuthData) : SessionStrategy(jSch, authData) { | ||
| override fun initSession(): Session { | ||
| if (authData.password == "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use: import io.netty.util.internal.StringUtil.EMPTY_STRING
Fix/review 414
Added proper exception handling to react to errors #420
| channel.inputStream = null | ||
| sshInputStream = channel.inputStream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this part: why do we set those nulls here?
| BASIC -> config.getString(Props.PASSWORD) | ||
| SSH_KEY -> config.getString(Props.SSH_KEY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have created variables for this: lines 12, 14
| import io.vertx.core.json.JsonArray | ||
| import io.vertx.core.json.JsonObject | ||
|
|
||
| class SSHAuthData(private val config: JsonObject) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either store config as a variable or use only defined variables from config: lines 11-17
cogboard-app/src/main/kotlin/com/cognifide/cogboard/ssh/session/SessionStrategyFactory.kt
Show resolved
Hide resolved
| var message = "" | ||
| when { | ||
| !::vertx.isInitialized -> message = "Vertx instance not passed to builder" | ||
| !::eventBusAddress.isInitialized -> message = "Eventbus address not passed to builder" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message += - first message might be overriten
| assert(template.getString(0) == PROVIDER) | ||
| assert(template.getString(1) == MESSAGE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather see an actual expected strings here for a better understanding
# Conflicts: # cogboard-webapp/src/components/widgets/types/LogViewerWidget/helpers.js
LogsViewer - change logs generator permissions
#476 - LogsViewer - Changes on frontend
DO NOT MERGE
This is just a changes preview fro CR purposes
SP: 1