Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Allow check_mode and changed_when to use complex conditionals #269

Merged
merged 1 commit into from
May 14, 2022
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
34 changes: 9 additions & 25 deletions f/ansible-playbook.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
"type": "array"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -331,8 +331,8 @@
"type": "string"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -581,8 +581,8 @@
"type": "string"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -752,29 +752,13 @@
"type": "string"
},
"changed_when": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "string"
},
{
"items": {
"type": [
"string",
"boolean"
]
},
"type": "array"
}
],
"$ref": "#/definitions/complex_conditional",
"markdownDescription": "See [changed_when](https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#defining-changed)",
"title": "Changed When"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down
34 changes: 9 additions & 25 deletions f/ansible-tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
"type": "array"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -331,8 +331,8 @@
"type": "string"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -581,8 +581,8 @@
"type": "string"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -752,29 +752,13 @@
"type": "string"
},
"changed_when": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "string"
},
{
"items": {
"type": [
"string",
"boolean"
]
},
"type": "array"
}
],
"$ref": "#/definitions/complex_conditional",
"markdownDescription": "See [changed_when](https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#defining-changed)",
"title": "Changed When"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down
31 changes: 9 additions & 22 deletions f/ansible.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
"type": "array"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -317,8 +317,8 @@
"type": "string"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -565,8 +565,8 @@
"type": "string"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down Expand Up @@ -729,26 +729,13 @@
"type": "string"
},
"changed_when": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "string"
},
{
"items": {
"type": ["string", "boolean"]
},
"type": "array"
}
],
"$ref": "#/definitions/complex_conditional",
"markdownDescription": "See [changed_when](https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#defining-changed)",
"title": "Changed When"
},
"check_mode": {
"title": "Check Mode",
"type": "boolean"
"$ref": "#/definitions/complex_conditional",
"title": "Check Mode"
},
"collections": {
"items": {
Expand Down
2 changes: 1 addition & 1 deletion test/playbooks/tasks/changed_when.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

- command: echo 123
changed_when: # valid, all items must evaluate as true (AND)
- true
- "foo is defined"
- '"1" in ["1", "2", "3"]'