[英]How to remove/disable the output messages of gcloud CLI commands
例如:
gcloud compute disks create --size=10GB my-data-disk
會打印兩件事:
警告:
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.
這可以通過--verbosity error
消除
地位:
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
這個我不知道如何禁用,然后重定向stderr
,這當然是我不想要的,因為我仍然必須查看是否發生了錯誤。
-q
參數不會刪除它。
--no-user-output-enabled
或--user-output-enabled=false
標志似乎是您要尋找的。
嘗試這個:
gcloud compute disks create --size=10GB my-data-disk --no-user-output-enabled
@Vilas的答案是正確的,但是請注意--no-user-output-enabled在某些情況下在141.0版本左右中斷。 看到這個問題-https://issuetracker.google.com/issues/36076836
另一種選擇是禁用所有相關警告
import warnings
warnings.filterwarnings("ignore", "Your application has authenticated using end user credentials")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.