Skip to content

Conversation

@szymon-owczarzak
Copy link
Contributor

@szymon-owczarzak szymon-owczarzak commented Oct 18, 2021

DO NOT MERGE

This is just a changes preview fro CR purposes

SP: 1

@szymon-owczarzak szymon-owczarzak added the do not merge This task not finished yet label Oct 18, 2021
@szymon-owczarzak szymon-owczarzak self-assigned this Oct 18, 2021
}

fun createCommand(): String {
val logLines = config.getString(CogboardConstants.Props.LOG_LINES) ?: "0"
Copy link
Contributor Author

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)
Copy link
Contributor Author

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")
Copy link
Contributor Author

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?


class SSHKeyAuthSessionStrategy(jSch: JSch, authData: SSHAuthData) : SessionStrategy(jSch, authData) {
override fun initSession(): Session {
if (authData.password == "") {
Copy link
Contributor Author

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

@mprzypasniak99 mprzypasniak99 mentioned this pull request Nov 13, 2021
7 tasks
@mprzypasniak99 mprzypasniak99 mentioned this pull request Nov 14, 2021
7 tasks
Comment on lines 87 to 88
channel.inputStream = null
sshInputStream = channel.inputStream
Copy link
Contributor Author

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?

Comment on lines 36 to 37
BASIC -> config.getString(Props.PASSWORD)
SSH_KEY -> config.getString(Props.SSH_KEY)
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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

var message = ""
when {
!::vertx.isInitialized -> message = "Vertx instance not passed to builder"
!::eventBusAddress.isInitialized -> message = "Eventbus address not passed to builder"
Copy link
Contributor Author

@szymon-owczarzak szymon-owczarzak Nov 16, 2021

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

Comment on lines 25 to 26
assert(template.getString(0) == PROVIDER)
assert(template.getString(1) == MESSAGE)
Copy link
Contributor Author

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

@przemekxa przemekxa mentioned this pull request Jan 18, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge This task not finished yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants