New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 635803 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Long OOO (go/where-is-mgiuca)
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

generate_token.py should look in its own dir for the default key, not the CWD

Project Member Reported by mgiuca@chromium.org, Aug 9 2016

Issue description

What steps will reproduce the problem?
From the top-level Chrome dir, run:
tools/origin_trials/generate_token.py http://localhost:8000 MyFeature

What is the expected output?
It generates a token using tools/origin_trials/eftest.key as the private key.

What do you see instead?
IOError: [Errno 2] No such file or directory: 'eftest.key'

It should be looking relative to __file__, not the CWD.
 
If we do this, should we also make "--test-key-file" relative to the __file__ dir as well, or should it be relative to $CWD as it currently is?
I would expect "--key-file" to be relative to $CWD.

If a developer is overriding the key file, it seems likely they would store the key file somewhere other than the tools/origin_trials directory (so the key is not included/deleted by source control operations in their chromium checkout).

In that case, some common invocations could be:
[From the top-level Chrome dir]:
tools/origin_trials/generate_token.py --key-file ~/some/path/to/my-key http://localhost:8000 MyFeature
tools/origin_trials/generate_token.py --key-file ../../some/path/to/my-key http://localhost:8000 MyFeature

[From the dir storing the key]:
<path to chromium dir>/tools/origin_trials/generate_token.py --key-file my-key http://localhost:8000 MyFeature

In many of the examples above, the script would not find the custom key file. 

Comment 3 by mgiuca@chromium.org, Aug 10 2016

Sorry, I never meant that --key-file should be relative to __file__ (it should certainly be relative to $PWD). Just the default location (so that the script does not require you to be in tools/origin_trials to run without --key-file).

Comment 4 by mgiuca@chromium.org, Aug 10 2016

Status: Started (was: Assigned)
CL: https://codereview.chromium.org/2230673002/
Re: #2, #3 -- that makes sense, and I completely agree. This change should only be for the default file location.
Project Member

Comment 6 by bugdroid1@chromium.org, Aug 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/84e0cd2dcb47e334341c2846890e156b3a7ab4c6

commit 84e0cd2dcb47e334341c2846890e156b3a7ab4c6
Author: mgiuca <mgiuca@chromium.org>
Date: Wed Aug 10 05:47:22 2016

origin_trials/generate_token.py: Look for default key in script dir.

Only matters if you don't use --key-file. This allows the script to be
run from anywhere, rather than needing to be cd'd to
tools/origin_trials.

BUG= 635803 

Review-Url: https://codereview.chromium.org/2230673002
Cr-Commit-Position: refs/heads/master@{#410970}

[modify] https://crrev.com/84e0cd2dcb47e334341c2846890e156b3a7ab4c6/tools/origin_trials/generate_token.py

Comment 7 by mgiuca@chromium.org, Aug 10 2016

Status: Fixed (was: Started)

Sign in to add a comment