Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions XSConsoleData.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,11 @@ def ScanService(self, service):
(status, output) = getstatusoutput("systemctl is-enabled %s" % (service,))
self.data['chkconfig'][service] = status == 0

(status, output) = getstatusoutput("systemctl is-active %s" % (service,))
if 'service_active' not in self.data:
self.data['service_active'] = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving the initialization of data['service_active'] to the line 368 to align with the initialization of data['chkconfig']?

self.data['service_active'][service] = status == 0

def ScanResolvConf(self, inLines):
self.data['dns'] = {
'nameservers' : [],
Expand Down
18 changes: 10 additions & 8 deletions plugins-base/XSFeatureRemoteShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def HandleChoice(self, inChoice):
"Command Shell to terminate them.")
if inChoice == self.SSH_MODE_AUTO:
data.SetSSHAutoMode(True)
message = Lang("SSH auto-mode has been configured. For security,"
message = Lang("SSH auto-mode has been configured. For security, "
"SSH is normally disabled and will only be enabled in case of emergency.")

Layout.Inst().PushDialogue(InfoDialogue(message))
Expand Down Expand Up @@ -139,16 +139,18 @@ def StatusUpdateHandler(cls, inPane):
data = Data.Inst()
inPane.AddTitleField(Lang("Remote Shell (ssh)"))

if data.chkconfig.sshd() is None:
message = Lang('unknown. To enable or disable')
elif data.chkconfig.sshd():
message = Lang('enabled. To disable')
is_running = data.service_active.sshd()

if is_running is None:
message = Lang('unknown. To configure')
elif is_running:
message = Lang('running. To stop and disable')
else:
message = Lang('disabled. To enable')
message = Lang('stopped. To start and enable')

inPane.AddWrappedTextField(Lang(
"This server can accept a remote login via ssh. Currently remote login is ") +
message + Lang(" this feature, press <Enter>."))
"This server can accept a remote login via ssh. Currently SSH service is ") +
message + Lang(" SSH service, press <Enter>."))

inPane.AddKeyHelpField( {
Lang("<Enter>") : Lang("Configure Remote Shell")
Expand Down