This repository has been archived by the owner on Dec 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow environment to use jinja2 templating (#263)
- Loading branch information
Showing
6 changed files
with
146 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- hosts: localhost | ||
environment: "{{ foo }}-123" # <- invalid only a full jinja string is allowed, or a list of strings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# ajv errors | ||
|
||
```json | ||
[ | ||
{ | ||
"instancePath": "/0", | ||
"keyword": "required", | ||
"message": "must have required property 'ansible.builtin.import_playbook'", | ||
"params": { | ||
"missingProperty": "ansible.builtin.import_playbook" | ||
}, | ||
"schemaPath": "#/definitions/ansible.builtin.import_playbook/required" | ||
}, | ||
{ | ||
"instancePath": "/0", | ||
"keyword": "additionalProperties", | ||
"message": "must NOT have additional properties", | ||
"params": { | ||
"additionalProperty": "hosts" | ||
}, | ||
"schemaPath": "#/definitions/ansible.builtin.import_playbook/additionalProperties" | ||
}, | ||
{ | ||
"instancePath": "/0", | ||
"keyword": "additionalProperties", | ||
"message": "must NOT have additional properties", | ||
"params": { | ||
"additionalProperty": "environment" | ||
}, | ||
"schemaPath": "#/definitions/ansible.builtin.import_playbook/additionalProperties" | ||
}, | ||
{ | ||
"instancePath": "/0/environment", | ||
"keyword": "type", | ||
"message": "must be object", | ||
"params": { | ||
"type": "object" | ||
}, | ||
"schemaPath": "#/anyOf/0/type" | ||
}, | ||
{ | ||
"instancePath": "/0/environment", | ||
"keyword": "pattern", | ||
"message": "must match pattern \"^\\{\\{.*\\}\\}$\"", | ||
"params": { | ||
"pattern": "^\\{\\{.*\\}\\}$" | ||
}, | ||
"schemaPath": "#/definitions/full-jinja/pattern" | ||
}, | ||
{ | ||
"instancePath": "/0/environment", | ||
"keyword": "anyOf", | ||
"message": "must match a schema in anyOf", | ||
"params": {}, | ||
"schemaPath": "#/anyOf" | ||
}, | ||
{ | ||
"instancePath": "/0", | ||
"keyword": "anyOf", | ||
"message": "must match a schema in anyOf", | ||
"params": {}, | ||
"schemaPath": "#/items/anyOf" | ||
} | ||
] | ||
``` | ||
|
||
# check-jsonschema | ||
|
||
stderr: | ||
|
||
``` | ||
Schema validation errors were encountered. | ||
``` | ||
|
||
stdout: | ||
|
||
``` | ||
negative_test/playbooks/environment.yml::$[0]: {'hosts': 'localhost', 'environment': '{{ foo }}-123'} is not valid under any of the given schemas | ||
Underlying errors caused this. | ||
Best Match: | ||
$[0]: Additional properties are not allowed ('environment', 'hosts' were unexpected) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- hosts: localhost | ||
environment: # <- valid | ||
FOO: BAR | ||
|
||
- hosts: localhost | ||
environment: "{{ foo }}" # <- valid |