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

Allow to set gather_facts as templated boolean #3606

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ansiblelint/schemas/ansible.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@
"type": "boolean"
},
"gather_facts": {
"title": "Gather Facts",
"type": "boolean"
"$ref": "#/$defs/templated-boolean",
"title": "Gather Facts"
},
"gather_subset": {
"items": {
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/schemas/playbook.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@
"type": "boolean"
},
"gather_facts": {
"title": "Gather Facts",
"type": "boolean"
"$ref": "#/$defs/templated-boolean",
"title": "Gather Facts"
},
"gather_subset": {
"items": {
Expand Down
28 changes: 27 additions & 1 deletion test/schemas/negative_test/playbooks/gather_facts.yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,25 @@
"params": {
"type": "boolean"
},
"schemaPath": "#/properties/gather_facts/type"
"schemaPath": "#/oneOf/0/type"
},
{
"instancePath": "/0/gather_facts",
"keyword": "pattern",
"message": "must match pattern \"^\\{[\\{%](.|[\r\n])*[\\}%]\\}$\"",
"params": {
"pattern": "^\\{[\\{%](.|[\r\n])*[\\}%]\\}$"
},
"schemaPath": "#/$defs/full-jinja/pattern"
},
{
"instancePath": "/0/gather_facts",
"keyword": "oneOf",
"message": "must match exactly one schema in oneOf",
"params": {
"passingSchemas": null
},
"schemaPath": "#/oneOf"
},
{
"instancePath": "/0",
Expand Down Expand Up @@ -111,9 +129,17 @@ stdout:
"path": "$[0]",
"message": "'import_playbook' is a required property"
},
{
"path": "$[0].gather_facts",
"message": "'non' is not valid under any of the given schemas"
},
{
"path": "$[0].gather_facts",
"message": "'non' is not of type 'boolean'"
},
{
"path": "$[0].gather_facts",
"message": "'non' does not match '^\\\\{[\\\\{%](.|[\\r\\n])*[\\\\}%]\\\\}$'"
}
]
}
Expand Down
6 changes: 6 additions & 0 deletions test/schemas/test/playbooks/gather_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
tasks:
- ansible.builtin.debug:
msg: foo

- hosts: localhost
gather_facts: "{{ facts_var_bool | default(false) }}"
tasks:
- ansible.builtin.debug:
msg: bar