Skip to content

Commit

Permalink
fixes out of scope logs, fix git repo provides (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkala authored Jan 16, 2025
1 parent 2fb68e5 commit 9cf1d76
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions changes/277.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed multiple git repo provides not working, change filter logic to contains from exact.
1 change: 1 addition & 0 deletions changes/287.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix conditional logic to only show job log entries when git repo is used.
11 changes: 6 additions & 5 deletions nautobot_device_onboarding/nornir_plays/command_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ def netmiko_send_commands(
try:
# Look for custom textfsm templates in the git repo
git_template_dir = get_git_repo_parser_path(parser_type="textfsm")
if not check_for_required_file(git_template_dir, "index"):
logger.debug(
f"Unable to find required index file in {git_template_dir} for textfsm parsing. Falling back to default templates."
)
git_template_dir = None
if git_template_dir:
if not check_for_required_file(git_template_dir, "index"):
logger.debug(
f"Unable to find required index file in {git_template_dir} for textfsm parsing. Falling back to default templates."
)
git_template_dir = None
# Parsing textfsm ourselves instead of using netmikos use_<parser> function to be able to handle exceptions
# ourselves. Default for netmiko is if it can't parse to return raw text which is tougher to handle.
parsed_output = parse_output(
Expand Down
4 changes: 2 additions & 2 deletions nautobot_device_onboarding/nornir_plays/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def get_git_repo():
"""Get the git repo object."""
if (
GitRepository.objects.filter(
provided_contents=["nautobot_device_onboarding.onboarding_command_mappers"]
provided_contents__contains="nautobot_device_onboarding.onboarding_command_mappers"
).count()
== 1
):
repository_record = GitRepository.objects.filter(
provided_contents=["nautobot_device_onboarding.onboarding_command_mappers"]
provided_contents__contains="nautobot_device_onboarding.onboarding_command_mappers"
).first()
return repository_record
return None
Expand Down

0 comments on commit 9cf1d76

Please sign in to comment.