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

handler listen: notify a undefined handler must not be an error #17848

Closed
resmo opened this issue Oct 1, 2016 · 1 comment
Closed

handler listen: notify a undefined handler must not be an error #17848

resmo opened this issue Oct 1, 2016 · 1 comment
Assignees
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug.

Comments

@resmo
Copy link
Contributor

resmo commented Oct 1, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME

handler listen

ANSIBLE VERSION
2.2
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

With the new feature of handler listen, a common use case is to notify an inexistent handler. However, currently Ansible expects the handler to be there and shows an error.

The error should be replaced with a warning so potential issues with typos in handler names and listen can be identified.

STEPS TO REPRODUCE
---
- name: test handlers listen
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
    - name: notify some handlers
      command: echo foo
      notify:
        - notify_listen_not_there
EXPECTED RESULTS

playbook gets executed with a warning.

ACTUAL RESULTS
 $ ansible-playbook test_handlers_listen2.yml -vv
No config file found; using defaults
 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available


PLAYBOOK: test_handlers_listen2.yml ********************************************
1 plays in test_handlers_listen2.yml

PLAY [test handlers listen] ****************************************************

TASK [notify some handlers] ****************************************************
task path: /home/resmo/Projects/resmo/ansible/test/integration/test_handlers_listen2.yml:6
ERROR! The requested handler 'notify_listen_not_there' was found in neither the main handlers list nor the listening handlers list

@bcoca
Copy link
Member

bcoca commented Oct 4, 2016

So after discusisng in IRC we all agreed that a missing handler should by default be an error, as such this is not a bug.

In any case I added PR #17902 to allow a user to toggle into a warning for those that have that preference.

@bcoca bcoca closed this as completed Oct 4, 2016
@jimi-c jimi-c removed the in progress label Oct 4, 2016
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants