Skip to content

Commit 7a5728e

Browse files
committed
review fix
1 parent 985451a commit 7a5728e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

+8-7
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,8 +66,7 @@ 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")
7071

7172
if (!resetOk) {

0 commit comments

Comments
 (0)