Unable to update a registered file

Open
#85 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api, backend

Research direction

Start with tests/test_versioning.py, especially test_register_update_file and update_file, then trace the request through nexussdk/files.py and nexussdk/utils/http.py. Reproduce the update against the stage environment and inspect the generated PUT URL and parameters. Done means updating a registered file creates the requested new version without the connection error.

Written by the indexing model from the issue text.

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".

Dominant language
Python
Stars
6
Forks
10
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BlueBrain/nexus-python-sdk

All issues in BlueBrain/nexus-python-sdk

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.