diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8c0be2..1c6bd2ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -#### v0.2.5 +#### v0.2.6 - fixed inconsistency of `entity_type` as required argument ([#188](https://github.com/RWTH-EBC/FiLiP/issues/188)) +- add warning if ``Orion`` version is not supported ([#200](https://github.com/RWTH-EBC/FiLiP/issues/200)) #### v0.2.5 - fixed service group edition not working ([#170](https://github.com/RWTH-EBC/FiLiP/issues/170)) diff --git a/filip/clients/ngsi_v2/cb.py b/filip/clients/ngsi_v2/cb.py index 3d7fe1bf..c8a98ac8 100644 --- a/filip/clients/ngsi_v2/cb.py +++ b/filip/clients/ngsi_v2/cb.py @@ -12,6 +12,7 @@ PositiveFloat, \ AnyHttpUrl from typing import Any, Dict, List , Optional, TYPE_CHECKING, Union +from packaging import version import re import requests from urllib.parse import urljoin @@ -74,6 +75,8 @@ def __init__(self, fiware_header=fiware_header, **kwargs) + self._check_correct_cb_version() + def __pagination(self, *, method: PaginationMethod = PaginationMethod.GET, @@ -157,6 +160,20 @@ def get_version(self) -> Dict: self.logger.error(err) raise + def _check_correct_cb_version(self) -> None: + """ + Checks whether the used Orion version is greater or equal than the minimum required orion version of + the current filip version + """ + orion_version = self.get_version()['orion']['version'] + if version.parse(orion_version) < version.parse(settings.minimum_orion_version): + warnings.warn( + f"You are using orion version {orion_version}. There was a breaking change in Orion Version " + f"{settings.minimum_orion_version}, therefore functionality is not assured when using " + f"version {orion_version}." + ) + + def get_resources(self) -> Dict: """ Gets reo diff --git a/filip/config.py b/filip/config.py index db072518..8a129b92 100644 --- a/filip/config.py +++ b/filip/config.py @@ -21,6 +21,7 @@ class Settings(BaseSettings): QL_URL: AnyHttpUrl = Field(default="http://127.0.0.1:8668", env=['QUANTUMLEAP_URL', 'QL_URL']) + minimum_orion_version: str = '3.6.0' class Config: env_file = '.env.filip' env_file_encoding = 'utf-8'