[英]How to remove/disable the output messages of gcloud CLI commands
For example:例如:
gcloud compute disks create --size=10GB my-data-disk
would print 2 things:会打印两件事:
Warning:警告:
WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks/persistent-disks#pdperformance.
This can be eliminated with --verbosity error
这可以通过--verbosity error
消除
Status:地位:
Created [https://www.googleapis.com/compute/v1/projects/sigma-project-12345/zones/europe-west1-c/disks/my-data-disk]. NAME ZONE SIZE_GB TYPE STATUS my-data-disk europe-west1-c 10 pd-standard READY
This I don't know how to disable, other then redirecting stderr
, which of course I don't want because I still have to see if an error happened.这个我不知道如何禁用,然后重定向stderr
,这当然是我不想要的,因为我仍然必须查看是否发生了错误。
The -q
argument does not remove it. -q
参数不会删除它。
The --no-user-output-enabled
or --user-output-enabled=false
flags seem to be what you are looking for. --no-user-output-enabled
或--user-output-enabled=false
标志似乎是您要寻找的。
Try this: 尝试这个:
gcloud compute disks create --size=10GB my-data-disk --no-user-output-enabled
@Vilas's answer is correct however please note that --no-user-output-enabled broke in some cases around version 141.0. @Vilas的答案是正确的,但是请注意--no-user-output-enabled在某些情况下在141.0版本左右中断。 See this issue - https://issuetracker.google.com/issues/36076836 看到这个问题-https://issuetracker.google.com/issues/36076836
Another option is to disable all the related warnings另一种选择是禁用所有相关警告
import warnings
warnings.filterwarnings("ignore", "Your application has authenticated using end user credentials")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.