Skip to content

Commit

Permalink
Merge pull request #56 from Onemind-Services-LLC/OMS-369-upgrade-v4.1
Browse files Browse the repository at this point in the history
OMS-369 Support Added for NetBox v4.1
  • Loading branch information
abhi1693 authored Oct 18, 2024
2 parents dad937a + 7c02319 commit 429a70c
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG NETBOX_VARIANT=v4.0
ARG NETBOX_VARIANT=v4.1

FROM netboxcommunity/netbox:${NETBOX_VARIANT}

RUN mkdir -pv /plugins/netbox-metatype-importer
COPY . /plugins/netbox-metatype-importer

RUN /opt/netbox/venv/bin/python3 /plugins/netbox-metatype-importer/setup.py develop
RUN cp -rf /plugins/netbox-metatype-importer/netbox_metatype_importer/ /opt/netbox/venv/lib/python3.11/site-packages/netbox_metatype_importer
RUN cp -rf /plugins/netbox-metatype-importer/netbox_metatype_importer/ /opt/netbox/venv/lib/python3.12/site-packages/netbox_metatype_importer
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ To use GraphQL API you need to set GitHub personal access token in plugin settin
| 3.6.x | 0.2.x |
| 3.7.x | 0.3.x |
| 4.0.x | 0.4.x |
| 4.1.x | 0.5.x |

## Installation

Expand Down
4 changes: 2 additions & 2 deletions netbox_metatype_importer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class NetBoxMetatypeImporterConfig(PluginConfig):
author = metadata.get('Author')
author_email = metadata.get('Author-email')
base_url = "meta-types"
min_version = '4.0.0'
max_version = '4.0.99'
min_version = '4.1.0'
max_version = '4.1.99'
default_settings = {
'repo_owner': 'netbox-community',
'repo': 'devicetype-library',
Expand Down
3 changes: 2 additions & 1 deletion netbox_metatype_importer/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from netbox_metatype_importer.models import MetaType
from rest_framework import serializers
from rest_framework.serializers import HyperlinkedIdentityField

from netbox_metatype_importer.models import MetaType


class MetaTypeSerializer(serializers.ModelSerializer):
url = HyperlinkedIdentityField(view_name="plugins-api:netbox_metatype_importer-api:metatype-detail")
Expand Down
7 changes: 3 additions & 4 deletions netbox_metatype_importer/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from netbox.api.routers import NetBoxRouter

from .views import (
DeviceTypeListViewSet,
ModuleTypeListViewSet,
MetaDeviceTypeLoadViewSet,
MetaModuleTypeLoadViewSet,
MetaDeviceTypeImportViewSet,
MetaDeviceTypeLoadViewSet,
MetaModuleTypeImportViewSet,
MetaModuleTypeLoadViewSet,
MetaTypeRootView,
ModuleTypeListViewSet,
)

router = NetBoxRouter()
Expand Down
6 changes: 3 additions & 3 deletions netbox_metatype_importer/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
from django.db.models import Q
from django.shortcuts import reverse
from django.utils.text import slugify
from netbox_metatype_importer.filters import MetaTypeFilterSet
from netbox_metatype_importer.forms import MetaTypeFilterForm
from netbox_metatype_importer.graphql.gql import GQLError, GitHubGqlAPI
from rest_framework import mixins as drf_mixins, status
from rest_framework.response import Response
from rest_framework.routers import APIRootView

from dcim import forms
from dcim.models import DeviceType, Manufacturer, ModuleType
from netbox.api.viewsets import BaseViewSet
from netbox_metatype_importer.filters import MetaTypeFilterSet
from netbox_metatype_importer.forms import MetaTypeFilterForm
from netbox_metatype_importer.graphql.gql import GQLError, GitHubGqlAPI
from utilities.exceptions import AbortTransaction, PermissionsViolation
from utilities.forms.bulk_import import BulkImportForm
from . import serializers
Expand Down
1 change: 0 additions & 1 deletion netbox_metatype_importer/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.test import TestCase

from ..choices import *
from ..models import *


Expand Down
2 changes: 1 addition & 1 deletion netbox_metatype_importer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from netbox_metatype_importer.graphql.gql import GitHubGqlAPI, GQLError

from dcim import forms
from netbox_metatype_importer.graphql.gql import GQLError, GitHubGqlAPI
from .models import MetaType

__all__ = ['load_data', 'related_object_forms']
Expand Down
2 changes: 1 addition & 1 deletion netbox_metatype_importer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from django.shortcuts import redirect, reverse
from django.utils.text import slugify
from django.views.generic import View
from netbox_metatype_importer.graphql.gql import GQLError, GitHubGqlAPI

from dcim import forms
from dcim.models import DeviceType, Manufacturer, ModuleType
from netbox.views import generic
from netbox_metatype_importer.graphql.gql import GQLError, GitHubGqlAPI
from utilities.exceptions import AbortTransaction, PermissionsViolation
from utilities.forms.bulk_import import BulkImportForm
from utilities.views import ContentTypePermissionRequiredMixin, GetReturnURLMixin
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='netbox-metatype-importer',
version='0.4.1',
version='0.5.0',
description='Easily import Device and Module types from GitHub repo',
long_description='Import MetaTypes into NetBox',
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 429a70c

Please sign in to comment.