First, copy the .py file for the callback plugin from the Ansible source
code to an empty local directory. That file is apparently
`ansible/lib/ansible/plugins/callback/mail.py` in your case.

Modify the 2 Ansible config settings related to the callback plugins

https://github.com/ansible/ansible/blob/5f8ec4d46e1fec49eca5c2f351141ed5da6d259e/lib/ansible/config/base.yml#L527-L546

For the callback plugin paths, copy the defaults, and then add the
directory you saved the plugin to it to the start of the list, using the
path separator. The name of the plugin should be in the whitelist setting,
but the fact that you encountered this issue shows that you already have
this configured. My only concern here is that (since you don't remove the
version from Ansible itself) your version now needs to come at higher
precedence. If you have problems with it taking effect, you could try
giving it a new name and put this new name in the whitelist.

Then make the patch in your local file, confirm fix, and consider
contributing back the fix like you say.

Alan
github: AlanCoding


On Mon, Nov 25, 2019 at 7:59 AM Andrew Hilborne <and...@hilborne.com> wrote:

> We use hostnames which often start with a numeral (we can't do anything
> about this). One result of this is that errors during a play often produce
> a complaint from mail.CallbackModule like this:
>
> Failure using method (v2_runner_on_failed) in callback plugin
> (<ansible.plugins.callback./usr/local/lib/python3.6/dist-
> packages/ansible/plugins/callback/mail.CallbackModule object at
> 0x7f31ceb2a630>): 'in <string>' requires string as left operand, not int
>
>
> I'd like to fix this plugin, preferably without overwriting the library
> code. Afterwards I can submit a patch.
>
> Please can someone tell me the easiest way of doing this.
>
> Many thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/b0100db0-fd40-45b9-b3e7-6d681fe9c7a9%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-devel/b0100db0-fd40-45b9-b3e7-6d681fe9c7a9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CAADLLLi_bqvORb2LdRM0BBBJ1u-XQCZu5_txEDUng5z6QErYTg%40mail.gmail.com.

Reply via email to