Trouble Loading YAML as String Literal into other YAML. #2541
-
|
I have this YAML file called omni-cert.yaml: I have another YAML file called ProjectConfig.yaml: I'd like to inject the Command I tried: Result: Expected (and desired) result: Am I doing something wrong? Why does the loaded yaml have a bunch of strange characters added? Using YQ version v4.49.2 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I discovered what was happening for anyone else that runs into this. I generated And then I was trying to generate the new project config a similar way: After inspecting both of these files more closely, I found that something about trying to capture the output in the docker command in a new file (i.e. Anyway, I instead tried to just edit the files with So the command correctly generates the yaml I wanted: |
Beta Was this translation helpful? Give feedback.
I discovered what was happening for anyone else that runs into this.
I generated
omni-cert.yamlwith this command:docker run --rm -it -v /opt/project:/opt/project -v /etc/certs:/etc/certs custom-container:0.0.1 yq '.certificates = str_load("/etc/certs/mycert.cer")' /opt/project/original-omni-cert.yaml > /opt/project/new-omni-cert.yamlAnd then I was trying to generate the new project config a similar way:
docker run --rm -it -v /opt/project:/opt/project -v /etc/certs:/etc/certs custom-container:0.0.1 yq '.omni.omniCert = str_load("/opt/project/new-omni-cert.yaml")' /opt/project/original-ProjectConfig.yaml > /opt/project/new-ProjectConfig.yamlAfter inspecting both of these files more clo…