mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Use module settings from the config file.
This commit is contained in:
1 parent
2c3fe2ad4b
commit
45ca493ecf
4 files changed
+8
-19
No files matched your search
@@ -38,7 +38,6 @@ class VirtualBox(BaseManager):
|
||||
|
||||
super().__init__()
|
||||
self._vboxmanage_path = None
|
||||
self._vbox_user = None
|
||||
|
||||
@property
|
||||
def vboxmanage_path(self):
|
||||
@@ -50,16 +49,6 @@ class VirtualBox(BaseManager):
|
||||
|
||||
return self._vboxmanage_path
|
||||
|
||||
@property
|
||||
def vbox_user(self):
|
||||
"""
|
||||
Returns the VirtualBox user
|
||||
|
||||
:returns: username
|
||||
"""
|
||||
|
||||
return self._vbox_user
|
||||
|
||||
def find_vboxmanage(self):
|
||||
|
||||
# look for VBoxManage
|
||||
@@ -94,9 +83,10 @@ class VirtualBox(BaseManager):
|
||||
command = [vboxmanage_path, "--nologo", subcommand]
|
||||
command.extend(args)
|
||||
try:
|
||||
if self.vbox_user:
|
||||
vbox_user = self.config.get_section_config("VirtualBox").get("vbox_user")
|
||||
if vbox_user:
|
||||
# TODO: test & review this part
|
||||
sudo_command = "sudo -i -u {}".format(self.vbox_user) + " ".join(command)
|
||||
sudo_command = "sudo -i -u {}".format(vbox_user) + " ".join(command)
|
||||
process = yield from asyncio.create_subprocess_shell(sudo_command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||
else:
|
||||
process = yield from asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||
|
||||
Reference in new issue
Block a user