nr_test
Function to test Nornir operation and produce valid results without the need to interact with devices directly.
nr_test sample usage
Code to invoke nr_test task:
from nornir_salt.plugins.tasks import nr_test
output = nr.run(task=nr_test, abc=123)
nr_test returns
Returns Nornir results object with task results populated in accordance with arguments supplied to task call.
nr_test reference
- nornir_salt.plugins.tasks.nr_test.nr_test(task, ret_data_per_host=None, ret_data='__undefined_value__', excpt=None, excpt_msg='', **kwargs)
Dummy task that echoes data passed to it. Useful to debug and verification of Nornir object operation.
- Parameters
ret_data_per_host – (dict) Dictionary keyed by host name with values to include in results
ret_data – Any data to include in results, same for each host
kwargs – Any key-value pair to include in results, same for each host
excpt – (obj or True) exception object to raise; if True, raises
RuntimeErrorexcpt_msg – (str) message to use with exception
- Return result
ret_dataor**kwargspassed to the task
Order of preference of return data:
If
ret_data_per_hostpresent, it is used to form resultsIf
excptobject supplied, it is raisedIf
ret_datapresent, it is included in resultsIf
**kwargssupplied, they are included in results