From fa05e4267c17d93c4e9594a0ba32e66c7b2a1d61 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 18 May 2021 18:57:52 +0200 Subject: 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). --- .../scripts/resume-vm-default.d/ether-resume.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/etc/vmware-tools/scripts/resume-vm-default.d') 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) -- cgit v1.2.3