diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-05-18 18:57:52 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-18 18:59:38 +0200 |
commit | 935914b815012639af3910359a7f695de2052018 (patch) | |
tree | 37b54633ad16a03f0f5ae0e0aaca9189742c80d8 | |
parent | 75e5ce2d25b019a4d805217859dbb340a48f4713 (diff) | |
download | vyos-1x-935914b815012639af3910359a7f695de2052018.tar.gz vyos-1x-935914b815012639af3910359a7f695de2052018.zip |
vmware: T3525: fix invocation of resume script
Commit dce67433 ("util: T2226: rewrite resume-vm to use run") changed the way
in which the script executed system binaries in a way which could not be
processes by the underlayin infrastructure (lists are not supported, only
strings).
(cherry picked from commit fa05e4267c17d93c4e9594a0ba32e66c7b2a1d61)
-rwxr-xr-x | src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py | 15 |
1 files changed, 7 insertions, 8 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 111da5601..ec33906ba 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 @@ -26,15 +26,14 @@ def get_config(): interfaces = dict() for intf in c.list_effective_nodes('interfaces ethernet'): # skip interfaces that are disabled or is configured for dhcp - check_disable = "interfaces ethernet {} disable".format(intf) - check_dhcp = "interfaces ethernet {} address dhcp".format(intf) + check_disable = f'interfaces ethernet {intf} disable' + check_dhcp = f'interfaces ethernet {intf} address dhcp' if c.exists_effective(check_disable): continue # get addresses configured on the interface intf_addresses = c.return_effective_values( - "interfaces ethernet {} address".format(intf) - ) + f'interfaces ethernet {intf} address') interfaces[intf] = [addr.strip("'") for addr in intf_addresses] return interfaces @@ -44,16 +43,16 @@ def apply(config): for intf, addresses in config.items(): # bring the interface up - cmd = ["ip", "link", "set", "dev", intf, "up"] + cmd = f'ip link set dev {intf} up' syslog.syslog(cmd) run(cmd) # add configured addresses to interface for addr in addresses: - if addr == "dhcp": - cmd = ["dhclient", intf] + if addr == 'dhcp': + cmd = ['dhclient', intf] else: - cmd = ["ip", "address", "add", addr, "dev", intf] + cmd = f'ip address add {addr} dev {intf}' syslog.syslog(cmd) run(cmd) |