twin-bridges/nornir_course

Cleaning up the messy output

Opened this issue · 1 comments

A remarkable evolution, that nornir. It's the fastest I/O tool I've tried so far.
Yet, I think the output is a bit messy.

netmiko_send_command************************************************************

  • sw01 ** changed : False ******************************************************
    vvvv netmiko_send_command ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv INFO
    hostname s1
    ^^^^ END netmiko_send_command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  • sw02 ** changed : False ******************************************************
    vvvv netmiko_send_command ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv INFO
    hostname s2
    ^^^^ END netmiko_send_command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  • sw03 ** changed : False ******************************************************
    vvvv netmiko_send_command ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv INFO
    hostname s3
    ^^^^ END netmiko_send_command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Can you adjust the result=nr.run() function in order to give a neat output like below?
hostname s1
hostname s2
hostname s3

You can just loop over the aggregated result object and print the results (i.e. basically just create your own printing solution that prints things the way you want it to be).