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 run_once to use templated booleans (#270)
- Loading branch information
Showing
7 changed files
with
217 additions
and
24 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,8 @@ | ||
- hosts: localhost | ||
tasks: | ||
- name: foo2 | ||
ansible.builtin.debug: | ||
msg: foo! | ||
run_once: # invalid due to schema, also ansible does not allow lists | ||
- "{{ true }}" | ||
- xxx |
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,170 @@ | ||
# 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/oneOf/0/required" | ||
}, | ||
{ | ||
"instancePath": "/0", | ||
"keyword": "required", | ||
"message": "must have required property 'import_playbook'", | ||
"params": { | ||
"missingProperty": "import_playbook" | ||
}, | ||
"schemaPath": "#/definitions/ansible.builtin.import_playbook/oneOf/1/required" | ||
}, | ||
{ | ||
"instancePath": "/0", | ||
"keyword": "oneOf", | ||
"message": "must match exactly one schema in oneOf", | ||
"params": { | ||
"passingSchemas": null | ||
}, | ||
"schemaPath": "#/definitions/ansible.builtin.import_playbook/oneOf" | ||
}, | ||
{ | ||
"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": "tasks" | ||
}, | ||
"schemaPath": "#/definitions/ansible.builtin.import_playbook/additionalProperties" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "type", | ||
"message": "must be boolean", | ||
"params": { | ||
"type": "boolean" | ||
}, | ||
"schemaPath": "#/oneOf/0/type" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "type", | ||
"message": "must be string", | ||
"params": { | ||
"type": "string" | ||
}, | ||
"schemaPath": "#/oneOf/1/type" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "type", | ||
"message": "must be string", | ||
"params": { | ||
"type": "string" | ||
}, | ||
"schemaPath": "#/definitions/full-jinja/type" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "oneOf", | ||
"message": "must match exactly one schema in oneOf", | ||
"params": { | ||
"passingSchemas": null | ||
}, | ||
"schemaPath": "#/oneOf" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0", | ||
"keyword": "required", | ||
"message": "must have required property 'block'", | ||
"params": { | ||
"missingProperty": "block" | ||
}, | ||
"schemaPath": "#/required" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "type", | ||
"message": "must be boolean", | ||
"params": { | ||
"type": "boolean" | ||
}, | ||
"schemaPath": "#/oneOf/0/type" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "type", | ||
"message": "must be string", | ||
"params": { | ||
"type": "string" | ||
}, | ||
"schemaPath": "#/oneOf/1/type" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "type", | ||
"message": "must be string", | ||
"params": { | ||
"type": "string" | ||
}, | ||
"schemaPath": "#/definitions/full-jinja/type" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0/run_once", | ||
"keyword": "oneOf", | ||
"message": "must match exactly one schema in oneOf", | ||
"params": { | ||
"passingSchemas": null | ||
}, | ||
"schemaPath": "#/oneOf" | ||
}, | ||
{ | ||
"instancePath": "/0/tasks/0", | ||
"keyword": "anyOf", | ||
"message": "must match a schema in anyOf", | ||
"params": {}, | ||
"schemaPath": "#/items/anyOf" | ||
}, | ||
{ | ||
"instancePath": "/0", | ||
"keyword": "oneOf", | ||
"message": "must match exactly one schema in oneOf", | ||
"params": { | ||
"passingSchemas": null | ||
}, | ||
"schemaPath": "#/items/oneOf" | ||
} | ||
] | ||
``` | ||
|
||
# check-jsonschema | ||
|
||
stdout: | ||
|
||
```json | ||
{ | ||
"status": "fail", | ||
"errors": [ | ||
{ | ||
"filename": "negative_test/playbooks/run_once_list.yml", | ||
"path": "$[0]", | ||
"message": "{'hosts': 'localhost', 'tasks': [{'name': 'foo2', 'ansible.builtin.debug': {'msg': 'foo!'}, 'run_once': ['{{ true }}', 'xxx']}]} is not valid under any of the given schemas", | ||
"has_sub_errors": true, | ||
"best_match": { | ||
"path": "$[0]", | ||
"message": "'hosts', 'tasks' do not match any of the regexes: '^(ansible\\\\.builtin\\\\.)?import_playbook$', 'name', 'vars'" | ||
} | ||
} | ||
] | ||
} | ||
``` |
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,6 @@ | ||
- hosts: localhost | ||
tasks: | ||
- name: foo2 | ||
ansible.builtin.debug: | ||
msg: foo! | ||
run_once: "{{ true }}" # valid |
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,9 @@ | ||
- name: foo | ||
ansible.builtin.debug: | ||
msg: foo! | ||
run_once: true # valid | ||
|
||
- name: foo2 | ||
ansible.builtin.debug: | ||
msg: foo! | ||
run_once: "{{ true }}" # valid |