我正在使用一個引數來詢問用戶他是否想要 D 驅動器的天氣,為此我正在使用條件。
我試圖給一個約束描述和允許值一個引數屬性。
NeedVolumeD:
Type: String
Description: Do you want a D drive? Enter Yes or No
ConstraintDescription: Enter Yes or No
AllowedValues:
- Yes
- No
但這給了我一個 true 和 false 的下拉串列,而稍后在條件下的代碼中,我嘗試使用 Yes 和 No,盡管這在某種程度上是有效的。

我在這里不明白什么。
uj5u.com熱心網友回復:
您必須使用單引號:
NeedVolumeD:
Type: String
Description: Do you want a D drive? Enter Yes or No
ConstraintDescription: Enter Yes or No
AllowedValues:
- 'Yes'
- 'No'
否則,YAML(舊版本)將自動轉換Yes/No為true/false.
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/477962.html
