You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@classmethoddefmerge_config(
cls,
task: Task,
logger,
obj,
config: str,
) ->Result:
"""Send configuration to merge on the device. Args: task (Task): Nornir Task. logger (logging.Logger): Logger that may be a Nautobot Jobs or Python logger. obj (Device): A Nautobot Device Django ORM object instance. config (str): The config set. Raises: NornirNautobotException: Authentication error. NornirNautobotException: Timeout error. NornirNautobotException: Other exception. Returns: Result: Nornir Result object with a dict as a result containing what changed and the result of the push. """logger.info("Config merge via netmiko starting", extra={"object": obj})
# Sending None to napalm_configure for revert_in will disable it, so we don't want a default value.try:
push_result=task.run(
task=netmiko_send_config,
config_commands=config.splitlines(),
enable=True,
)
exceptNornirSubTaskErrorasexc:
error_msg=f"`E1015:` Failed with an unknown issue. `{exc.result.exception}`"logger.error(error_msg, extra={"object": obj})
raiseNornirNautobotException(error_msg)
logger.info(
f"result: {push_result[0].result}, changed: {push_result.changed}",
extra={"object": obj},
)
ifpush_result.diff:
logger.info(f"Diff:\n```\n_{push_result.diff}\n```", extra={"object": obj})
logger.info("Config merge ended", extra={"object": obj})
returnResult(
host=task.host,
result={"changed": push_result.changed, "result": push_result[0].result},
)
The text was updated successfully, but these errors were encountered:
something like
The text was updated successfully, but these errors were encountered: