BlueBrain / BlueBrain/nexus-python-sdk

Unable to update a registered file

Open
#85 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6
Forks
10
PR merge metrics
No merged PRs in 30d

Description

### Expected behavior

After I registered a new file in nexus, I want to update the content of a file (create a new version).

### Actual Behavior (please include screenshot if possible)

When trying to update the file, I get the following error

```
tests/test_versioning.py:135: in test_register_update_file
self.update_file(nexus, config, file_id)
tests/test_versioning.py:59: in update_file
file_id = file_id, filepath=file_path2, rev=1)
../../../../Envs/nexus/src/nexus-python-sdk/nexussdk/files.py:173: in update
return http_put(path, body=file_obj, data_type="file", rev=rev, storage=storage_id)
../../../../Envs/nexus/src/nexus-python-sdk/nexussdk/utils/http.py:166: in http_put
response = requests.put(full_url, headers=header, files=body, params=kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/api.py:131: in put
return request('put', url, data=data, **kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/api.py:60: in request
return session.request(method=method, url=url, **kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/sessions.py:533: in request
resp = self.send(prep, **send_kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/sessions.py:646: in send
r = adapter.send(request, **kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/adapters.py:498: in send
raise ConnectionError(err, request=request)
E requests.exceptions.ConnectionError: ('Connection aborted.', BrokenPipeError(32, 'Broken pipe'))
```

### Steps to reproduce the problem

1. I register a file 'brain.jpg' into nexus. That works, an ID example is https://staging.nexus.ocp.bbp.epfl.ch/v1/files/gpfs_tests/gpfs_tests/d7df3f2c-b5ea-431e-a75b-03760ac6dbbd
2. I try to update the version of that resource by using the python sdk as follows:

```
nexus.files.update(org_label="gpfs_tests", project_label="gpfs_tests", file_id = "https://staging.nexus.ocp.bbp.epfl.ch/v1/resources/gpfs_tests/gpfs_tests/_/d7df3f2c-b5ea-431e-a75b-03760ac6dbbd", filepath="/home/adietz/Work/10_NSE/1.10_gpfs_nexus/autotests/resources/DSC00728.JPG", rev=1)
```

This creates a `put` request for the url `http://staging.nexus.ocp.bbp.epfl.ch/v1/files/gpfs_tests/gpfs_tests/https%3A%2F%2Fstaging.nexus.ocp.bbp.epfl.ch%2Fv1%2Fresources%2Fgpfs_tests%2Fgpfs_tests%2F_%2F6272720f-0c5a-4691-a2ff-a01c4a8d8bce` with params = `{'rev': 1, 'storage': None}`

### Optional infrastructural data (user, platform, browser, environment, ...)

stage environment, org: "gpfs_tests", project: "gpfs_tests".

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.