7.2.2 How to deal with YAML syntax errors
(1) Actions to take when a YAML file cannot be registered due to an error with the “name” label or datamodel table name
The following causes are possible.
- The name may conflict with a reserved word. Solve the conflict with a reserved word by adding a prefix to the name. The following are reserved words.
(Table) List of reserved words
| Item | Reserved words |
|---|---|
| "name" label for YAML files | acl, activity, api, cmdb, conf, datamodel, doc, opsi, otobo, otobo-mapping, policy, practice, resource, resource-api, schedule, statement, sys, system, task, ticket, ui, workflow |
| "name" label for buttons | edit, revert_finish_editing |
| Datamodel table name | group, mapping_group, node, role, sys, system, ticket, user |
- An error occurs if the label or name exactly matches a reserved word, or if it begins with a reserved word followed by _ (underscore). The following are usage examples.
(Table) Usage examples of reserved words
| Good examples | Bad examples |
|---|---|
| ・xxx_mapping_group_yyy ・mapping_groupxxx_yyy |
・mapping_group ・mapping_group_xxx |
The following causes are possible.
- There may be a conflict with another “name” label in a YAML file specified as an Include target. An example is as follows.
For a single UI, ScriptA and ScriptB are specified as Include targets and “action” is specified as the action. If an action with the name label “action” is specified for both ScriptA and ScriptB so that JS_A.js is executed for ScriptA and JS_B.js is executed for ScriptB, the name labels conflict, making it unclear which action to execute for A and B, resulting in unintended behaviors.
In this case, change the name labels like “A_action” and “B_action” to avoid the conflict.
(3) Actions to take when validation errors occur after registering (or deleting) YAML files with dependencies at the same time
If a set of YAML files with dependencies are registered (or deleted) at the same time and validation errors occur for any of the YAML files, any of the documents, including those YAML files without errors, are not yet registered (or deleted) in Ops I.
(Registration example: Commit1, Deletion example: Commit3)
When you correct the errors and execute the Commit again, the YAML files including those without errors are registered (or deleted) at the same time.
There is no need to commit (or delete) the YAML files without errors again after that.
(Registration example: Commit2, Deletion example: Commit4)
Check for errors with the API “gitops-logs”.
[Registration examples]
Relationship: YAML file A is referenced by YAML file B
Processing reapplied -> YAML file B (without error): Registration to Ops I succeeds
[Deletion examples]
Relationship: YAML file A is referenced by YAML file B
Processing reapplied → YAML file A: Deletion in Ops I succeeds