Skip to content

Commit b6c3199

Browse files
committed
review fix
1 parent 985451a commit b6c3199

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/kotlin/com/vk/admstorm/ssh/YubikeyHandler.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ class YubikeyHandler {
2222
private val LOG = logger<YubikeyHandler>()
2323
}
2424

25+
private val openscPath = if (SystemInfo.isLinux) {
26+
"usr/lib/x86_64-linux-gnu/opensc-pkcs11.so"
27+
} else {
28+
"/usr/local/lib/opensc-pkcs11.so"
29+
}
30+
2531
fun autoReset(project: Project, onFail: Runnable): Boolean {
2632
LOG.info("Try auto reset Yubikey")
2733
val resetScript = createScriptIfNotExists(project) ?: return false
@@ -44,11 +50,7 @@ class YubikeyHandler {
4450
PasswordSafe.instance.getPassword(credentialAttributes)!!
4551
}
4652

47-
val openscPath = if (SystemInfo.isLinux) {
48-
"usr/lib/x86_64-linux-gnu/opensc-pkcs11.so"
49-
} else {
50-
"/usr/local/lib/opensc-pkcs11.so"
51-
}
53+
5254

5355
val evalOutput = CommandRunner.runLocallyEval("ssh-agent -s")
5456
if (evalOutput == null) {
@@ -64,10 +66,8 @@ class YubikeyHandler {
6466

6567
val echoBuilder = ProcessBuilder("echo", password)
6668

67-
val sshResetKey = CommandRunner.runLocally(project,"ssh-add -e $openscPath")
68-
69+
val sshResetKey = CommandRunner.runLocally(project, "ssh-add -e $openscPath")
6970
val resetOk = sshResetKey.stderr.contains("Card removed")
70-
7171
if (!resetOk) {
7272
LOG.warn("Yubikey reset error: ${sshResetKey.stderr}")
7373
showYubikeyResetFailNotification(project, "Unable to reset yubikey", null, onFail)

0 commit comments

Comments
 (0)