You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A clear and concise description of what the bug is.
Note that any how to questions should be posted in the discussion board and not raised as an issue.
Version of yq: 4.43.1
Operating system: Linux / Debian 12
Installed via: Github Release
Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:
apiVersion: opentelemetry.io/v1alpha1kind: OpenTelemetryCollectormetadata:
name: otel-collector-daemonsetnamespace: "observability"# namespace: opentelemetry-operator-systemspec:
tolerations:
- key: CriticalAddonsOnlyoperator: Exists
- operator: Existseffect: NoSchedule
- operator: Existseffect: NoExecutemode: daemonsetconfig: | receivers: # Make sure to add the otlp receiver. # This will open up the receiver on port 4317 otlp: protocols: grpc: endpoint: "0.0.0.0:4317" http: endpoint: "0.0.0.0:4318" opencensus: zipkin: jaeger: protocols: grpc: thrift_http: thrift_compact: thrift_binary: processors: memory_limiter: check_interval: 1s limit_percentage: 50 spike_limit_percentage: 30 batch: extensions: health_check: exporters: debug: otlp/jaeger: endpoint: "jaeger-collector.observability.svc.cluster.local:4317" tls: insecure: true service: extensions: [health_check] pipelines: traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlp/jaeger] metrics: receivers: [otlp] processors: [memory_limiter] exporters: [debug]
Command
The command you ran:
yq file.yaml
Actual behavior
apiVersion: opentelemetry.io/v1alpha1kind: OpenTelemetryCollectormetadata:
name: otel-collector-daemonsetnamespace: "observability"# namespace: opentelemetry-operator-systemspec:
tolerations:
- key: CriticalAddonsOnlyoperator: Exists
- operator: Existseffect: NoSchedule
- operator: Existseffect: NoExecutemode: daemonsetconfig: "receivers:\n# Make sure to add the otlp receiver.\n# This will open up the receiver on port 4317\notlp:\n protocols:\n grpc:\n endpoint: \"0.0.0.0:4317\"\n http:\n endpoint: \"0.0.0.0:4318\"\nopencensus:\nzipkin:\njaeger:\n protocols:\n grpc:\n thrift_http:\n thrift_compact:\n thrift_binary:\nprocessors:\n memory_limiter:\n check_interval: 1s\n limit_percentage: 50\n spike_limit_percentage: 30\n batch:\nextensions:\n health_check:\nexporters:\n debug:\n otlp/jaeger:\n endpoint: \"jaeger-collector.observability.svc.cluster.local:4317\"\n tls:\n insecure: true\nservice:\n extensions: [health_check]\n pipelines:\n traces:\n receivers: [otlp]\n processors: [memory_limiter, batch]\n exporters: [otlp/jaeger]\n metrics:\n receivers: [otlp]\n processors: [memory_limiter]\n exporters: [debug]\n"
Expected behavior
No changes at all. Should be identical to input file. Instead the multi-line String was replaces with a single, long String wherein e.g. quotes and new lines are replaced with escape sequences.
Additional context yq '.spec.config' file.yaml
In this case, the output format of this part is untouched and as expected!
The text was updated successfully, but these errors were encountered:
Jeansen
changed the title
Multiline Stings lose their formatting. Line breaks replaces with \n
Multiline Sting replaced with escaped single line String
May 6, 2024
So, I found the problem! Whenever there is a white-space character behind any String, then a reformat happens. In the example above, there was a blank behind http.endpoint: "0.0.0.0:4318"<space>. When I removed that and printed out the file, no transformation to a single line String happened!
Also, this is true vor any String. Whenever there is a white-space character after any string, yq will transform multi-line Strings in a single line String.
Describe the bug
A clear and concise description of what the bug is.
Note that any how to questions should be posted in the discussion board and not raised as an issue.
Version of yq: 4.43.1
Operating system: Linux / Debian 12
Installed via: Github Release
Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:
Command
The command you ran:
Actual behavior
Expected behavior
No changes at all. Should be identical to input file. Instead the multi-line String was replaces with a single, long String wherein e.g. quotes and new lines are replaced with escape sequences.
Additional context
yq '.spec.config' file.yaml
In this case, the output format of this part is untouched and as expected!
The text was updated successfully, but these errors were encountered: