@@ -10,44 +10,52 @@ import com.vk.admstorm.notifications.AdmNotification
10
10
object ChangeSshBackendStartup {
11
11
private val LOG = logger<ChangeSshBackendStartup >()
12
12
13
- private const val SSH_NOTIFICATOR_OPTION = " sshLegacyChanges"
13
+ private const val LEGACY_SSH_NOTIFICATOR_OPTION = " sshLegacyChanges"
14
+ private const val SSH_NOTIFICATOR_OPTION = " sshOpenSSHChanges"
14
15
private const val SSH_CONFIG_BACKEND = " ssh.config.backend"
15
16
16
17
private fun changeSshConfiguration (configValue : SshConnectionConfigService .Kind ) {
17
18
AdvancedSettings .setEnum(SSH_CONFIG_BACKEND , configValue)
18
19
}
19
20
20
21
fun changeConfigurationProcess (project : Project ) {
21
- val dntShow = PropertiesComponent .getInstance(project).getBoolean(SSH_NOTIFICATOR_OPTION )
22
+ val properties = PropertiesComponent .getInstance(project)
23
+
24
+ val dntShow = properties.getBoolean(SSH_NOTIFICATOR_OPTION )
22
25
if (dntShow) {
23
- LOG .info(" LEGACY SSH option was enabled" )
26
+ LOG .info(" OPENSSH option was enabled" )
24
27
return
25
28
}
26
29
30
+ // TODO: Remove it after 2 month
31
+ if (properties.isValueSet(LEGACY_SSH_NOTIFICATOR_OPTION )) {
32
+ properties.unsetValue(LEGACY_SSH_NOTIFICATOR_OPTION )
33
+ }
34
+
27
35
val sshSettingValue = AdvancedSettings .getEnum(SSH_CONFIG_BACKEND , SshConnectionConfigService .Kind ::class .java)
28
- if (sshSettingValue == SshConnectionConfigService .Kind .LEGACY ) {
29
- PropertiesComponent .getInstance(project) .setValue(SSH_NOTIFICATOR_OPTION , true )
30
- LOG .info(" LEGACY SSH option was enabled before" )
36
+ if (sshSettingValue == SshConnectionConfigService .Kind .OPENSSH ) {
37
+ properties .setValue(SSH_NOTIFICATOR_OPTION , true )
38
+ LOG .info(" OPENSSH option was enabled before" )
31
39
return
32
40
}
33
41
34
- changeSshConfiguration(SshConnectionConfigService .Kind .LEGACY )
35
- LOG .info(" LEGACY SSH has been changed" )
42
+ changeSshConfiguration(SshConnectionConfigService .Kind .OPENSSH )
43
+ LOG .info(" LEGACY SSH has been changed to OPENSSH " )
36
44
37
- AdmNotification (" We changed your ssh type to LEGACY " )
45
+ AdmNotification (" We changed your ssh type to OPENSSH " )
38
46
.withActions(
39
47
AdmNotification .Action (" Don`t show it again" ) { _, notification ->
40
- LOG .info(" LEGACY SSH option has been set" )
48
+ LOG .info(" OPENSSH option has been set" )
41
49
notification.expire()
42
50
}
43
51
).withActions(
44
52
AdmNotification .Action (" Rollback and turn off this notification" ) { _, notification ->
45
- changeSshConfiguration(SshConnectionConfigService .Kind .OPENSSH )
46
- LOG .info(" SSH option changed to OpenSSH " )
53
+ changeSshConfiguration(SshConnectionConfigService .Kind .LEGACY )
54
+ LOG .info(" SSH option changed to LEGACY " )
47
55
notification.expire()
48
56
}
49
57
).show(project)
50
58
51
- PropertiesComponent .getInstance(project) .setValue(SSH_NOTIFICATOR_OPTION , true )
59
+ properties .setValue(SSH_NOTIFICATOR_OPTION , true )
52
60
}
53
61
}
0 commit comments