我试图在google chrome中运行一个遥测testing用例,这需要从google-cloud-storage下载一些testing文件。 当我运行testing用例时,出现以下错误。 错误说我必须在访问之前configurationgsutil,但即使在configurationgsutil和给定的步骤后,我也会得到相同的错误。 configurationgsutil后创build一个“.boto”文件。 所以我很笨,为什么我得到同样的错误。
PermissionError: Attempted to access a file from Cloud Storage but you don't have permission. To configure your credentials: 1. Run "tools/telemetry/third_party/gsutil/gsutil config" and follow its instructions. 2. If you have a @google.com account, use that account. 3. For the project-id, just enter 0. Locals: args : ['cp', 'gs://chrome-partner-telemetry/da1c09dd48dcd2eb76449d97c4fa38460d3a1e8d', '/home/sriram/android/chromeopensource/androidbuild/src/tools/perf/page_sets/tough_video_cases/crowd1080.mp4'] gsutil : <subprocess.Popen object at 0x30807d0> gsutil_env : None gsutil_path : 'tools/telemetry/third_party/gsutil/gsutil' stderr : 'AccessDeniedException: 403 Forbidden\n' stdout : ''
gsutil将使用〜/ .boto文件。 默认情况下,gsutil将在/etc/boto.cfg和〜/ .boto中查找configuration文件。
如果这些文件不存在,它将使用legacy_credentials。
您可以通过修改BOTO_PATH和BOTO_CONFIG环境参数来更改所有这些行为。
这里是关于如何使用这些环境variables的文档 。
BOTO_PATH:gsutil将按顺序加载在path中find的每个configuration文件。 如果你想在用户之间共享一个botoconfiguration,你可能想要使用这个环境variables。 一个例子是这样的:
BOTO_PATH=/etc/group/.boto.cfg:/home/user/.boto
BOTO_CONFIG:使用此variables来设置首选项顺序。 一个例子是这样的:
BOTO_CONFIG=~/testa/.boto:~/testb/.boto .
这将把首选项放在testa的boto文件中。 如果那不是那么那么gsutil会加载testingboto。
您的第三方工具不要求特定的项目ID:
For the project-id, just enter 0
我不知道这个工具,但是使用Google Cloud命令“ gsutil config ”创build了一个/home/<user>/.boto文件(可以编辑这个文件)。 你将被要求input一个项目ID以及“gcloud auth login”来注册一个“ gs_oauth2_refresh_token ”。
即使你正在使用第三方工具,它也必须或多或less地与其构build方式相同。 当启动gsutilconfiguration看看输出时,应该说你的boto文件是在哪里创build的。
我创build了一个与Google云“ gsutilconfiguration ”检查:
Boto config file "/home/eric/.boto" created. If you need to use a proxy to access the Internet please see the instructions in that file.
我的/.boto文件:
# This file contains credentials and other configuration information needed # by the boto library, used by gsutil. You can edit this file (eg, to add # credentials) but be careful not to mis-edit any of the variable names (like # "gs_access_key_id") or remove important markers (like the "[Credentials]" and # "[Boto]" section delimiters). # # This file was created by gsutil version 4.10 at 2015-03-16 19:48:14. .... gs_oauth2_refresh_token=xxxxxxxxxxxxxxxxxxxxxxxx ....
随时删除或更新此文件,您将始终能够在需要时使用“ gsutilconfiguration ”重新创build它。