Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nautobot.extras.plugins.api.views.PluginsAPIRootView creates null entries when PluginConfig does not define a base_url #337

Closed
lampwins opened this issue Apr 18, 2021 · 1 comment · Fixed by #395
Assignees
Labels
type: bug Something isn't working as expected
Milestone

Comments

@lampwins
Copy link
Member

lampwins commented Apr 18, 2021

Environment

  • Python version: 3.9
  • Nautobot version: 1.0.0b3

Steps to Reproduce

  1. Create a plugin with name set to myplugin but in its PluginConfig do not define a base_url
  2. Create a model and standard API viewset in the plugin
  3. Navigate to the /api/plugins/ endpoint

Expected Behavior

The response should contain the hyperlink to the plugin's root view with the key myplugin

Observed Behavior

The plugin's hyperlink key is null.

Screen Shot 2021-04-17 at 10 08 02 PM

This is caused because nautobot.extras.plugins.PluginConfig defines base_url = None and nautobot.extras.plugins.api.views.PluginsAPIRootView incorrectly checks if base_url has been define in the plugin's config. See

and
getattr(app_config, "base_url", app_config.label),

The base_url attribute is actually defined but it is None so label is never actually considered. We just need to adjust this logic.

@lampwins lampwins self-assigned this Apr 18, 2021
@lampwins lampwins added the type: bug Something isn't working as expected label Apr 18, 2021
@jathanism jathanism added this to the v1.1.0 milestone Apr 21, 2021
@FragmentedPacket
Copy link
Contributor

I'm curious after looking into this. Do we need to check/validate what settings should NOT be left as None?

It appears we aren't doing any validations for required attributes for PluginConfig, but just for the plugin's actual settings.

@jedelman8 jedelman8 added this to To do in Release v1.1.0 via automation Apr 29, 2021
Release v1.1.0 automation moved this from To do to Done May 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants