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

Fix exception when including tasks from handlers #47307

Merged
merged 1 commit into from
Oct 22, 2018

Conversation

pablorf-dev
Copy link
Contributor

SUMMARY

Set _notified_handlers for the task's _uuid that is run as a handler

Fix #47287

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

include_task, handlers

ANSIBLE VERSION
ansible 2.8.0.dev0 (devel 3feb6c9e0f) last updated 2018/10/18 18:36:50 (GMT +200)
ADDITIONAL INFORMATION

Before this patch:

$ ansible-playbook -i 127.0.0.1, -c local -Dvv playbook.yml
ansible-playbook 2.8.0.dev0 (devel 3feb6c9e0f) last updated 2018/10/18 18:36:50 (GMT +200)
  config file = None
  configured module search path = [u'/home/pablorf/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pablorf/dev/ansible/lib/ansible
  executable location = /home/pablorf/dev/ansible/bin/ansible-playbook
  python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]
No config file found; using defaults

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

PLAY [localhost] **************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:2
ok: [127.0.0.1]
META: ran handlers

TASK [include a task from the tasks section] **********************************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:4
included: /home/pablorf/dev/ansible/include.yml for 127.0.0.1

TASK [an included task] *******************************************************************************************************
task path: /home/pablorf/dev/ansible/include.yml:2
ok: [127.0.0.1] => {
    "msg": "foo"
}

TASK [notify a handler] *******************************************************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:7
NOTIFIED HANDLER include a task from the handlers section for 127.0.0.1
changed: [127.0.0.1] => {
    "msg": "bar"
}

RUNNING HANDLER [include a task from the handlers section] ********************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:14
included: /home/pablorf/dev/ansible/include.yml for 127.0.0.1

RUNNING HANDLER [an included task] ********************************************************************************************
task path: /home/pablorf/dev/ansible/include.yml:2
ok: [127.0.0.1] => {
    "msg": "foo"
}
ERROR! Unexpected Exception, this is probably a bug: '7085c267-13ea-d9bc-987c-000000000031'
to see the full traceback, use -vvv

After this patch:

$ ansible-playbook -i 127.0.0.1, -c local -Dvv playbook.yml
ansible-playbook 2.8.0.dev0 (fix_included_task_in_handler 36b8849f8f) last updated 2018/10/18 21:06:57 (GMT +200)
  config file = None
  configured module search path = [u'/home/pablorf/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pablorf/dev/ansible/lib/ansible
  executable location = /home/pablorf/dev/ansible/bin/ansible-playbook
  python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]
No config file found; using defaults

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

PLAY [localhost] **************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:2
ok: [127.0.0.1]
META: ran handlers

TASK [include a task from the tasks section] **********************************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:4
included: /home/pablorf/dev/ansible/include.yml for 127.0.0.1

TASK [an included task] *******************************************************************************************************
task path: /home/pablorf/dev/ansible/include.yml:2
ok: [127.0.0.1] => {
    "msg": "foo"
}

TASK [notify a handler] *******************************************************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:7
NOTIFIED HANDLER include a task from the handlers section for 127.0.0.1
changed: [127.0.0.1] => {
    "msg": "bar"
}

RUNNING HANDLER [include a task from the handlers section] ********************************************************************
task path: /home/pablorf/dev/ansible/playbook.yml:14
included: /home/pablorf/dev/ansible/include.yml for 127.0.0.1

RUNNING HANDLER [an included task] ********************************************************************************************
task path: /home/pablorf/dev/ansible/include.yml:2
ok: [127.0.0.1] => {
    "msg": "foo"
}
META: ran handlers
META: ran handlers

PLAY RECAP ********************************************************************************************************************
127.0.0.1                  : ok=6    changed=1    unreachable=0    failed=0    skipped=0

Copy link
Member

@sivel sivel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include a new integration test that ensures we don't regress in the future.

Also include a changelog/fragments for this change too.

@ansibot
Copy link
Contributor

ansibot commented Oct 18, 2018

Hi @pablorf-dev, thank you for submitting this pull-request!

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. needs_triage Needs a first human triage before being processed. small_patch support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Oct 18, 2018
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Oct 18, 2018
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Oct 18, 2018
Set _notified_handlers for the task's _uuid that is run as a handler

Fix ansible#47287
@sivel sivel merged commit 6497049 into ansible:devel Oct 22, 2018
sivel pushed a commit to sivel/ansible that referenced this pull request Oct 22, 2018
…e#47307)

Set _notified_handlers for the task's _uuid that is run as a handler

Fix ansible#47287
(cherry picked from commit 6497049)

Co-authored-by: Pablo <pablorf.dev@outlook.com>
abadger pushed a commit that referenced this pull request Oct 22, 2018
Set _notified_handlers for the task's _uuid that is run as a handler

Fix #47287
(cherry picked from commit 6497049)

Co-authored-by: Pablo <pablorf.dev@outlook.com>
@pablorf-dev pablorf-dev deleted the fix_included_task_in_handler branch October 23, 2018 21:39
Tomorrow9 pushed a commit to Tomorrow9/ansible that referenced this pull request Dec 4, 2018
Set _notified_handlers for the task's _uuid that is run as a handler

Fix ansible#47287
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ansible 2.7 breaks include_tasks in handlers
3 participants