Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML merge tag results in bad indentation of a mapping entry #697

Open
chancez opened this issue Mar 31, 2023 · 5 comments
Open

YAML merge tag results in bad indentation of a mapping entry #697

chancez opened this issue Mar 31, 2023 · 5 comments

Comments

@chancez
Copy link

chancez commented Mar 31, 2023

I'm trying to process a Kubernetes CRD YAML file, and js-yaml is failing when trying to parse it. The error is:

Error: YAMLException: bad indentation of a mapping entry (279:29)

 276 |                     - ""
 277 |                     - "RollingUpdate"
 278 |                 troubleshoot:
 279 |                   !!merge <<: *TypeStringBool
-----------------------------------^
 280 |                   description: "allows troubleshoot Pods du ...
 281 |                 namespaceDomainPattern:
Error: bad indentation of a mapping entry (279:29)

I've extracted the problematic section:

troubleshoot:
  !!merge <<: *TypeStringBool
  description: "allows troubleshoot Pods during CrashLoopBack state, when you apply wrong configuration, `clickhouse-server` wouldn't startup"

The TypeStringBool is defined earlier in the same YAML:

                stop: &TypeStringBool
                  type: string
                  description: |
                    Allow stop all ClickHouse clusters described in current chi.
                    Stop mechanism works as follows:
                     - When `stop` is `1` then setup `Replicas: 0` in each related to current `chi` StatefulSet resource, all `Pods` and `Service` resources will desctroy, but PVCs still live
                     - When `stop` is `0` then `Pods` will created again and will attach retained PVCs and `Service` also will created again
                  enum:
                    # List StringBoolXXX constants from model
                    - ""
                    - "0"
                    - "1"
                    - "False"
                    - "false"
                    - "True"
                    - "true"
                    - "No"
                    - "no"
                    - "Yes"
                    - "yes"
                    - "Off"
                    - "off"
                    - "On"
                    - "on"
                    - "Disable"
                    - "disable"
                    - "Enable"
                    - "enable"
                    - "Disabled"
                    - "disabled"
                    - "Enabled"
                    - "enabled"

I've tried it with other YAML parsers and they seem to handle it fine.

@chancez
Copy link
Author

chancez commented Mar 31, 2023

Here's the whole YAML file:
clickhouse-crds.yaml.txt

And an example of using the js-yaml CLI:

$ js-yaml clickhouse-crds.yaml.txt
YAMLException: bad indentation of a mapping entry (279:29)

 276 |                     - ""
 277 |                     - "RollingUpdate"
 278 |                 troubleshoot:
 279 |                   !!merge <<: *TypeStringBool
-----------------------------------^
 280 |                   description: "allows troubleshoot Pods du ...
 281 |                 namespaceDomainPattern:

But yq handles it fine for example:

$ yq '.metadata.name' clickhouse-crds.yaml.txt
clickhouseinstallations.clickhouse.altinity.com
---
clickhouseinstallationtemplates.clickhouse.altinity.com
---
clickhouseoperatorconfigurations.clickhouse.altinity.com
---
release-name-altinity-clickhouse-operator
---
release-name-altinity-clickhouse-operator
---
release-name-altinity-clickhouse-operator-confd-files
---
release-name-altinity-clickhouse-operator-configd-files
---
release-name-altinity-clickhouse-operator-files
---
release-name-altinity-clickhouse-operator-templatesd-files
---
release-name-altinity-clickhouse-operator-usersd-files
---
release-name-altinity-clickhouse-operator
---
release-name-altinity-clickhouse-operator
---
release-name-altinity-clickhouse-operator-metrics
---
release-name-altinity-clickhouse-operator

@chancez
Copy link
Author

chancez commented Mar 31, 2023

Is this what's meant by this statement in the readme caveats?

Also, reading of properties on implicit block mapping keys is not supported yet. So, the following YAML document cannot be loaded.

@chancez
Copy link
Author

chancez commented Mar 31, 2023

Using a rebased version of #561 does seem to fix my issue however.

@yellowhat
Copy link

Hi,
I am having a similar issue using renovate.
#561 seems a bit abandoned.
Is there any other progress?

Thanks

@chancez
Copy link
Author

chancez commented Apr 20, 2023

I opened #698 but haven't had any response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants