google-compute-engine – gcloud auth throws PyOpenSSL不可用

我一直试图让gcloud在Travis上处于可用状态,我似乎无法通过gcloud auth activate-service-account点.

什么时候它运行我只是得到以下错误:

ERROR: (gcloud.auth.activate-service-account) PyOpenSSL is not available. 
See https://developers.google.com/cloud/sdk/crypto for details.

我已尝试使用导出CLOUDSDK_PYTHON_SITEPACKAGES = 1设置apt-get和pip安装,似乎没有任何工作.

有没有人有任何想法或替代方案?

这是Travis版Ubuntu 14.04.

更新

如果我从travis上的文档运行命令,我会收到以下错误:

usage: gcloud auth activate-service-account  ACCOUNT --key-file KEY_FILE [optional flags]
ERROR: (gcloud.auth.activate-service-account) too few arguments

这让我觉得我必须有一个ACCOUNT参数,但是在使用未加密的服务帐户密钥在本地运行命令之后,我知道不需要它(除非发生了某些变化).

我能想到的另一件事是文件没有被正确解密或者命令本身在Travis中不满意:

- gcloud auth activate-service-account --key-file client-secret.json

更新2

只是倾倒了大量的日志来计算正在发生的事情. (大声喊出@Vilas的帮助)

看起来gcloud已经安装在VM上用于节点,但它是一个超级旧版本.

$which gcloud
/usr/bin/gcloud

$gcloud --version
Google Cloud SDK 0.9.37
bq 2.0.18
bq-nix 2.0.18
compute 2014.11.25
core 2014.11.25
core-nix 2014.11.25
dns 2014.11.25
gcutil 1.16.5
gcutil-nix 1.16.5
gsutil 4.6
gsutil-nix 4.6
sql 2014.11.25

接下来的问题是我如何才能找到合适的gcloud路径?

我已通过运行此命令确认已下载的SDK安装到${HOME} / google-cloud-sdk / bin.

$ls -l ${HOME}/google-cloud-sdk/bin
total 24
drwxr-xr-x 2 travis travis 4096 Apr 27 21:44 bootstrapping
-rwxr-xr-x 1 travis travis 3107 Mar 28 14:53 bq
-rwxr-xr-x 1 travis travis  912 Apr 21 18:56 dev_appserver.py
-rwxr-xr-x 1 travis travis 3097 Mar 28 14:53 gcloud
-rwxr-xr-x 1 travis travis 3144 Mar 28 14:53 git-credential-gcloud.sh
-rwxr-xr-x 1 travis travis 3143 Mar 28 14:53 gsutil

最佳答案 我终于找到了解决方案.基本上Travis安装了一个超级旧版本的gcloud SDK,它主要负责下载的SDK.

帮助诊断的步骤

>在.travis.yml文件中添加:

env:
  global:
    # Ensure the downloaded SDK is first on the PATH
    - PATH=${HOME}/google-cloud-sdk/bin:$PATH
    # Ensure the install happens without prompts
    - CLOUDSDK_CORE_DISABLE_PROMPTS=1

>然后在安装步骤中添加以下内容:

install:
# Make sure SDK is downloaded - cache once it's working
# NOTE: Note sure how to update the SDK if it's cached
- curl https://sdk.cloud.google.com | bash;
# List the SDK contents to ensure it's downloaded
- ls -l ${HOME}/google-cloud-sdk/bin
# Ensure the correct gcloud is being used
- which gcloud
# Print the gcloud version and make sure it's something
# Reasonably up to date compared with: 
# https://cloud.google.com/sdk/downloads#versioned
- gcloud --version
点赞