Added command line calls to enable/ disable ssh
Fixed issue where ssh.enable was emitting wrong message Tested mycroft.dialog.get modified: mycroft/client/enclosure/__init__.py modified: mycroft/client/wifisetup/main.pypull/754/head
parent
2e1e6a07bb
commit
7bde4a78d0
|
@ -138,6 +138,7 @@ class EnclosureReader(Thread):
|
|||
'rm ~/.mycroft/identity/identity2.json',
|
||||
shell=True)
|
||||
self.ws.emit(Message("mycroft.wifi.reset"))
|
||||
self.ws.emit(Message("mycroft.disable.ssh"))
|
||||
self.ws.emit(Message("speak", {
|
||||
'utterance': mycroft.dialog.get("reset to factory defaults")}))
|
||||
time.sleep(5)
|
||||
|
|
|
@ -275,7 +275,8 @@ class WiFi:
|
|||
self.ws.on('mycroft.wifi.reset', self.reset)
|
||||
|
||||
# an event to enable SSH
|
||||
self.ws.on('enclosure.enable.ssh', self.ssh)
|
||||
self.ws.on('mycroft.enable.ssh', self.ssh_enable)
|
||||
self.ws.on('mycroft.disable.ssh', self.ssh_disable)
|
||||
|
||||
# These events are generated by Javascript in the captive
|
||||
# portal.
|
||||
|
@ -571,10 +572,18 @@ class WiFi:
|
|||
except Exception as e:
|
||||
LOG.error("Error: {0}".format(e))
|
||||
|
||||
def ssh(self, event=None):
|
||||
def ssh_enable(self, event=None):
|
||||
LOG.info("Enabling SSH")
|
||||
try:
|
||||
call('sudo touch /boot/ssh', shell=True)
|
||||
call('touch /boot/ssh', shell=True)
|
||||
except Exception as e:
|
||||
LOG.error("Error: {0}".format(e))
|
||||
|
||||
def ssh_disable(self, event=None):
|
||||
LOG.info("Disabling SSH")
|
||||
try:
|
||||
call('rm /boot/ssh', shell=True)
|
||||
call('systemctl disable ssh.service', shell=True)
|
||||
except Exception as e:
|
||||
LOG.error("Error: {0}".format(e))
|
||||
|
||||
|
|
Loading…
Reference in New Issue