简体   繁体   English

yaml解析错误

[英]yaml parse error

When i run the helm install command the below line gives me the error: 当我运行helm install命令时,以下行给我错误:

args: [while [ 1 ]; do echo "hi" ; sleep 1; done;]

Error: 错误:

Error: YAML parse error 
converting YAML to JSON: yaml: line 27: did not find expected ',' or ']'

Square brackets have special meaning in YAML (they indicate a flow sequence, ie an inline array). 方括号在YAML中具有特殊含义(它们表示流序列,即内联数组)。 You need to quote that scalar (string): 您需要引用该标量(字符串):

args: [ 'while [ 1 ]; do echo "I am awake" ; sleep 1; done;' ]

...or make it a block scalar and use the literal indicator, | ...或使其成为块标量并使用文字指示符| :

args:
  - |
    while [ 1 ]; do echo "I am awake" ; sleep 1; done;

Both of these produce the same JSON : 这两个都产生相同的JSON

{
  "args": [
    "while [ 1 ]; do echo \"I am awake\" ; sleep 1; done;"
  ]
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 yaml 解析错误舵 - yaml parse error helm YAML curl 命令参数解析错误 - YAML parse error on curl command parameters 错误:YAML 解析错误 - 将 YAML 转换为 JSON 时出错:不允许使用 yaml: - Error: YAML parse error - error converting YAML to JSON: yaml: control characters are not allowed Helmfile YAML parse error on error converting YAML to JSON: yaml: line 2: mapping values are not allowed in this context - Helmfile YAML parse error on error converting YAML to JSON: yaml: line 2: mapping values are not allowed in this context Error: YAML parse error on deployment.yaml: error converting YAML to JSON: yaml: line 50: mapping values are not allowed in this context - Error: YAML parse error on deployment.yaml: error converting YAML to JSON: yaml: line 50: mapping values are not allowed in this context 错误:无法解析 "'{\"spec\":": yaml: 在 minikube 中修补新存储请求时发现 stream 意外结束 - error: unable to parse "'{\"spec\":": yaml: found unexpected end of stream while patching the new storage request in minikube Helm 的 v3 示例不显示多行属性。 获取 YAML 到 JSON 解析错误 - Helm's v3 Example Doesn't Show Multi-line Properties. Get YAML to JSON parse error 从bash中的YAML文件解析一个嵌套变量 - Parse a nested variable from YAML file in bash 解析 yaml 值的字节数组 - kubebuilder - Parse byte array for yaml value - kubebuilder 如何使用长 curl 命令正确解析 YAML - How to properly YAML parse with long curl command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM