Add code to load appropriate config pieces

pull/1354/head
penrods 2017-12-22 02:34:01 -06:00 committed by Steve Penrod
parent 5fd05ad509
commit c88447a274
1 changed files with 15 additions and 0 deletions

View File

@ -34,6 +34,9 @@ class Api(object):
def __init__(self, path):
self.path = path
# Load the config, skipping the REMOTE_CONFIG since we are
# getting the info needed to get to it!
config = Configuration.get([DEFAULT_CONFIG,
SYSTEM_CONFIG,
USER_CONFIG],
@ -148,9 +151,15 @@ class DeviceApi(Api):
version = VersionManager.get()
platform = "unknown"
platform_build = ""
# load just the local configs to get platform info
config = Configuration.get([SYSTEM_CONFIG,
USER_CONFIG],
cache=False)
if "enclosure" in config:
platform = config.get("enclosure").get("platform", "unknown")
platform_build = config.get("enclosure").get("platform_build", "")
return self.request({
"method": "POST",
"path": "/activate",
@ -166,9 +175,15 @@ class DeviceApi(Api):
version = VersionManager.get()
platform = "unknown"
platform_build = ""
# load just the local configs to get platform info
config = Configuration.get([SYSTEM_CONFIG,
USER_CONFIG],
cache=False)
if "enclosure" in config:
platform = config.get("enclosure").get("platform", "unknown")
platform_build = config.get("enclosure").get("platform_build", "")
return self.request({
"method": "PATCH",
"path": "/" + self.identity.uuid,