Activate Service Account from GCloud

2019-07-24 04:45发布

问题:

I'm trying to configure a notification for a Google Cloud Storage bucket object change however I'm stuck when trying to make gsutil use a service account with this command.

gcloud auth activate-service-account service-account-email --key-file path/to/key.p12

The error I get in the command line is:

ERROR: (gcloud.auth.activate-service-account) PyOpenSSL is not available. If you have already installed PyOpenSSL, you will need to enable site packages by setting the environment variable CLOUDSDK_PYTHON_SITEPACKAGES to 1. If that does not work, See https://developers.google.com/cloud/sdk/crypto for details.

I followed this instructions to get pyOpenSSL. If I ask pip about that package it tells me it is installed

$ pip show pyopenssl
---
Name: pyOpenSSL
Version: 0.14
Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requires: cryptography, six

I also see the environment variable if I call the env command

$ env
...
CLOUDSDK_PYTHON_SITEPACKAGES=1

Am I doing something wrong?

回答1:

This indicates that PyOpenSSL was not properly installed. Since PyOpenSSL includes crypto routines, the Cloud SDK can not easily package it and we rely on third-party installation.