Skip to content

Commit

Permalink
Merge pull request #235 from nautobot/develop
Browse files Browse the repository at this point in the history
Release v2.0.2
  • Loading branch information
smk4664 authored Aug 11, 2023
2 parents 48da686 + b32e92c commit 0bb6d36
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 25 deletions.
1 change: 1 addition & 0 deletions changes/223.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed App initialization when `[grafana]` extra is not installed.
7 changes: 6 additions & 1 deletion docs/admin/release_notes/version_2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
# v2.0 Release Notes

<!-- towncrier release notes start -->
## [v2.0.2 (2023-08-11)](https://github.com/nautobot/nautobot-plugin-chatops/releases/tag/v2.0.2)

### Changed

- [#233](https://github.com/nautobot/nautobot-plugin-chatops/pull/233) - Fixed App initialization when `[grafana]` extra is not installed.

## [v2.0.1 (2023-08-08)](https://github.com/nautobot/nautobot-plugin-chatops/releases/tag/v2.0.1)

### Changed

- [#228](https://github.com/nautobot/nautobot-plugin-chatops/issues/228) - Move Contributing Changelog Fragments higher in documentation


## [v2.0.0 (2023-08-02)](https://github.com/nautobot/nautobot-plugin-chatops/releases/tag/v2.0.0)

### Added
Expand Down
18 changes: 0 additions & 18 deletions nautobot_chatops/integrations/grafana/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
from typing import List
from termcolor import colored

from nautobot.dcim import models as dcim_models
from nautobot.ipam import models as ipam_models
from nautobot.extras import models as extra_models
from nautobot.tenancy import models as tenancy_models
from nautobot.virtualization import models as virtualization_models
from nautobot.circuits import models as circuit_models

from schema_enforcer import config
from schema_enforcer.schemas.manager import SchemaManager
from schema_enforcer.instances.file import InstanceFileManager
Expand All @@ -23,17 +16,6 @@
">": "greater-than",
}

# Valid models to be used in Panel Variables as query options. If a model doesn't exist in
# this list, you cannot set or use the `query` field in a panel variable.
VALID_MODELS = (
dcim_models,
ipam_models,
extra_models,
tenancy_models,
virtualization_models,
circuit_models,
)


def format_command(command: str) -> str:
"""_format_command_name will format the panel titles into a valid slash command.
Expand Down
21 changes: 19 additions & 2 deletions nautobot_chatops/integrations/grafana/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
from django.core.exceptions import ValidationError
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.translation import gettext_lazy as _
from nautobot.extras.utils import extras_features
from nautobot.circuits import models as circuit_models
from nautobot.core.models.generics import PrimaryModel, OrganizationalModel
from nautobot_chatops.integrations.grafana.helpers import VALID_MODELS
from nautobot.dcim import models as dcim_models
from nautobot.extras import models as extra_models
from nautobot.extras.utils import extras_features
from nautobot.ipam import models as ipam_models
from nautobot.tenancy import models as tenancy_models
from nautobot.virtualization import models as virtualization_models


# Valid models to be used in Panel Variables as query options. If a model doesn't exist in
# this list, you cannot set or use the `query` field in a panel variable.
VALID_MODELS = (
dcim_models,
ipam_models,
extra_models,
tenancy_models,
virtualization_models,
circuit_models,
)


@extras_features(
Expand Down
3 changes: 1 addition & 2 deletions nautobot_chatops/integrations/grafana/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from nautobot.utilities.querysets import RestrictedQuerySet
from nautobot_chatops.dispatchers import Dispatcher
from nautobot_chatops.workers import handle_subcommands, add_subcommand
from nautobot_chatops.integrations.grafana.models import Panel, PanelVariable
from nautobot_chatops.integrations.grafana.helpers import VALID_MODELS
from nautobot_chatops.integrations.grafana.models import Panel, PanelVariable, VALID_MODELS
from nautobot_chatops.integrations.grafana.grafana import (
SLASH_COMMAND,
LOGGER,
Expand Down
10 changes: 9 additions & 1 deletion nautobot_chatops/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Django urlpatterns declaration for nautobot_chatops plugin."""
import logging

from django.urls import path

Expand All @@ -17,7 +18,14 @@
AccessGrantBulkDeleteView,
)

from nautobot_chatops.integrations.grafana.urls import urlpatterns as grafana_urlpatterns
try:
from nautobot_chatops.integrations.grafana.urls import urlpatterns as grafana_urlpatterns
# pylint: disable-next=broad-except
except Exception:
grafana_urlpatterns = []
logger = logging.getLogger(__name__)
logger.warning("Grafana ChatOps integration is not available.", exc_info=True)


urlpatterns = [
path("", NautobotHomeView.as_view(), name="home"),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nautobot-chatops"
version = "2.0.1"
version = "2.0.2"
description = "A plugin providing chatbot capabilities for Nautobot"
authors = ["Network to Code, LLC <opensource@networktocode.com>"]
readme = "README.md"
Expand Down

0 comments on commit 0bb6d36

Please sign in to comment.