diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-05-18 18:57:32 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-18 18:57:32 +0200 |
commit | 7de7a1b2d127df85d4224162116c1d4c984b022b (patch) | |
tree | 4f892204cd98a69c5d1d8f1e6321ebe939497567 /src/etc/vmware-tools/scripts | |
parent | 041cea6d7a13a804b4e656778048bcefd0a46cb8 (diff) | |
download | vyos-1x-7de7a1b2d127df85d4224162116c1d4c984b022b.tar.gz vyos-1x-7de7a1b2d127df85d4224162116c1d4c984b022b.zip |
vmware: T1028: properly expose syslog identity
Diffstat (limited to 'src/etc/vmware-tools/scripts')
-rwxr-xr-x | src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py | 14 |
1 files changed, 7 insertions, 7 deletions
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 <http://www.gnu.org/licenses/>. 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() |