From 1ac0de4c524b9632eb221ce88f4d35af06069aa3 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 29 Nov 2019 17:52:29 +0100 Subject: geneve: T1799: remove unused import statements --- src/conf_mode/interfaces-geneve.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/conf_mode/interfaces-geneve.py b/src/conf_mode/interfaces-geneve.py index ba684b553..7322e0c50 100755 --- a/src/conf_mode/interfaces-geneve.py +++ b/src/conf_mode/interfaces-geneve.py @@ -19,10 +19,8 @@ import os from sys import exit from copy import deepcopy -from vyos.configdict import list_diff from vyos.config import Config from vyos.ifconfig import GeneveIf, Interface -from vyos.interfaces import get_type_of_interface from vyos import ConfigError from netifaces import interfaces -- cgit v1.2.3 From 41212805fa9db0db590b8207372a3d2ec7382fef Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 29 Nov 2019 17:52:45 +0100 Subject: vxlan: T1636: remove unused import statements --- src/conf_mode/interfaces-vxlan.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index 30ff1755d..c1fedc824 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -19,10 +19,8 @@ import os from sys import exit from copy import deepcopy -from vyos.configdict import list_diff from vyos.config import Config from vyos.ifconfig import VXLANIf, Interface -from vyos.interfaces import get_type_of_interface from vyos import ConfigError from netifaces import interfaces -- cgit v1.2.3 From 145b937d3d8e3734d987b5486fe861f660c6e79b Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Tue, 26 Nov 2019 11:51:54 -0600 Subject: T1801: move escaping of backslashes into configtree --- python/vyos/config.py | 6 ------ python/vyos/configtree.py | 7 +++++++ python/vyos/util.py | 6 ------ src/helpers/vyos-merge-config.py | 3 --- src/services/vyos-http-api-server | 2 -- src/utils/vyos-config-to-commands | 8 -------- 6 files changed, 7 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/python/vyos/config.py b/python/vyos/config.py index e6a41a92d..13b2c107e 100644 --- a/python/vyos/config.py +++ b/python/vyos/config.py @@ -69,7 +69,6 @@ import json import subprocess import vyos.configtree -import vyos.util class VyOSError(Exception): @@ -112,11 +111,6 @@ class Config(object): else: session_config_text = running_config_text - # The output of showConfig does not escape backslashes, as is expected - # by ConfigTree(). - session_config_text = vyos.util.escape_backslash(session_config_text) - running_config_text = vyos.util.escape_backslash(running_config_text) - self._session_config = vyos.configtree.ConfigTree(session_config_text) self._running_config = vyos.configtree.ConfigTree(running_config_text) diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index 77cffe90b..0274f3573 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -18,6 +18,12 @@ import json from ctypes import cdll, c_char_p, c_void_p, c_int +def escape_backslash(string: str) -> str: + """Escape single backslashes in string that are not in escape sequence""" + p = re.compile(r'(? bool: current_user = getpass.getuser() (_, _, _, admin_group_members) = grp.getgrnam('sudo') return current_user in admin_group_members - -def escape_backslash(string: str) -> str: - """Escape single backslashes in string that are not in escape sequence""" - p = re.compile(r'(? Date: Wed, 4 Dec 2019 18:09:57 +0200 Subject: shutdown: T1826: Modify cancel reboot msg --- src/op_mode/powerctrl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py index e3644e063..46ebf5ffb 100755 --- a/src/op_mode/powerctrl.py +++ b/src/op_mode/powerctrl.py @@ -60,7 +60,11 @@ def check_shutdown(): def cancel_shutdown(): try: - cmd = check_output(["/sbin/shutdown","-c"]) + timenow = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + cmd = check_output(["/sbin/shutdown","-c","--no-wall"]) + message = "Reboot scheduled has been cancelled %s" % timenow + #Generate broadcast message about cancel reboot + os.system("wall %s" % message) except CalledProcessError as e: sys.exit("Error aborting shutdown: %s" % e) @@ -105,7 +109,7 @@ def execute_shutdown(time, reboot = True, ask=True): else: sys.exit("Could not decode time and date") - print(cmd.decode().split(",",1)[0]) + check_shutdown() def chk_vyatta_based_reboots(): ### T870 commit-confirm is still using the vyatta code base, once gone, the code below can be removed -- cgit v1.2.3