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

Invalid YAML is generated when exporting a deployment #2486

Closed
bschmalhofer opened this issue Aug 22, 2023 · 2 comments
Closed

Invalid YAML is generated when exporting a deployment #2486

bschmalhofer opened this issue Aug 22, 2023 · 2 comments
Labels
bug Something isn't working as intended invalid The report was either incorrect, or it describes the correct behavior.
Milestone

Comments

@bschmalhofer
Copy link
Contributor

In a rel-11_0 installation I exported a simple deployment. The exported file claims to be a YAML file. However yamllint has a different opinion.

bernhard@bernhard-Aspire-A515-57:~/devel/OTOBO/otobo$ cat ../ImportExportFolder/Export_Deployment_8.yml 
---
Modified:
  DynamicField::Namespaces:
    ChangeTime: 2023-08-22 11:08:53
    CreateTime: 2023-08-22 11:08:53
    DefaultID: 356
    DefaultVersionID: 356
    DeploymentTimeStamp: 2023-08-22 11:08:53
    EffectiveValue:
    - Computer
    - Hardware
    - Location
    - Network
    - Software
    - NamespaceBoden
    IsValid: 1
    ModifiedID: 7
    ModifiedVersionID: 9
    Name: DynamicField::Namespaces
    ResetToDefault: 0
    TargetUserID: ~
    UserModificationActive: 0
bernhard@bernhard-Aspire-A515-57:~/devel/OTOBO/otobo$ yamllint ../ImportExportFolder/Export_Deployment_8.yml 
../ImportExportFolder/Export_Deployment_8.yml
  10:5      error    wrong indentation: expected 6 but found 4  (indentation)


@bschmalhofer bschmalhofer added the bug Something isn't working as intended label Aug 22, 2023
@bschmalhofer bschmalhofer added this to the OTOBO 11.0 milestone Aug 22, 2023
@bschmalhofer
Copy link
Contributor Author

Looks like I was fooled by yamllint here. The program complained about missing indention for the list in:

    EffectiveValue:
    - Computer
    - Hardware
    - Location
    - Network
    - Software
    - NamespaceBoden
    IsValid: 1

But the YAML spec says that the item marker - already counts as indention, so the snippet is valid YAML.

I could not immediately find a YAML validator, so I used yq -o json Export_Deployment_8.yml for double checking. That command transformed YAML into JSON without complaints. So the generated file semms to be valid YAML. Double-doublechecking I found that breaking the YAML file also broke the transformation. This is a good thing.

bschmalhofer added a commit that referenced this issue Aug 27, 2023
adapt the file header
bschmalhofer added a commit that referenced this issue Aug 27, 2023
@bschmalhofer bschmalhofer added the invalid The report was either incorrect, or it describes the correct behavior. label Aug 27, 2023
@bschmalhofer
Copy link
Contributor Author

Enhanced the test script. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended invalid The report was either incorrect, or it describes the correct behavior.
Projects
None yet
Development

No branches or pull requests

1 participant