-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added version checker for correct cb version #190 #200
base: master
Are you sure you want to change the base?
Changes from 1 commit
02f30c9
b2b6236
15eba57
9420677
6fbaa50
13ea081
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,22 @@ def get_version(self) -> Dict: | |
self.logger.error(err) | ||
raise | ||
|
||
def _check_correct_cb_version(self) -> None: | ||
""" | ||
Checks whether Orion version is >= 3.6.0, since breaking change was introduced there which introduced new | ||
option, which is implemented in FiLiP, but won't work with lower orion versions. | ||
""" | ||
orion_version = self.get_version()['orion']['version'] | ||
if version.parse(orion_version) < version.parse('3.6.0'): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think some significant changes have also been made in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @djs0109 @jkriwet I think that it is worth having a look at the changes: https://github.com/telefonicaid/fiware-orion/releases. If introducing such bounds would also mean creating the issues to support the features in coming versions. |
||
warnings.warn( | ||
f"You are using orion version {orion_version}. There was a breaking change in Orion Version 3.6.0," | ||
f"which changed the default metadata update semantics and introduced the 'overrideMetadata' option. " | ||
f"See https://github.com/telefonicaid/fiware-orion/releases/tag/3.6.0 for further details. " | ||
f"In your used version {orion_version}, this option is not supported. This will only be a problem, if" | ||
f" you try to set the 'overrideMetadata' option in FiLiP (implemented since v0.2.3)." | ||
) | ||
|
||
|
||
def get_resources(self) -> Dict: | ||
""" | ||
Gets reo | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can reused the code on L1200