I was getting a similar error both on installation and on certain commands on another previously working installation. After poking around and adding some logs, it looks like SSL Cert Verification is failing for the component listing request from Google's servers:
$ gcloud preview managed-instance-groups ...
You do not currently have this command group installed. Using it requires the installation of components: [preview]
Could not fetch [https://dl.google.com/dl/cloudsdk/release/components-2.json]
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
ERROR: (gcloud) Failed to fetch component listing from server. Check your network settings and try again.
To solve it (in a way that is almost certainly inadvisable), I disabled SSL Cert Validation for that single request. If you want to go down this path, modify MakeRequest()
in
./google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py:248
from:
return urllib2.urlopen(req, timeout=TIMEOUT_IN_SEC)
to:
return urllib2.urlopen(req, timeout=TIMEOUT_IN_SEC, context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))
(There's an issue opened for this at https://code.google.com/p/google-cloud-sdk/issues/detail?id=143.)
UPDATE: 26/05/15
In my case, this turned out to be a mismatch between my installed version of OpenSSL and the version of OpenSSL referenced by Python (this may have started happening after updating to OpenSSL@1.0.2a-1
).
To resolve this, I updated my version of OpenSSL to the latest:
brew update
brew upgrade openssl
Then I reinstalled Python referencing this updated version of OpenSSL:
brew uninstall python
brew install python --with-brewed-openssl
After this, I nuked by Google Cloud SDK install (because I was mucking around in there a bit to find a solution; you might not have to do this) and installed from scratch:
curl https://sdk.cloud.google.com | bash
And we're golden!
For further reading on these OpenSSL issues with OS X, check out this article: https://hynek.me/articles/apple-openssl-verification-surprises/