Closed altulek closed 6 months ago
It happened always when YAML data elements becomes a string. I Can see the same when I use "\r" char.
I can't reproduce this on rancher version v2.7.6. Here's what I've tried:
apiVersion: v1
data:
a: a
b: b
kind: ConfigMap
metadata:
name: ctw-testyml
namespace: default
annotations: {}
labels: {}
configMap
-> create
-> edit as yaml
option
this was using tab
instead of spaces
. Can you perhaps add an example configMap.yaml that is causing the problem (before it is created on the rancher side)? You can try this one:
apiVersion: v1
data:
a: "a\nb\tc"
b: "a\nb\tc"
kind: ConfigMap
metadata:
name: yaml-tab-test
After saving this yaml I can't save it again through "Edit Config". After I chose "Edit Config" -> "Edit as YAML" data section looks like this:
data:
b: |+a: |+a: "a\nb\tc"
b: "a\nb\tc"
I think that new line also is necessary to trigger this error.
repro steps:
import yaml
function
apiVersion: v1
data:
a: "a\nb\tc"
b: "a\nb\tc"
kind: ConfigMap
metadata:
name: yaml-tab-test
configMaps -> use the ... dropdown on the configmap -> edit Config
edit as yaml
, this will show that the UI added |+a: |+a:
to the yaml, however if you do not do view as yaml
first, the resource creation is not caught before erroring out the whole page with the screenshot mentioned by the usertested on v2.7.6 and v2.8.0-alpha2
Caused by rancher/rancher#7670. Same as in [BUG] configmap formatting breaking on creation/edit rancher/dashboard#10066 It seems that https://github.com/nodeca/js-yaml doesen't work properly.
Internal reference: SURE-7246
内部参考:SURE-7246
can we get any help? @gaktive
Also see rancher/dashboard#10067
~https://github.com/rancher/dashboard/issues/10067 should be tackled at the same time as this. If it's the same issue can be closed as a duplicate~ Closed instead after reviewing description
/backport v2.7.next1
@rak-phillip Is it possible to write automated tests for this?
@nwmac Of course we can! We wrote tests in both #10179 & #10178 that address this area of dashboard. Are there any specific cases that we would like to see represented here?
@rak-phillip I'm just looking for tests that test the changes in the PR for this issue - it looks like https://github.com/rancher/dashboard/pull/10168/files# has a unit test - if that is sufficient, then we should move this to QA Review
, rather than To Test
.
Have we got enough that we don't need any manual test for the fix for this bug?
@nwmac I've moved to QA Review
. I think that the test covers in such a way we'll prevent regressions of this type in the future. Behavior should remain unchanged otherwise.
/backport v2.8.next1
Manual validation would complement any automation coverage before closing, let's move to To Test
@yonasberhe23
Since this was tested in 2.7.next1 & 2.8.next1 and marked done, I'll defer to QA whether this needs to be retested or if automation was in fact built up in the other tix.
@gaktive @nwmac can SURE-7246 be closed in light of this issue status?
this issue closed in 2.7.11, 2.7.12, but this version is non public
@LaoZhang-best This specific issue is for 2.9.0 which is the next minor release. It looks like it was also shipped in 2.8.3 which is the current minor release and is available to the community. Patch versions of a previous minor release (2.7) are for rancher prime customers and we would recommend community uses upgrade to the current minor release (2.8)
Rancher Server Setup
Information about the Cluster
User Information
Describe the bug ConfigMap edit doesn't work properly when you are using "\t" (tabulator) character.
To Reproduce
Result Error: "a line break is expected" Expected Result Saved properly
Screenshots
Additional context The issue happens when values are saved as string. Rancher adds additional key into first data section.