Skip to content

Commit

Permalink
fix structured print for single command
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmontanari committed Apr 4, 2020
1 parent b50189f commit ddb4e63
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nornir_scrapli/functions/print_structured_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from nornir.core.task import AggregatedResult, MultiResult, Result
from nornir.plugins.functions.text import _print_result
from scrapli.response import Response

LOCK = threading.Lock()

Expand Down Expand Up @@ -37,6 +38,8 @@ def print_structured_result(
updated_multi_result = MultiResult(result.name)
for individual_result in multi_result:
scrapli_responses = getattr(individual_result, "scrapli_response", None)
if isinstance(scrapli_responses, Response):
scrapli_responses = [scrapli_responses]
if not scrapli_responses:
updated_multi_result.append(individual_result)
continue
Expand Down

0 comments on commit ddb4e63

Please sign in to comment.