Hello, module.warn() works great. Thank you! вт, 29 янв. 2019 г. в 17:39, Matt Martz <m...@sivel.net>:
> Modules cannot import things from outside of `ansible.module_utils`. As > such you cannot use `Display` in a module. > > In addition to that, a module may only output JSON at the end of the > execution, via `module.fail_json` or `module.exit_json` > > You can however use `module.warn` to send back warnings that will be > displayed to the user. > > On Tue, Jan 29, 2019 at 3:18 AM Andrew Klychkov <andrew.klych...@gmail.com> > wrote: > >> Hi, all! >> I'm trying to import: >> 117 from ansible.utils.display import Display >> >> in my new module, placed in lib/ansible/modules/database/postgresql/ >> >> But during tests and execution the following error occurred: >> Sanity check using import with Python 2.7 >> ERROR: Found 1 import issue(s) on python 2.7 which need to be resolved: >> ERROR: lib/ansible/modules/database/postgresql/postgresql_ping.py:117:0: >> ImportError: No module named utils.display >> ... >> Any ideas, why? >> This module successfully imported by the same line in >> lib/ansible/utils/display.py. >> >> I want to add it to display warnings in the shell. >> Maybe there is better way to do this. >> >> I'll be grateful for any ideas, thank you! >> >> -- >> 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. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Matt Martz > @sivel > sivel.net > -- 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. For more options, visit https://groups.google.com/d/optout.