environment/get_device_db: raise ValueError when device manager not present

This commit is contained in:
Sebastien Bourdeauducq 2016-04-16 19:38:46 +08:00
parent 398468410f
commit 9b4a04b307
1 changed files with 2 additions and 0 deletions

View File

@ -229,6 +229,8 @@ class HasEnvironment:
"""Returns the full contents of the device database."""
if self.__parent is not None:
return self.__parent.get_device_db()
if self.__device_mgr is None:
raise ValueError("Device manager not present")
return self.__device_mgr.get_device_db()
def get_device(self, key):