mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Adding updates for python3 compatibility and new virtualbox SDK version support.
This commit is contained in:
parent
cebcd6d069
commit
91252bac95
1 changed files with 13 additions and 1 deletions
|
@ -132,6 +132,12 @@ def vb_get_manager():
|
|||
'''
|
||||
global _virtualboxManager
|
||||
if _virtualboxManager is None and HAS_LIBS:
|
||||
try:
|
||||
from importlib import reload
|
||||
except ImportError:
|
||||
# If we get here, we are in py2 and reload is a built-in.
|
||||
pass
|
||||
|
||||
# Reloading the API extends sys.paths for subprocesses of multiprocessing, since they seem to share contexts
|
||||
reload(vboxapi)
|
||||
_virtualboxManager = vboxapi.VirtualBoxManager(None, None)
|
||||
|
@ -146,7 +152,13 @@ def vb_get_box():
|
|||
@rtype: IVirtualBox
|
||||
'''
|
||||
vb_get_manager()
|
||||
vbox = _virtualboxManager.vbox
|
||||
|
||||
try:
|
||||
# This works in older versions of the SDK, but does not seem to work anymore.
|
||||
vbox = _virtualboxManager.vbox
|
||||
except AttributeError:
|
||||
vbox = _virtualboxManager.getVirtualBox()
|
||||
|
||||
return vbox
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue