Data

Old-style docs:

nornir.plugins.tasks.data.load_json(task: nornir.core.task.Task, file: str) → nornir.core.task.Result

Loads a json file.

Parameters:file – path to the file containing the json file to load

Examples

Simple example with ordered_dict:

> nr.run(task=load_json,
         file="mydata.json")

file: path to the file containing the json file to load

Returns:
  • result (dict): dictionary with the contents of the file
Return type:Result object with the following attributes set
nornir.plugins.tasks.data.load_yaml(task: nornir.core.task.Task, file: str) → nornir.core.task.Result

Loads a yaml file.

Parameters:file – path to the file containing the yaml file to load

Examples

Simple example with ordered_dict:

> nr.run(task=load_yaml,
         file="mydata.yaml")
Returns:
  • result (dict): dictionary with the contents of the file
Return type:Result object with the following attributes set
nornir.plugins.tasks.data.echo_data(task: nornir.core.task.Task, **kwargs) → nornir.core.task.Result

Dummy task that echoes the data passed to it. Useful in grouped_tasks to debug data passed to tasks.

Parameters:**kwargs – Any <key,value> pair you want
Returns:
  • result (dict): **kwargs passed to the task
Return type:Result object with the following attributes set