Question 25
This commit is contained in:
@@ -2,6 +2,8 @@ from api import app
|
||||
from nornir_napalm.plugins.tasks import napalm_get, napalm_configure, napalm_cli
|
||||
from nornir.core.task import Task, Result
|
||||
from nornir_utils.plugins.functions import print_result
|
||||
from nornir_netmiko.tasks import netmiko_send_config, netmiko_send_command, netmiko_save_config,netmiko_commit
|
||||
|
||||
|
||||
def get_config_by_device(device):
|
||||
nr = app.config.get('nr')
|
||||
@@ -12,7 +14,6 @@ def get_config_by_device(device):
|
||||
def run_config_from_file_by_device(device=None, file_path=None):
|
||||
nr = app.config.get('nr')
|
||||
if device and file_path:
|
||||
result = nr.filter(device_name=device.get('name')).run(task=netmiko_send_config,
|
||||
config_file=file_path)
|
||||
result = nr.filter(device_name=device.get('name')).run(task=netmiko_send_config,config_file=file_path)
|
||||
print_result(result)
|
||||
return result[device.get('name')].changed
|
||||
Reference in New Issue
Block a user