Include enabled features in /v1/systeminfo output

Currently the /v1/systeminfo endpoint is largely useless and just
returns the version of the API as specified in setup.cfg. This commit
adds functionality to also return information about which features are
enabled in a specific backend's configuration.

Change-Id: I9934f656643bb764edc986231b198d92ddc66934
This commit is contained in:
Adam Coldrick 2019-03-15 10:44:23 +00:00 committed by Adam Coldrick
parent 04d086132d
commit c11547badd
3 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,5 @@
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2019 Codethink Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -41,5 +42,12 @@ class SystemInfoController(rest.RestController):
"""
sb_ver = VersionInfo('storyboard-api')
config = {
'enable_editable_comments': CONF.enable_editable_comments,
'enable_notifications': CONF.enable_notifications
}
return wmodels.SystemInfo(version=sb_ver.version_string())
return wmodels.SystemInfo(
config=config,
version=sb_ver.version_string()
)

View File

@ -64,12 +64,16 @@ class SystemInfo(base.APIBase):
"""Represents the system information for Storyboard
"""
config = {wtypes.text: bool}
"""Information about enabled features from configuration."""
version = wtypes.text
"""The application version."""
@classmethod
def sample(cls):
return cls(
config={"enable_editable_comments": True},
version="338c2d6")

View File

@ -28,4 +28,4 @@ class TestSystemInfo(base.FunctionalTest):
preferences work properly.
"""
response = self.get_json(self.resource)
self.assertEqual(1, len(response))
self.assertEqual(2, len(response))