libvirt: use kvm-ok from PATH - #3860
Conversation
ipspace
left a comment
There was a problem hiding this comment.
Nice catch, thanks a million. However, I'm worried about existing installations that do not have /usr/sbin in the path. How about we go with which kvm-ok || stat /usr/sbin/kvm-ok and kvm-ok || /usr/sbin/kvm-ok?
|
I've tried and unfortunately it doesn't work. I've even tried Yes, if isinstance(cmd,str):
try:
cmd = shlex.split(cmd)
...
try:
result = subprocess.run(
cmd,
...I see no options to run it with shell interpretation. Thanks for quick reply! |
The craziest thing is that it works for me :( Anyway, what if we fix the documentation instead (because most people use Ubuntu anyway):
|
Exteremely interesting how :) [I've updated PR, rest of this comment is outdated, see next one]
|
Docs (see docs/install/linux.md) state that kvm-ok should be in PATH and it seems logical, but /usr/sbin/kvm-ok is hardcoded instead, which may not be the case for userspace script or just not available under OS (e.g. NixOS). In addition to hardcoded `/usr/sbin/kvm-ok` (left for backward compatibility in case it is not in PATH), add `which kvm-ok` to check if it is available and add a normal call to `kvm-ok` to run it from PATH.
d1d671e to
24389cf
Compare
|
I've updated PR with simple
I think/hope that relying on presence of |
Docs (see docs/install/linux.md) state that kvm-ok should be in PATH and it seems logical, but
/usr/sbin/kvm-okis hardcoded instead, which may not be the case for userspace script or just not available under OS (e.g. NixOS).Replace hardcoded path with
which kvm-okto check if it is available and just with callkvm-okto run it from PATH.