Skip to content
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

checksum verification fails if binary exists #29

Closed
andrewschoen opened this issue Sep 26, 2016 · 0 comments
Closed

checksum verification fails if binary exists #29

andrewschoen opened this issue Sep 26, 2016 · 0 comments

Comments

@andrewschoen
Copy link
Contributor

When using --force and re-uploading a binary the checksum verification step fails with an exception like:

Traceback (most recent call last):
  File "/tmp/venv.CzmM0ZXkCH/bin/chacractl", line 6, in <module>
    main.ChacraCtl()
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/chacractl/main.py", line 38, in __init__
    self.main(argv)
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/chacractl/decorators.py", line 68, in newfunc
    return f(*a, **kw)
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/chacractl/main.py", line 82, in main
    parser.dispatch()
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/tambo/dispatcher.py", line 21, in dispatch
    return instance.main()
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/chacractl/api/binaries.py", line 161, in main
    self.post(url, filename)
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/chacractl/api/binaries.py", line 86, in post
    return self.put(file_url, filepath)
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/chacractl/api/binaries.py", line 123, in put
    if not self.upload_is_verified(url, filename, digest):
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/chacractl/api/binaries.py", line 71, in upload_is_verified
    arch_data = r.json()
  File "/tmp/venv.CzmM0ZXkCH/lib/python2.7/site-packages/requests/models.py", line 826, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

This is because when chacractl uses PUT to re-upload, the url that it uses to get the checksum includes the binary name. This makes the url incorrect for the upload_is_verified method and it can not get at the binary data it expects to be in the json payload. In fact, there is no json at all at that endpoint.

This was found during this job: https://jenkins.ceph.com/job/ceph-dev-build/807/ARCH=x86_64,AVAILABLE_ARCH=x86_64,AVAILABLE_DIST=centos7,DIST=centos7,MACHINE_SIZE=huge/console

andrewschoen added a commit that referenced this issue Sep 26, 2016
A PUT request must include the binary filename so it can be overwritten,
however if we want to verify the checksum we need to trim that filename
and issue a GET to the arch endpoint to retrieve the metadata for the
binary.

Fixes: #29

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant