-
Notifications
You must be signed in to change notification settings - Fork 25
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
Check for version compatibility on login #329
Check for version compatibility on login #329
Conversation
src/resdk/resolwe.py
Outdated
@@ -48,6 +50,7 @@ | |||
DEFAULT_URL = "http://localhost:8000" | |||
AUTOMATIC_LOGIN_POSTFIX = "saml-auth/api-login/" | |||
INTERACTIVE_LOGIN_POSTFIX = "saml-auth/remote-login/" | |||
MINIMAL_SUPPORTED_VERSION_POSTFIX = "api/reskd_minimal_supported_version" |
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.
Typo in the URL.
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.
Fixed.
src/resdk/resolwe.py
Outdated
response = requests.get(url) | ||
minimal_version = version.parse(response.data["minimal_supported_version"]) | ||
my_version = version.parse(package_version("resdk")) | ||
# TODO: probably some warning must be printed here? |
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.
Remove the comment.
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.
Done.
src/resdk/resolwe.py
Outdated
# TODO: probably some warning must be printed here? | ||
if my_version < minimal_version: | ||
message = ( | ||
f"Warning: your version of ReSDK ({my_version}) is not compatible with " |
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.
Add steps to update the package.
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.
Done.
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.
I agree with comments from @dblenkus . Also, let's test this when the endpoint becomes operational on QA.
57f7488
to
429e836
Compare
src/resdk/resolwe.py
Outdated
@@ -48,6 +50,7 @@ | |||
DEFAULT_URL = "http://localhost:8000" | |||
AUTOMATIC_LOGIN_POSTFIX = "saml-auth/api-login/" | |||
INTERACTIVE_LOGIN_POSTFIX = "saml-auth/remote-login/" | |||
MINIMAL_SUPPORTED_VERSION_POSTFIX = "api/resdk_minigmal_supported_version" |
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.
New typo (minigmal
)
:-)
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.
Fix this typo.
src/resdk/resolwe.py
Outdated
def version_check(self): | ||
"""Check that the server is compatible with the client.""" | ||
url = urljoin(self.url, MINIMAL_SUPPORTED_VERSION_POSTFIX) | ||
response = requests.get(url) |
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.
Does the code below work if case the response does not contain data
or it does not have 200-ish HTTP response code?
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.
Two small fixes and we are good to go.
src/resdk/resolwe.py
Outdated
@@ -48,6 +50,7 @@ | |||
DEFAULT_URL = "http://localhost:8000" | |||
AUTOMATIC_LOGIN_POSTFIX = "saml-auth/api-login/" | |||
INTERACTIVE_LOGIN_POSTFIX = "saml-auth/remote-login/" | |||
MINIMAL_SUPPORTED_VERSION_POSTFIX = "api/resdk_minigmal_supported_version" |
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.
Fix this typo.
src/resdk/resolwe.py
Outdated
"""Check that the server is compatible with the client.""" | ||
url = urljoin(self.url, MINIMAL_SUPPORTED_VERSION_POSTFIX) | ||
response = requests.get(url) | ||
minimal_version = version.parse(response.data["minimal_supported_version"]) |
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.
This currently fails with: AttributeError: 'Response' object has no attribute 'data'
If you replace response.data
with response.json()
it works as expected.
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.
@JureZmrzlikar Thank you for testing. I have changed the code according to your suggestions.
429e836
to
2904240
Compare
2904240
to
f08867b
Compare
8745770
to
0fc4eff
Compare
0fc4eff
to
62ecc31
Compare
EXP-778