The VMWare resume scripts seem broken since T2467 since a change was made there which explicitly assumes that "command" is a string by splitting it: https://github.com/vyos/vyos-1x/blame/b5c608949719f4fcbf4234a0e8e52e5d7692b362/python/vyos/util.py#L27
However the VMWare resume script (https://github.com/vyos/vyos-1x/blob/current/src/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py#L53) executes commands as a list which gives the following error:
vyos@vyos:~$ sudo python3 /etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py
Traceback (most recent call last):
File "/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py", line 63, in <module>
apply(config)
File "/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py", line 48, in apply
run(cmd)
File "/usr/lib/python3/dist-packages/vyos/util.py", line 148, in run
decode=decode,
File "/usr/lib/python3/dist-packages/vyos/util.py", line 83, in popen
command = _add_sudo(command)
File "/usr/lib/python3/dist-packages/vyos/util.py", line 31, in _add_sudo
if _need_sudo(command):
File "/usr/lib/python3/dist-packages/vyos/util.py", line 27, in _need_sudo
return os.path.basename(command.split()[0]) in ('systemctl', )It's a bit odd to assume that command is a string since the function is documented as a wrapper around python's Popen which accepts a list. Adding autosudo=False from the resume script might fix this as well but having clear expectations/checks in the utils module would make more sense to me.