From 7de7a1b2d127df85d4224162116c1d4c984b022b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 18 May 2021 18:57:32 +0200 Subject: vmware: T1028: properly expose syslog identity --- .../scripts/resume-vm-default.d/ether-resume.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py b/src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py index dc751c45c..111da5601 100755 --- a/src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py +++ b/src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2018-2020 VyOS maintainers and contributors +# Copyright (C) 2018-2021 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -15,13 +15,12 @@ # along with this program. If not, see . import sys -import syslog as sl +import syslog from vyos.config import Config from vyos import ConfigError from vyos.util import run - def get_config(): c = Config() interfaces = dict() @@ -39,12 +38,14 @@ def get_config(): interfaces[intf] = [addr.strip("'") for addr in intf_addresses] return interfaces - def apply(config): + syslog.openlog(ident='ether-resume', logoption=syslog.LOG_PID, + facility=syslog.LOG_INFO) + for intf, addresses in config.items(): # bring the interface up cmd = ["ip", "link", "set", "dev", intf, "up"] - sl.syslog(sl.LOG_NOTICE, " ".join(cmd)) + syslog.syslog(cmd) run(cmd) # add configured addresses to interface @@ -53,10 +54,9 @@ def apply(config): cmd = ["dhclient", intf] else: cmd = ["ip", "address", "add", addr, "dev", intf] - sl.syslog(sl.LOG_NOTICE, " ".join(cmd)) + syslog.syslog(cmd) run(cmd) - if __name__ == '__main__': try: config = get_config() -- cgit v1.2.3