Commit 391a1ccc authored by Ashley Enstad's avatar Ashley Enstad Committed by Commit Bot

Fixing oauth token for histogram upload

We were passing the json {"token":"asdf...","expiry":123} instead of
just the token

Bug: 758632
Change-Id: Ic5bb57dcf608f2f00ba2cbee05271cc249927437
Reviewed-on: https://chromium-review.googlesource.com/935288
Commit-Queue: Ned Nguyen <nednguyen@google.com>
Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Reviewed-by: default avatarVadim Shtayura <vadimsh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539008}
parent 2ed56ca2
...@@ -20,12 +20,15 @@ def with_access_token(service_account_json): ...@@ -20,12 +20,15 @@ def with_access_token(service_account_json):
service_account_json: The path to the service account JSON file. service_account_json: The path to the service account JSON file.
""" """
fd, path = tempfile.mkstemp(suffix='.json', prefix='tok') fd, path = tempfile.mkstemp(suffix='.json', prefix='tok')
os.close(fd)
try: try:
args = ['luci-auth', 'token', '-json-output', path] args = ['luci-auth', 'token']
if service_account_json: if service_account_json:
args += ['-service-account-json', service_account_json] args += ['-service-account-json', service_account_json]
subprocess.check_call(args) subprocess.check_call(args, stdout=fd)
os.close(fd)
fd = None
yield path yield path
finally: finally:
if fd is not None:
os.close(fd)
os.remove(path) os.remove(path)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment