0
我試圖使用libcloud(1.3.0)使用下面的代碼連接到我的GCE項目:無法驗證使用libcloud GCE驅動
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
USER_ID = "[email protected]"
KEYFILE = "./xxxxxxx.json"
PROJECT = "project1"
cls = get_driver(Provider.GCE)
driver = cls(USER_ID, KEYFILE, project = PROJECT)
這只是失敗,內部PyCrypto一個AttributeError(I」 m跑V2.6.1):
Traceback (most recent call last):
File "g.py", line 9, in <module>
driver = cls(USER_ID, KEYFILE, project = PROJECT)
File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/gce.py", line 1348, in __init__
super(GCENodeDriver, self).__init__(user_id, key, **kwargs)
File "/usr/lib/python2.7/site-packages/libcloud/common/base.py", line 1179, in __init__
self.connection = self.connectionCls(*args, **conn_kwargs)
File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/gce.py", line 98, in __init__
credential_file=credential_file, **kwargs)
File "/usr/lib/python2.7/site-packages/libcloud/common/google.py", line 765, in __init__
user_id, key, auth_type, credential_file, scopes, **kwargs)
File "/usr/lib/python2.7/site-packages/libcloud/common/google.py", line 660, in __init__
self.token = self.oauth2_conn.get_new_token()
File "/usr/lib/python2.7/site-packages/libcloud/common/google.py", line 530, in get_new_token
signature = base64.urlsafe_b64encode(signer.sign(hash_func))
File "/usr/lib/python2.7/site-packages/Crypto/Signature/PKCS1_v1_5.py", line 110, in sign
em = EMSA_PKCS1_V1_5_ENCODE(mhash, k)
File "/usr/lib/python2.7/site-packages/Crypto/Signature/PKCS1_v1_5.py", line 211, in EMSA_PKCS1_V1_5_ENCODE
digestAlgo = DerSequence([hash.oid, DerNull().encode()])
AttributeError: oid
我跟着libcloud GCE駕駛員頁有關設置服務帳戶,下載JSON文件等等,所以我覺得我做了正確的步驟,但我對所有指令無法擺脫這個問題。