summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-19 16:12:27 +0200
committerChristian Poessinger <christian@poessinger.com>2020-06-19 16:12:27 +0200
commit587416ef606827c5cbf6ac49834fc65283794fbb (patch)
treeeb600ee73115f881e2e332002d13f3727391cf48 /src/conf_mode
parenta9daaa8409347ad9e51d75f76f5985b8e9f2e365 (diff)
downloadvyos-1x-587416ef606827c5cbf6ac49834fc65283794fbb.tar.gz
vyos-1x-587416ef606827c5cbf6ac49834fc65283794fbb.zip
console-server: T2490: add SSH support for direct device access
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/service_console-server.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/conf_mode/service_console-server.py b/src/conf_mode/service_console-server.py
index 087b13c04..7f6967983 100755
--- a/src/conf_mode/service_console-server.py
+++ b/src/conf_mode/service_console-server.py
@@ -62,13 +62,14 @@ def verify(proxy):
if not proxy:
return None
- for tmp in proxy['device']:
- device = proxy['device'][tmp]
- if not device['speed']:
+ for device in proxy['device']:
+ keys = proxy['device'][device].keys()
+ if 'speed' not in keys:
raise ConfigError(f'Serial port speed must be defined for "{tmp}"!')
- if 'ssh' in device.keys():
- if 'port' not in device['ssh'].keys():
+ if 'ssh' in keys:
+ ssh_keys = proxy['device'][device]['ssh'].keys()
+ if 'port' not in ssh_keys:
raise ConfigError(f'SSH port must be defined for "{tmp}"!')
return None
@@ -81,8 +82,7 @@ def generate(proxy):
return None
def apply(proxy):
- call('systemctl stop conserver-server.service')
- call('systemctl stop dropbear@*.service')
+ call('systemctl stop dropbear@*.service conserver-server.service')
if not proxy:
if os.path.isfile(config_file):
@@ -93,7 +93,8 @@ def apply(proxy):
for device in proxy['device']:
if 'ssh' in proxy['device'][device].keys():
- call('systemctl restart dropbear@{device}.service')
+ port = proxy['device'][device]['ssh']['port']
+ call(f'systemctl restart dropbear@{device}.service')
return None