2017-09-23 14 views
0

Webコンソールを使用して自分のインスタンスでこのコマンドを実行できます。GCEのコマンドはコンソール端末で動作しますが、Cronジョブでは動作しません。

gsutilのrsyncの-d -r /私のパスGS://私のバケット

しかし、私は私のリモートSSH端末にしようとすると、私はこのエラーを取得します。

[email protected]: gsutil rsync -d -r /my-path gs://my-bucket 
Building synchronization state... 
INFO 0923 12:48:48.572446 multistore_file.py] Error decoding credential, skipping 
    Traceback (most recent call last): 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/multistore_file.py", line 381, in _refresh_data_cache 
     (key, credential) = self._decode_credential_from_json(cred_entry) 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/multistore_file.py", line 400, in _decode_credential_from_json 
     credential = Credentials.new_from_json(json.dumps(cred_entry['credential'])) 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/client.py", line 292, in new_from_json 
     return from_json(s) 
     File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/apitools/apitools/base/py/credentials_lib.py", line 356, in from_json 
     data['token_expiry'], oauth2client.client.EXPIRY_FORMAT) 
    TypeError: must be string, not None 
    Caught non-retryable exception while listing gs://my-bucket/: Could not reach metadata service: Not Found 
    At source listing 10000... 
    At source listing 20000... 
    At source listing 30000... 
    At source listing 40000... 
    CommandException: Caught non-retryable exception - aborting rsync 
+0

インスタンスに割り当てられたサービスアカウントに、バケットへの書き込みを許可するIAM権限があることを確認する必要があります。 – danemacmillan

答えて

2

これは、プロジェクトの作成時に作成されたデフォルトのCGEに切り替えることで解決しました。 VM上のルートにはgsutilコマンドを実行する権限がありません。