Skip to content

Commit

Permalink
Update schema to accept a list for 'listen' (#2817)
Browse files Browse the repository at this point in the history
  • Loading branch information
zigarn and ssbarnea authored Dec 14, 2022
1 parent 02ec69f commit c444166
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
16 changes: 13 additions & 3 deletions src/ansiblelint/schemas/ansible.json
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,19 @@
"type": "boolean"
},
"listen": {
"markdownDescription": "Applies only to handlers. See [listen](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#handlers-running-when-notified)",
"title": "Listen",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"markdownDescription": "Applies only to handlers. See [listen](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html)",
"title": "Listen"
},
"local_action": {
"title": "Local Action",
Expand Down
16 changes: 13 additions & 3 deletions src/ansiblelint/schemas/playbook.json
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,19 @@
"type": "boolean"
},
"listen": {
"markdownDescription": "Applies only to handlers. See [listen](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#handlers-running-when-notified)",
"title": "Listen",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"markdownDescription": "Applies only to handlers. See [listen](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html)",
"title": "Listen"
},
"local_action": {
"title": "Local Action",
Expand Down
16 changes: 13 additions & 3 deletions src/ansiblelint/schemas/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,19 @@
"type": "boolean"
},
"listen": {
"markdownDescription": "Applies only to handlers. See [listen](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#handlers-running-when-notified)",
"title": "Listen",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"markdownDescription": "Applies only to handlers. See [listen](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html)",
"title": "Listen"
},
"local_action": {
"title": "Local Action",
Expand Down
7 changes: 7 additions & 0 deletions test/schemas/test/playbooks/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
msg: "I am handler 1"
listen: "always handler"

- name: handler 2
ansible.builtin.debug:
msg: "I am handler 2"
listen: # to check if lists are allowed:
- "list listening handler"
- "other listening topic"

- hosts: localhost
serial: 1 # validate serial allows integer

Expand Down

0 comments on commit c444166

Please sign in to comment.