问题标签 [gsutil]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
579 浏览

cloud - 无法通过 gsutil 在谷歌云存储中创建新存储桶

我想通过手动使用命令 on 来创建一个新存储桶cmd。但是,我无法创建新存储桶。系统报以下错误:

gsutil mb gs://gms01
Creating gs://gms01/...
您正在尝试访问未配置凭据的受保护数据。
请访问https://cloud.google.com/console#/project并注册一个帐户,然后运行“gsutil config”命令来配置 gsutil 以使用这些凭据。

请告诉我知道如何解决此错误。谢谢。

0 投票
0 回答
642 浏览

cookies - 配置 gsutil 以使用 LW-SSO cookie

我目前正在尝试将 Google gsutil rsync 配置为使用 HP ALM 用于同步测试集和测试实验室文件夹的轻量级单点登录 cookie。我想有一些方法可以修改 .boto 文件以包含向 Web 服务器进行身份验证所需的信息,但我不确定如何去做。任何有关配置 gsutil 以使用 LW-SSO cookie 的信息将不胜感激。

0 投票
2 回答
1732 浏览

google-cloud-storage - 无法使用 gsutil 将文件上传到 GCS

正在复制文件://InstreamImpression.csv.gz [Content-Type=application/octet-stream]...

AccessDeniedException:401 需要登录fe13d1e0fb408639_4...:46.75 MB/46.77 MB

CommandException: 1 个文件/对象无法传输。

似乎整个对象正在传输,但最后给出 401 错误。它已经发生了一段时间。

运行“gcloud auth login”几次。但仍然是同样的错误

我可以从不同的机器上传文件。

任何想法?

0 投票
2 回答
733 浏览

google-cloud-storage - GSUtil 服务帐号失败

我在 GCE 上运行 debian,并且已经使用gsutil config -e.

当我尝试这样做时gsutil -D ls,出现以下错误:

gsutil version 4.3 checksum f6a4b1f8400e2d1d145c9ec5e9ea8d90 (OK) boto version 2.29.1 python version 2.7.3 (default, Mar 13 2014, 11:03:55) [GCC 4.7.2] config path: /etc/boto.cfg gsutil path: /usr/local/share/google/gsutil/gsutil compiled crcmod: False installed via package manager: False editable install: False Command being run: /usr/local/bin/gsutil -D ls config_file_list: ['/etc/boto.cfg', '/var/lib/postgresql/.boto'] config: [('debug', '0'), ('working_dir', '/mnt/pyami'), ('https_validate_certificates', 'True'), ('debug', '0'), ('working_dir', '/mnt/pyami'), ('default_project_id', 'e-vard'), ('default_api_version', '2'), ('content_language', 'en')] Calling method storage.buckets.list with StorageBucketsListRequest: <StorageBucketsListRequest maxResults: 100 project: 'e-vard' projection: ProjectionValueValuesEnum(full, 0)> Making http GET to https://www.googleapis.com/storage/v1/b?projection=full&prettyPrint=True&fields=nextPageToken%2Citems%2Fid&maxResults=100&project=e-vard&alt=json Headers: {'accept': 'application/json', 'accept-encoding': 'gzip, deflate', 'content-length': '0', 'user-agent': 'apitools gsutil/4.3 (linux2)'} Body: (none) Attempting refresh to obtain initial access_token {'iss': '1234567890@developer.gserviceaccount.com', 'scope': 'https://www.googleapis.com/auth/devstorage.full_control', 'aud': 'https://accounts.google.com/o/oauth2/token', 'exp': 1405436827L, 'iat': 1405433227L} Refreshing access_token connect: (accounts.google.com, 443) send: 'POST /o/oauth2/token HTTP/1.1\r\nHost: accounts.google.com\r\nContent-Length: 726\r\ncontent-type: application/x-www-form-urlencoded\r\naccept-encoding: gzip, deflate\r\nuser-agent: Python-httplib2/0.7.7 (gzip)\r\n\r\ngrant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=ASSERTIONREMOVED' reply: 'HTTP/1.1 400 Bad Request\r\n' header: Content-Type: application/json header: Cache-Control: no-cache, no-store, max-age=0, must-revalidate header: Pragma: no-cache header: Expires: Fri, 01 Jan 1990 00:00:00 GMT header: Date: Tue, 15 Jul 2014 14:07:07 GMT header: Content-Encoding: gzip header: X-Content-Type-Options: nosniff header: X-Frame-Options: SAMEORIGIN header: X-XSS-Protection: 1; mode=block header: Server: GSE header: Alternate-Protocol: 443:quic header: Transfer-Encoding: chunked Failed to retrieve access token: { "error" : "invalid_grant" } DEBUG: Exception stack trace: Traceback (most recent call last): File "/usr/local/share/google/gsutil/gslib/__main__.py", line 419, in _RunNamedCommandAndHandleExceptions debug_level, parallel_operations) File "/usr/local/share/google/gsutil/gslib/command_runner.py", line 194, in RunNamedCommand return_code = command_inst.RunCommand() File "/usr/local/share/google/gsutil/gslib/commands/ls.py", line 378, in RunCommand bucket_fields=bucket_fields): File "/usr/local/share/google/gsutil/gslib/wildcard_iterator.py", line 425, in IterBuckets for blr in self._ExpandBucketWildcards(bucket_fields=bucket_fields): File "/usr/local/share/google/gsutil/gslib/wildcard_iterator.py", line 339, in _ExpandBucketWildcards provider=self.wildcard_url.scheme): File "/usr/local/share/google/gsutil/gslib/gcs_json_api.py", line 380, in ListBuckets global_params=global_params) File "/usr/local/share/google/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py", line 351, in List config, request, global_params=global_params) File "/usr/local/share/google/gsutil/gslib/third_party/storage_apitools/base_api.py", line 587, in _RunMethod http, http_request, retries=self.__client.num_retries) File "/usr/local/share/google/gsutil/gslib/third_party/storage_apitools/http_wrapper.py", line 152, in MakeRequest redirections=redirections, connection_type=connection_type) File "/usr/local/share/google/gsutil/third_party/google-api-python-client/oauth2client/util.py", line 132, in positional_wrapper return wrapped(*args, **kwargs) File "/usr/local/share/google/gsutil/third_party/google-api-python-client/oauth2client/client.py", line 475, in new_request self._refresh(request_orig) File "/usr/local/share/google/gsutil/third_party/google-api-python-client/oauth2client/client.py", line 663, in _refresh self._do_refresh_request(http_request) File "/usr/local/share/google/gsutil/third_party/google-api-python-client/oauth2client/client.py", line 710, in _do_refresh_request raise AccessTokenRefreshError(error_msg) AccessTokenRefreshError: invalid_grant

我做错了什么?

0 投票
1 回答
980 浏览

google-cloud-storage - 即使失败,gsutil 也会返回 0 代码

我们正在尝试使用 gsutil 编写故障安全副本的脚本。

问题是 gsutil cp 即使失败也会返回 0。这是预期的吗?我必须解析日志吗?

从日志文件:

谢谢

0 投票
2 回答
1112 浏览

bash - 使用 gsutil cp 上传到谷歌云服务失败,没有任何明显的错误,如何调试?

我正在运行一个定制的解决方案来管理播客录制。一切都是通过 bash 脚本自动完成的,有一次,我将一个节目上传到 GCS,为播客的 RSS 生成 XML,然后上传 RSS。这就是我在 bash 脚本中运行的内容:

知道我的文件确实位于 /path/to/tmp/files/,我可以看到它们。但有时,文件不会上传,运行脚本也不会抛出任何错误。例如,昨晚,我录制了“show #1”。它录制,创建 mp3 文件,将 mp3 上传到 GCS,创建 XML,不上传 XML。我见过一些两个文件都不会上传的情况。

问题是,没有显示错误。在昨晚的第一场演出中,我得到的是

  • 将 mp3 文件复制到 GCS;
  • 将 ACL 设置为 mp3 文件;
  • 将 ACL 设置为 xml 文件;
  • 错误,XML 文件不存在。

在应该上传 XML 文件的地方,什么也没有发生。没有错误。根本不值一提。我怎么能调试这个?

0 投票
1 回答
2221 浏览

android - 无法在 Ubuntu 上设置 gsutil,Android 应用程序的项目编号在哪里?

我按照https://developers.google.com/storage/docs/gsutil_install上的说明进行操作,但无法从任何目录运行 gsutil。我在 /home/myname/gsutil/ 中有 gsutil。

然后我尝试使用 apt-get 安装并在运行时收到此消息:

在@INC 中找不到 LWP/UserAgent.pm(您可能需要安装 LWP::UserAgent 模块)(@INC 包含:/etc/perl /usr/local/lib/perl/5.18.2 /usr/local /share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl) 在 /usr/bin /gsutil 第 26 行。开始失败 - 编译在 /usr/bin/gsutil 第 26 行中止。

然后我尝试运行 python gsutil.py config 并在 Google 开发人员控制台上询问我的项目编号,但我没有项目,因为这是一个 Android 应用程序。那我在哪里可以找到这个项目编号呢?

我也会在配置步骤中设置我的身份验证吗?

0 投票
2 回答
1170 浏览

java - Google Clous Storage - is there a gsutil 'rsync' equivalent in the Java API?

gsutil has a really neat feature called 'rsync' that synchronises 2 buckets/directories in GCS. I've searched the JSON API and the Java Client library but I can't see anything that supports this type of functionality out-of-the-box.

Does anyone know how to achieve the same functionality of 'rsync' via the Java Client (without actually writing the diff logic between the 2 buckets)?

0 投票
1 回答
1307 浏览

bash - 谷歌云存储上传不同文件名的文件

我可以通过 bash 脚本上传任何具有原始文件名的文件。但是,当我使用 gsutil cp 命令系统更改文件名时,系统会给出未找到文件的错误。

例如我的脚本是;

我可以在终端上运行它而不会出现任何错误。但是当使用 cron 运行时,我会出现 Not found 错误。

日志如下;

如果我更改脚本的最后一行

脚本可以使用原始文件名成功上传。

那么我该如何解决这个问题呢?我不想更改我本地的原始文件名。

0 投票
2 回答
4384 浏览

google-app-engine - gsutil cors set 命令返回 403 AccessDeniedException

我正在按照有关如何在 Google Cloud Storage 存储桶上设置 CORS 配置的说明gsutil cors set进行操作,当我运行该命令时,它会返回以下错误消息:

AccessDeniedException: 403 存储桶“[REDACTED]”的帐户已被禁用。

作为记录,我可以访问存储桶。我在开发者控制台中拥有此项目的所有者权限。运行gsutil cpgsutil ls工作都很好。

关于这里可能有什么问题的任何想法?