作业因错误而失败:gcloud 崩溃(AttributeError):“bool”对象没有属性“lower”

Poo*_*ati 23 gcloud google-cloud-dataproc

我们注意到我们的作业失败,dataproc 集群上出现以下错误。

ERROR: gcloud crashed (AttributeError): 'bool' object has no attribute 'lower'

If you would like to report this issue, please run the following command:
  gcloud feedback

To check gcloud for common problems, please run the following command:
  gcloud info --run-diagnostics
Run Code Online (Sandbox Code Playgroud)

运行诊断不会产生有价值的见解:

$ gcloud info --run-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

Property diagnostic detects issues that may be caused by properties.
Checking hidden properties...done.
Hidden Property Check passed.
Property diagnostic passed (1/1 checks passed).
Run Code Online (Sandbox Code Playgroud)

sea*_*ean 8

如果您的本地 gcloud 仍然损坏,请强制重新获取功能标志配置,因为 Google 已关闭有问题的标志,然后重新运行您的 gcloud 调用:

rm ~/.config/gcloud/.feature_flags_config.yaml
Run Code Online (Sandbox Code Playgroud)

这似乎是最近发布的一个错误的功能标志值,这解释了为什么 gcloud SDK 的早期版本会受到影响(至少是最后几个版本,例如 412.0.0 工作正常)。

如果您运行 gcloud,--verbosity=debug您将看到一个以以下结尾的堆栈:

 4281, in _GetBoolProperty
    return property_value.value.lower() in ['1', 'true', 'on', 'yes', 'y']
AttributeError: 'bool' object has no attribute 'lower'
Run Code Online (Sandbox Code Playgroud)

解析标志的默认值时会发生这种情况auth/service_account_use_self_signed_jwt

在谷歌修复他们的标志之前,有两种可行的解决方法:

# Not a great idea for CI/CD use cases; this will fail as soon
# as the feature flag is removed.
gcloud config set 'auth/service_account_use_self_signed_jwt' false

# Likely not a great idea either, but it does work via a sledgehammer
# approach by preventing feature flags from being evaluated.
gcloud config set 'core/enable_feature_flags' false
Run Code Online (Sandbox Code Playgroud)

作为更新:截至 2023-05-03T00:00:00Z 左右,新标志从https://www.gstatic.com/cloudsdk/feature_flag_config_file.yaml中消失,因此应该减轻人们笔记本电脑之外的影响,这些笔记本电脑可能只获取定期进行功能标记。

我们自己的 CI 系统已经恢复。

它以 10% 的功能标志的形式推出(不过不知道它们是如何存储的),这大概就是影响相对较小的原因:

# Feature Flag Config File
test/feature_flag:
- value: true
  weight: 0
- value: false
  weight: 100
auth/service_account_use_self_signed_jwt:
- value: true
  weight: 10
- value: false
  weight: 90
Run Code Online (Sandbox Code Playgroud)


小智 3

我遇到了同样的错误,作为解决方法,我更改为 version\xc2\xa0417.0.1 并工作。

\n

\r\n
\r\n
gcloud --version  \nGoogle Cloud SDK 417.0.1
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n