I have a command /usr/bin/virsh dumpxml <UUID>
that I need to run inside of a python program, the thing is that the command needs to run like sudo -u <user> sudo /usr/bin/virsh dumpxml <UUID>
, I try to call it with the following code:
cmd = "sudo -u <user> sudo /usr/bin/virsh dumpxml %s" % uuid
data = os.popen(cmd).read()
...
But I'm getting an error message indicating that the domain is not found, but, if I run the same command from the bash, it works fine.
The /usr/bin/virsh dumpxml
command is inside the /etc/sudoers.d/
Also, I need to run with the second 'sudo' because if not, it won't work
Any ideas?