Skip to content
This repository was archived by the owner on Nov 11, 2019. It is now read-only.
This repository was archived by the owner on Nov 11, 2019. It is now read-only.

tooltool.py client uploading is broken #2272

@lundjordan

Description

@lundjordan

Few issues:

I think our docs are very out of date for uploading. They still talk about tooltool tokens which do not exist anymore: https://wiki.mozilla.org/ReleaseEngineering/Applications/Tooltool#How_To_Upload_To_Tooltool

Next, I poked the client and saw that we did add support for accepting tc creds if the format was in json: https://github.com/mozilla/release-services/blob/master/src/tooltool/client/tooltool.py#L1019

So I tried this with after running add:
python2.7 tooltool.py upload --authentication-file=~/.tc_config.json --message "Bug 1589242 - Please upload Tesseract 4.0 zip to tooltool"

but, at least with python3, there seem to be a few bugs:

λ python tooltool.py upload --authentication-file=~/.tc_config.json --message "Bug 1589242 - Please upload Tesseract 4.0 zip to tooltool"
Traceback (most recent call last):
  File "tooltool.py", line 1378, in <module>
    sys.exit(main(sys.argv))
  File "tooltool.py", line 1374, in main
    return 0 if process_command(options, args) else 1
  File "tooltool.py", line 1260, in process_command
    options.get('region'))
  File "tooltool.py", line 1137, in upload
    resp = _send_batch(base_urls[0], auth_file, batch, region)
  File "tooltool.py", line 1042, in _send_batch
    _authorize(req, auth_file)
  File "tooltool.py", line 1025, in _authorize
    taskcluster_header = make_taskcluster_header(auth_file_content, req)
  File "tooltool.py", line 297, in make_taskcluster_header
    req.get_data(),
AttributeError: 'Request' object has no attribute 'get_data'

urllib dropped support for [get_data()](https://github.com/mozilla/release-services/blob/master/src/tooltool/client/tooltool.py#L297) so I tried with direct: data attr. Then I hit:

λ python tooltool.py upload --authentication-file=~/.tc_config.json --message "Bug 1589242 - Please upload Tesseract 4.0 zip to tooltool"
Traceback (most recent call last):
  File "tooltool.py", line 1378, in <module>
    sys.exit(main(sys.argv))
  File "tooltool.py", line 1374, in main
    return 0 if process_command(options, args) else 1
  File "tooltool.py", line 1260, in process_command
    options.get('region'))
  File "tooltool.py", line 1137, in upload
    resp = _send_batch(base_urls[0], auth_file, batch, region)
  File "tooltool.py", line 1042, in _send_batch
    _authorize(req, auth_file)
  File "tooltool.py", line 1025, in _authorize
    taskcluster_header = make_taskcluster_header(auth_file_content, req)
  File "tooltool.py", line 299, in make_taskcluster_header
    content_type='application/json',
  File "tooltool.py", line 201, in calculate_payload_hash
    p_hash.update(''.join(parts))
TypeError: sequence item 0: expected str instance, bytes found

For fear of going down the encoding py 2/3 rabbit hole, I'll pause here in case rok tested this elsewhere or has a better solution. I'm currently installing python2 to see if that works as the client suggests it supports both 2 and 3.

@garbas - any ideas?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions