Skip to content

Commit 622d3a1

Browse files
LunfanZhangBengangY
authored andcommitted
CP-309227 Refactor variable names for better code readability
Signed-off-by: Lunfan Zhang[Lunfan.Zhang] <[email protected]>
1 parent d3fb57a commit 622d3a1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

plugins-base/XSFeatureRemoteShell.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
from XSConsoleStandard import *
2020

21-
DISABLE = 0
22-
ENABLE = 1
23-
AUTO = 2
21+
SSH_MODE_DISABLE = 0
22+
SSH_MODE_ENABLE = 1
23+
SSH_MODE_AUTO = 2
2424

2525
class DisableOptionsDialogue(Dialogue):
2626
def __init__(self):
@@ -31,8 +31,8 @@ def __init__(self):
3131
pane.AddBox()
3232

3333
self.disableMenu = Menu(self, None, Lang("Disable Options"), [
34-
ChoiceDef(Lang("Always Disable"), lambda: self.HandleChoice(DISABLE)),
35-
ChoiceDef(Lang("Disable and Turn on Auto-mode"), lambda: self.HandleChoice(AUTO))
34+
ChoiceDef(Lang("Always Disable"), lambda: self.HandleChoice(SSH_MODE_DISABLE)),
35+
ChoiceDef(Lang("Disable and Turn on Auto-mode"), lambda: self.HandleChoice(SSH_MODE_AUTO))
3636
])
3737

3838
self.UpdateFields()
@@ -67,7 +67,7 @@ def HandleChoice(self, inChoice):
6767
message = Lang("New connections via the remote shell are now disabled, but there are "
6868
"ssh connections still ongoing. If necessary, use 'killall sshd-session' from the Local "
6969
"Command Shell to terminate them.")
70-
if inChoice == AUTO:
70+
if inChoice == SSH_MODE_AUTO:
7171
data.SetSSHAutoMode(True)
7272
message = Lang("SSH auto-mode has been configured. For security,"
7373
"SSH is normally disabled and will only be enabled in case of emergency.")
@@ -89,7 +89,7 @@ def __init__(self):
8989
pane.AddBox()
9090

9191
self.remoteShellMenu = Menu(self, None, Lang("Configure Remote Shell"), [
92-
ChoiceDef(Lang("Enable"), lambda: self.HandleChoice(ENABLE)),
92+
ChoiceDef(Lang("Enable"), lambda: self.HandleChoice(SSH_MODE_ENABLE)),
9393
ChoiceDef(Lang("Disable"), lambda: self.HandleDisable())
9494
])
9595

@@ -118,7 +118,7 @@ def HandleChoice(self, inChoice):
118118

119119
try:
120120
message = Lang("Configuration Successful")
121-
if inChoice == ENABLE:
121+
if inChoice == SSH_MODE_ENABLE:
122122
data.EnableSSH()
123123
Layout.Inst().PushDialogue(InfoDialogue(message))
124124

0 commit comments

Comments
 (0)