[英]How can I check whether an AWS CLI --dry-run would have succeeded in script?
我使用各種 bash 腳本來簡化日常操作。 有時我在忘記獲取會話令牌的情況下運行它們,所以我想我應該在腳本的早期添加一些--dry-run
命令。 我曾期望一個操作輸出:
A client error (DryRunOperation) occurred when calling the DescribeInstances operation: Request would have succeeded, but DryRun flag is set.
...將以0
退出 - 畢竟,就提供的參數而言,它已經成功 - 但它以255
退出。
當您看到當您無權運行命令時的輸出以相同的錯誤代碼255
退出時,問題會變得更糟:
A client error (UnauthorizedOperation) occurred when calling the DescribeInstances operation: You are not authorized to perform this operation.
(糟糕)檢查“請求會成功”值的實際輸出是唯一的解決方案,還是有更優雅的解決方案? 我完全看不出這背后的邏輯。
謝謝
是的,您需要檢查輸出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.