Code Monkey home page Code Monkey logo

nautobot-plugin-chatops-meraki's Issues

The traceback is returned if the API key is not defined in Nautobot settings

Environment

  • Python version: any
  • Nautobot version: any
  • Nautobot Chatops Plugin version: any
  • nautobot-plugin-chatops-meraki version: 1.2.0

Expected Behavior

The plugin should read the key either from settings or from an environmental variable as per documentation.

Observed Behavior

If the key is not defined in the settings you get the following traceback:

nautobot_1  | Internal Server Error: /api/plugins/chatops/slack/slash_command/
nautobot_1  | Traceback (most recent call last):
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
nautobot_1  |     response = get_response(request)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
nautobot_1  |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
nautobot_1  |     return self.dispatch(request, *args, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper
nautobot_1  |     return bound_method(*args, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
nautobot_1  |     return view_func(*args, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
nautobot_1  |     return handler(request, *args, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot_chatops/api/views/slack.py", line 104, in post
nautobot_1  |     registry = get_commands_registry()
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot_chatops/workers/__init__.py", line 70, in get_commands_registry
nautobot_1  |     command_func = worker.load()
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2450, in load
nautobot_1  |     return self.resolve()
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2456, in resolve
nautobot_1  |     module = __import__(self.module_name, fromlist=['__name__'], level=0)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot_plugin_chatops_meraki/worker.py", line 26, in <module>
nautobot_1  |     MERAKI_DASHBOARD_API_KEY = settings.PLUGINS_CONFIG["nautobot_plugin_chatops_meraki"]["meraki_dashboard_api_key"]
nautobot_1  | KeyError: 'meraki_dashboard_api_key'

Steps to Reproduce

  1. Install the plugin version 1.2.0
  2. Start Nautobot without the nautobot-plugin-chatops-meraki plugin settings in the configuration file.
  3. Execute the /meraki command.

Docs review

A couple of links to the ChatOps plugin are not working in the README.md file in the section In https://github.com/networktocode-llc/nautobot-plugin-chatops-meraki/blob/develop/README.md#command-setup

  1. The hyperlink in Add a slash command to Slack called /meraki. See the nautobot-chatops installation guide for instructions on adding a slash command to your Slack channel. for the nautobot-chatops installation guide is https://github.com/nautobot/nautobot-plugin-chatops/blob/develop/docs/chat_setup.md. This URL is not found. I think the file name changed.

  2. Same thing as above with linked URL in same section in the sentence You may need to adjust your Access Grants in Nautobot depending on your security requirements.. The hyperlink for Access Grants in Nautobot is https://github.com/nautobot/nautobot-plugin-chatops/blob/develop/docs/chat_setup.md#grant-access-to-the-chatbot, which leads nowhere.

  3. In the README.md file, I recommend describing how to add that environment variable.

The plugin requires the use of a environment variable. See below.

MERAKI_DASHBOARD_API_KEY: Is set to the dashboard API key

Allow API Key to be specified in config or read from file

When deploying this plugin in our environment I store the API key in hashicorp vault. I can query vault in the Nautobot config file very easily. I can also use the vault agent to inject the secret as a file but injecting it as an environment variable is much harder with vault and arguably less secure. I would suggest allowing this variable to be set in the config file where I can configure any way I might want.

Inconsistent handling of "no matches found" cases

Expected Behavior

Consistent behavior across chat commands for the case where no matches are found corresponding to a given request.

Observed Behavior

Some commands (get_organizations, get_admins, get_networks, get_firewall_performance, get_camera_recent) return STATUS_FAILED when no matches are found, while other commands (get_devices, get_neighbors) send a message to the user but return STATUS_SUCCESS. Others (get_switchports, get_switchports_status, get_wlan_ssids, get_clients) have no special handling of this case at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.