Page MenuHomeVyOS Platform

VMWare resume script syntax errors
Closed, ResolvedPublic


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:

However the VMWare resume script ( executes commands as a list which gives the following error:

[email protected]:~$ sudo python3 /etc/vmware-tools/scripts/resume-vm-default.d/
Traceback (most recent call last):
  File "/etc/vmware-tools/scripts/resume-vm-default.d/", line 63, in <module>
  File "/etc/vmware-tools/scripts/resume-vm-default.d/", line 48, in apply
  File "/usr/lib/python3/dist-packages/vyos/", line 148, in run
  File "/usr/lib/python3/dist-packages/vyos/", line 83, in popen
    command = _add_sudo(command)
  File "/usr/lib/python3/dist-packages/vyos/", line 31, in _add_sudo
    if _need_sudo(command):
  File "/usr/lib/python3/dist-packages/vyos/", 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.


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Behavior change
Issue type
Bug (incorrect behavior)

Event Timeline

Note that adding autosudo=False to the call to cmd does not fix this issue because this parameter is never passed to popen:

c-po triaged this task as Normal priority.
c-po added a project: VyOS 1.4 Sagitta.
c-po moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.
SrividyaA set Issue type to Bug (incorrect behavior).Aug 31 2021, 3:17 PM