-
Notifications
You must be signed in to change notification settings - Fork 19
fix node url for http #234
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
Conversation
|
Thank you for your submission. Can you provide more details about the multiple endpoints? Is that for http/https endpoints to the same resource? How are they advertised in the service |
|
Thank you for your question — here's a clarification: This issue is not caused by multiple endpoint URLs advertised by the VOSpace service. Instead, it's due to the internal logic in the Root Cause:When the registered VOSpace service uses an HTTP or HTTPS URI scheme in the config file (i.e. a non-CADC setup), the # Inside vos.py
if parts.scheme.startswith('http'):
return [uri] # This always returns a listAs a result, methods like mkdir and move pass this list into How to Reproduce:
Proposed Fix:In mkdir, move, and any similar methods, check if the returned uri is a list and, if so, use the first element. This safely handles the internal inconsistency without affecting behavior for CADC-style: URIs, which continue to return strings. |
|
Disclaimer - the If you are trying to use this in SRCNet, it might work with a bit of setup. If you can provide mode details about your use case, I can try to assist you. Where is the VOSpace service running? Does it have a |
|
Thank you again for the follow-up! Here's some additional context about the use case: VOSpace Service ConfigurationI'm using the This service is not part of CADC, and it will be available using an HTTP(S) URI. It does not use IVOA registry integration, so there is no Custom Client ConfigurationTo test and configure our VOSpace service, I debugged the client code and found that it's possible to specify an alternative config file path, using the following logic in _CONFIG_PATH = os.path.expanduser("~") + '/.config/vos/vos-config'
if os.getenv('VOSPACE_CONFIG_FILE', None):
_CONFIG_PATH = os.getenv('VOSPACE_CONFIG_FILE')So I set a custom config file for our server like this: import os
# Set the environment variable
os.environ['VOSPACE_CONFIG_FILE'] = './data/vos-config'With the following contents in Goal and Collaboration OpportunityRight now, we are aiming for basic VOSpace service compatibility. ###Tested Operations import os
import vos
os.environ['VOSPACE_CONFIG_FILE'] = os.environ["HOME"] + '/data/vos-config'
client = vos.Client()
client.listdir('http://localhost:8800/vospace/nodes/my_dir')
client.delete('http://localhost:8800/vospace/nodes/my_dir')
client.mkdir('http://localhost:8800/vospace/nodes/my_dir')
# Download file:
client.copy('http://localhost:8800/vospace/nodes/file.txt', 'user/my_dir/file.txt')
# Upload file:
client.copy('user/my_dir/file.txt', 'http://localhost:8800/vospace/nodes/my_dir/file.txt')
# Move file:
client.move('http://localhost:8800/vospace/nodes/my_dir/file.txt', 'http://localhost:8800/vospace/nodes/my_dir/file1.txt')
# Get node metadata:
client.get_node('http://localhost:8800/vospace/nodes/my_dir/file1.txt')All of these operations work correctly after applying the changes proposed in the following PRs: The I'm glad to share a minimal test setup or assist with any further steps to support non-CADC compatibility. Thanks again for considering this contribution! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #234 +/- ##
=======================================
Coverage ? 59.78%
=======================================
Files ? 21
Lines ? 2566
Branches ? 0
=======================================
Hits ? 1534
Misses ? 1032
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Sorry, I was off for a couple of days and couldn't respond earlier. I appreciate the detailed explanation. This is clearly a bug. I don't like the fix, but that A few points to consider:
Thank you for your contribution. I can merge as it is and I can craft a release too unless you are planning more testing. Again, this is old code, tuned to the CADC VOSpace services (and quite popular with its users). I've been planing however to re-implement this in |
|
Thanks for the follow-up. From my side, you can go ahead with the merge, as I’ve completed the necessary testing. I’d appreciate it if you could go ahead with a release as well. |
|
3.6.3 is published. Thanks for your contribution @SilviaSWR |
Description:
This PR improves compatibility of the vos library with VOSpace servers that return multiple endpoint URLs.
Key Fixes:
Updated mkdir and move methods to handle cases where get_node_url returns a list of URLs.
These methods now use only the first URL, avoiding failures when interacting with HTTP-based VOSpace services.
Impact:
Prevents errors when calling mkdir or move on non-CADC VOSpace servers.
Improves reliability and cross-server support in the vos client.
Testing:
Code was tested against a VOSpace server returning multiple URLs. Operations complete without error.
Issue:
#233