ansible / ansible-jupyter-kernel

Jupyter Notebook Kernel for running Ansible Tasks and Playbooks
Other
534 stars 62 forks source link

Getting lots of extraneous output #89

Open VincentBerger opened 3 years ago

VincentBerger commented 3 years ago

I am getting lots of extraneous output when running any playbook through the ansible jupyter kernel. See screenshot for an example. I don't get that output when running the same playbook through ansible CLI in a bash jupyter kernel. I'm using jupyter-lab 3.0.7 and ansible 2.10.5 on a Mac. Any help to remove that output welcome. Thanks !

image

VincentBerger commented 3 years ago

Answering my own question... The output comes from the big if statement in function runner_process_message in kernel.py. Events of type runner_on_start are not handled and therefore fall through to the else statement that outputs the message to stdout. I've added a clause

            elif event == 'runner_on_start':
                pass

I don't pretend this is the right thing to do as I don't really understand the purpose of outputting some of these messages and not others, but it solves my immediate problem and that's good enough for me. It may help others who hit the same problem...

Edit: I just realized this edit was in fact already done in the last commit to kernel.py a year ago. But it was not pushed to pypi so if you install with pip you don't get it. It might be better to install this package from a local checkout.