【发布时间】:2015-07-06 22:51:18
【问题描述】:
每个人。
我在尝试授权我的 Compute Engine 实例以租用任务队列队列中的任务时遇到问题。
我在实例创建配置中包含了必要的范围(我认为):
"metadata": {
"kind": "compute#metadata",
"items": [
{
"key": "startup-script-url",
"value": "[MY-STARTUP-SCRIPT]"
},
{
"key": "service_account_scopes",
"value": "https://www.googleapis.com/auth/cloud-platform"
}
]
},
"serviceAccounts": [
{
"email": "[MY-SERVICE-ACCOUNT]",
"scopes": [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/taskqueue",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/compute"
]
}
同样在我的 queue.yaml 中,我已将相同的服务帐户添加到带有“user_email”属性的 acl 指令中:
queue:
- name: [MY-QUEUELIST]
mode: pull
retry_parameters:
task_retry_limit: 5
acl:
- user_email: [MY-COMPUTE-ENGINE-SERVICE-ACCOUNT]
最后,我在我的实例上运行的脚本使用 GoogleCredentials.get_application_default() 函数来获取凭据。此凭据作为参数传递给 build() 方法(如此处所述:https://cloud.google.com/compute/docs/authentication):
最终结果是,当我尝试列出给定任务队列的任务时,出现此错误:
googleapiclient.errors.HttpError:https://www.googleapis.com/tasks/v1/lists/documentation-compiler-queue/tasks?alt=json 返回“权限不足”>
我错过了什么?!
提前致谢。
【问题讨论】:
标签: google-app-engine authorization google-compute-engine task-queue