Skip to content

Commit

Permalink
Merge pull request #81 from jvanderaa/fix17_get_interface_conn
Browse files Browse the repository at this point in the history
Provides a response with empty choices
  • Loading branch information
jvanderaa authored Aug 19, 2021
2 parents fbc9521 + 64f0303 commit 2043726
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nautobot_chatops/workers/nautobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,17 @@ def get_interface_connections(dispatcher, filter_type, filter_value_1, filter_va
f'Unknown filter type "{filter_type}"',
) # command did not run to completion and therefore should not be logged

# Check on empty choice list, send an error back
if not choices:
dispatcher.send_markdown(
message=f"Unable to filter by '{filter_type}', as it appears there is no corresponding data available",
ephemeral=True,
)
return (
CommandStatusChoices.STATUS_FAILED,
f'No choices found when filtering by "{filter_type}"',
)

if filter_type != "device":
dispatcher.prompt_from_menu(
f"nautobot get-interface-connections {filter_type}",
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ load-plugins="pylint_django"
disable=""",
django-not-configured,
too-few-public-methods,
too-many-lines,
"""

[tool.pylint.miscellaneous]
Expand Down

0 comments on commit 2043726

Please sign in to comment.