diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 6e25b40..29df26c 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1,3 +1,3 @@ -__version__ = "4.1.8.a9" +__version__ = "4.1.8.a10" __codename__ = "Groundhog Day" diff --git a/cbpi/controller/config_controller.py b/cbpi/controller/config_controller.py index bb1b5b0..b0324b2 100644 --- a/cbpi/controller/config_controller.py +++ b/cbpi/controller/config_controller.py @@ -78,3 +78,15 @@ class ConfigController: json.dump(data, file, indent=4, sort_keys=True) self.cache=self.testcache + async def remove_obsolete(self): + result = {} + for key, value in self.cache.items(): + if (value.source not in ('craftbeerpi','steps','hidden')): + test = await self.cbpi.plugin.load_plugin_list(value.source) + if test == []: + update=self.get(str(value.source)+'_update') + if update: + await self.remove(str(value.source)+'_update') + await self.remove(key) + result[key] = value.to_dict() + return result \ No newline at end of file diff --git a/cbpi/http_endpoints/http_config.py b/cbpi/http_endpoints/http_config.py index fc2d643..ace5f17 100644 --- a/cbpi/http_endpoints/http_config.py +++ b/cbpi/http_endpoints/http_config.py @@ -102,4 +102,17 @@ class ConfigHttpEndpoints: name = request.match_info['name'] await self.controller.remove(name=name) - return web.Response(status=200) \ No newline at end of file + return web.Response(status=200) + + @request_mapping(path="/obsolete", auth_required=False) + async def http_remove_obsolete(self, request) -> web.Response: + """ + --- + description: Get all config parameters + tags: + - Config + responses: + "200": + description: successful operation + """ + return web.json_response(await self.controller.remove_obsolete(), dumps=json_dumps) \ No newline at end of file