Skip to content

Commit 34ba3a9

Browse files
authored
Version 2.10.0 (#98)
* Add support for NetBox 4.3
1 parent c46baed commit 34ba3a9

File tree

8 files changed

+529
-50
lines changed

8 files changed

+529
-50
lines changed

.github/workflows/commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
max-parallel: 10
3333
matrix:
34-
netbox_version: ["v4.0.7", "v4.1.11", "v4.2.2"]
34+
netbox_version: ["v4.1.11", "v4.2.9", "v4.3.2"]
3535
steps:
3636
- name: Checkout
3737
uses: actions/checkout@v3

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![NetBox version](https://img.shields.io/badge/NetBox-4.0|4.1|4.2-blue.svg)](https://github.com/netbox-community/netbox)
1+
[![NetBox version](https://img.shields.io/badge/NetBox-4.1|4.2|4.3-blue.svg)](https://github.com/netbox-community/netbox)
22
[![Supported Versions](https://img.shields.io/pypi/pyversions/netbox-config-diff.svg)](https://pypi.org/project/netbox-config-diff/)
33
[![PyPI version](https://badge.fury.io/py/netbox-config-diff.svg)](https://badge.fury.io/py/netbox-config-diff)
44
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
@@ -49,9 +49,10 @@ This is possible thanks to the scrapli_cfg. Read [Scrapli](https://github.com/sc
4949
| 3.5 | =>0.1.0, <=2.5.0 |
5050
| 3.6 | =>0.1.0, <=2.6.0 |
5151
| 3.7 | =>0.1.0, <=2.8.0 |
52-
| 4.0 | =>2.6.0 |
52+
| 4.0 | =>2.6.0, <=2.9.0 |
5353
| 4.1 | =>2.7.0 |
5454
| 4.2 | =>2.9.0 |
55+
| 4.3 | =>2.10.0 |
5556

5657
<!--install-start-->
5758
## Installing

development/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
context: ../
77
dockerfile: ./development/Dockerfile
88
args:
9-
NETBOX_VERSION: ${NETBOX_VERSION-develop}
9+
NETBOX_VERSION: ${NETBOX_VERSION-main}
1010
command: sh -c "python manage.py rqworker"
1111
depends_on:
1212
- postgres

netbox_config_diff/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
__author__ = "Artem Kotik"
44
__email__ = "miaow2@yandex.ru"
5-
__version__ = "2.9.0"
5+
__version__ = "2.10.0"
66

77

88
class ConfigDiffConfig(PluginConfig):
@@ -14,7 +14,7 @@ class ConfigDiffConfig(PluginConfig):
1414
version = __version__
1515
base_url = "config-diff"
1616
required_settings = ["USERNAME", "PASSWORD"]
17-
min_version = "4.0.0"
17+
min_version = "4.1.0"
1818
default_settings = {
1919
"USER_SECRET_ROLE": "Username",
2020
"PASSWORD_SECRET_ROLE": "Password",

netbox_config_diff/graphql/enums.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# import strawberry
2+
3+
# from netbox_config_diff.choices import ConfigComplianceStatusChoices, ConfigurationRequestStatusChoices
4+
5+
# __all__ = (
6+
# "ConfigComplianceStatusEnum",
7+
# "ConfigurationRequestStatusEnum",
8+
# )
9+
10+
# ConfigComplianceStatusEnum = strawberry.enum(ConfigComplianceStatusChoices.as_enum())
11+
# ConfigurationRequestStatusEnum = strawberry.enum(ConfigurationRequestStatusChoices.as_enum())

netbox_config_diff/graphql/filters.py

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,47 @@
1-
import strawberry_django
2-
from netbox.graphql.filter_mixins import BaseFilterMixin, autotype_decorator
3-
4-
from netbox_config_diff.filtersets import (
5-
ConfigComplianceFilterSet,
6-
ConfigurationRequestFilterSet,
7-
PlatformSettingFilterSet,
8-
SubstituteFilterSet,
9-
)
10-
from netbox_config_diff.models import ConfigCompliance, ConfigurationRequest, PlatformSetting, Substitute
11-
12-
13-
@strawberry_django.filter(ConfigCompliance, lookups=True)
14-
@autotype_decorator(ConfigComplianceFilterSet)
15-
class ConfigComplianceFilter(BaseFilterMixin):
16-
pass
17-
18-
19-
@strawberry_django.filter(ConfigurationRequest, lookups=True)
20-
@autotype_decorator(ConfigurationRequestFilterSet)
21-
class ConfigurationRequestFilter(BaseFilterMixin):
22-
pass
23-
24-
25-
@strawberry_django.filter(PlatformSetting, lookups=True)
26-
@autotype_decorator(PlatformSettingFilterSet)
27-
class PlatformSettingFilter(BaseFilterMixin):
28-
pass
29-
30-
31-
@strawberry_django.filter(Substitute, lookups=True)
32-
@autotype_decorator(SubstituteFilterSet)
33-
class SubstituteFilter(BaseFilterMixin):
34-
pass
1+
# TODO: After drop 4.2 support write all graphql filters
2+
# import strawberry_django
3+
# import strawberry
4+
# from strawberry.scalars import ID
5+
# from core.graphql.filter_mixins import BaseFilterMixin, BaseObjectTypeFilterMixin, ChangeLogFilterMixin
6+
# from typing import Annotated, TYPE_CHECKING
7+
8+
9+
# from netbox_config_diff.models import ConfigCompliance, ConfigurationRequest, PlatformSetting, Substitute
10+
# if TYPE_CHECKING:
11+
# from .enums import ConfigComplianceStatusEnum, ConfigurationRequestStatusEnum
12+
# from dcim.graphql.filters import DeviceFilter
13+
14+
# @strawberry_django.filter_type(ConfigCompliance, lookups=True)
15+
# class ConfigComplianceFilter(BaseFilterMixin):
16+
# device = Annotated["DeviceFilter", strawberry.lazy("dcim.graphql.filters")] | None = (
17+
# strawberry_django.filter_field()
18+
# )
19+
# device_id: ID | None = strawberry_django.filter_field()
20+
# status: Annotated["ConfigComplianceStatusEnum", strawberry.lazy("dcim.graphql.enums")] | None = (
21+
# strawberry_django.filter_field()
22+
# )
23+
# diff: strawberry_django.FilterLookup[str] | None = strawberry_django.filter_field()
24+
# error: strawberry_django.FilterLookup[str] | None = strawberry_django.filter_field()
25+
# actual_config: strawberry_django.FilterLookup[str] | None = strawberry_django.filter_field()
26+
# rendered_config: strawberry_django.FilterLookup[str] | None = strawberry_django.filter_field()
27+
# missing: strawberry_django.FilterLookup[str] | None = strawberry_django.filter_field()
28+
# extra: strawberry_django.FilterLookup[str] | None = strawberry_django.filter_field()
29+
# patch: strawberry_django.FilterLookup[str] | None = strawberry_django.filter_field()
30+
31+
32+
# @strawberry_django.filter(ConfigurationRequest, lookups=True)
33+
# @autotype_decorator(ConfigurationRequestFilterSet)
34+
# class ConfigurationRequestFilter(BaseFilterMixin):
35+
# pass
36+
37+
38+
# @strawberry_django.filter(PlatformSetting, lookups=True)
39+
# @autotype_decorator(PlatformSettingFilterSet)
40+
# class PlatformSettingFilter(BaseFilterMixin):
41+
# pass
42+
43+
44+
# @strawberry_django.filter(Substitute, lookups=True)
45+
# @autotype_decorator(SubstituteFilterSet)
46+
# class SubstituteFilter(BaseFilterMixin):
47+
# pass

netbox_config_diff/graphql/types.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@
66
from netbox.graphql.types import NetBoxObjectType, ObjectType
77
from users.graphql.types import UserType
88

9-
from netbox_config_diff.graphql.filters import (
10-
ConfigComplianceFilter,
11-
ConfigurationRequestFilter,
12-
PlatformSettingFilter,
13-
SubstituteFilter,
14-
)
159
from netbox_config_diff.models import ConfigCompliance, ConfigurationRequest, PlatformSetting, Substitute
1610

1711

18-
@strawberry_django.type(ConfigCompliance, fields="__all__", filters=ConfigComplianceFilter)
12+
@strawberry_django.type(ConfigCompliance, fields="__all__")
1913
class ConfigComplianceType(ObjectType):
2014
device: Annotated["DeviceType", strawberry.lazy("dcim.graphql.types")]
2115
status: str
@@ -28,7 +22,7 @@ class ConfigComplianceType(ObjectType):
2822
patch: str
2923

3024

31-
@strawberry_django.type(ConfigurationRequest, fields="__all__", filters=ConfigurationRequestFilter)
25+
@strawberry_django.type(ConfigurationRequest, fields="__all__")
3226
class ConfigurationRequestType(NetBoxObjectType):
3327
created_by: Annotated["UserType", strawberry.lazy("users.graphql.types")] | None
3428
approved_by: Annotated["UserType", strawberry.lazy("users.graphql.types")] | None
@@ -42,7 +36,7 @@ class ConfigurationRequestType(NetBoxObjectType):
4236
completed: str
4337

4438

45-
@strawberry_django.type(PlatformSetting, fields="__all__", filters=PlatformSettingFilter)
39+
@strawberry_django.type(PlatformSetting, fields="__all__")
4640
class PlatformSettingType(NetBoxObjectType):
4741
platform: Annotated["PlatformType", strawberry.lazy("dcim.graphql.types")]
4842
description: str
@@ -51,7 +45,7 @@ class PlatformSettingType(NetBoxObjectType):
5145
exclude_regex: str
5246

5347

54-
@strawberry_django.type(Substitute, fields="__all__", filters=SubstituteFilter)
48+
@strawberry_django.type(Substitute, fields="__all__")
5549
class SubstituteType(NetBoxObjectType):
5650
platform_setting: Annotated["PlatformSettingType", strawberry.lazy("netbox_config_diff.graphql.types")]
5751
name: str

0 commit comments

Comments
 (0)