diff --git a/README.md b/README.md index 5031584..80b7b37 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Load data from YAML files into Netbox First activate your virtual environment where Netbox is installed, the install the plugin version correspondig to your Netbox version. ```bash -pip install "netbox-initializers==3.6.*" +pip install "netbox-initializers==3.7.*" ``` Then you need to add the plugin to the `PLUGINS` array in the Netbox configuration. ```python @@ -36,6 +36,6 @@ The initializers where a part of the Docker image and where then extracted into To use the new plugin in a the Netbox Docker image, it musst be installad into the image. To this, the following example can be used as a starting point: ```dockerfile -FROM netboxcommunity/netbox:v3.6 -RUN /opt/netbox/venv/bin/pip install "netbox-initializers==3.6.*" +FROM netboxcommunity/netbox:v3.7 +RUN /opt/netbox/venv/bin/pip install "netbox-initializers==3.7.*" ``` diff --git a/pyproject.toml b/pyproject.toml index 1555486..6b19876 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ license = "Apache-2.0" name = "netbox-initializers" readme = "README.md" repository = "https://github.com/tobiasge/netbox-initializers" -version = "3.6.0" +version = "3.7.0" [tool.poetry.dependencies] python = "^3.8" diff --git a/src/netbox_initializers/__init__.py b/src/netbox_initializers/__init__.py index 467808d..93b759b 100644 --- a/src/netbox_initializers/__init__.py +++ b/src/netbox_initializers/__init__.py @@ -5,10 +5,10 @@ class NetBoxInitializersConfig(PluginConfig): name = "netbox_initializers" verbose_name = "NetBox Initializers" description = "Load initial data into Netbox" - version = "3.6.0" + version = "3.7.0" base_url = "initializers" - min_version = "3.6.0" - max_version = "3.6.99" + min_version = "3.7.0" + max_version = "3.7.99" config = NetBoxInitializersConfig diff --git a/src/netbox_initializers/initializers/webhooks.py b/src/netbox_initializers/initializers/webhooks.py index e23f76e..1a3447d 100644 --- a/src/netbox_initializers/initializers/webhooks.py +++ b/src/netbox_initializers/initializers/webhooks.py @@ -20,20 +20,10 @@ def load_data(self): if webhooks is None: return for hook in webhooks: - obj_types = hook.pop("object_types") - - try: - obj_type_ids = [get_content_type_id(hook["name"], obj) for obj in obj_types] - except ContentType.DoesNotExist: - continue - matching_params, defaults = self.split_params(hook) webhook, created = Webhook.objects.get_or_create(**matching_params, defaults=defaults) if created: - webhook.content_types.set(obj_type_ids) - webhook.save() - print("🪝 Created Webhook {0}".format(webhook.name)) diff --git a/src/netbox_initializers/initializers/yaml/webhooks.yml b/src/netbox_initializers/initializers/yaml/webhooks.yml index deb1b39..6e400d2 100644 --- a/src/netbox_initializers/initializers/yaml/webhooks.yml +++ b/src/netbox_initializers/initializers/yaml/webhooks.yml @@ -1,27 +1,8 @@ -## Possible Choices: -## object_types: -## - device -## - site -## - any-other-content-type -## types: -## - type_create -## - type_update -## - type_delete ## Examples: # - name: device_creation # payload_url: 'http://localhost:8080' -# object_types: -# - device -# - cable -# type_create: True # - name: device_update # payload_url: 'http://localhost:8080' -# object_types: -# - device -# type_update: True # - name: device_delete # payload_url: 'http://localhost:8080' -# object_types: -# - device -# type_delete: True diff --git a/test/Dockerfile b/test/Dockerfile index 5c1ec24..5840f97 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,4 +1,4 @@ -FROM netboxcommunity/netbox:v3.6 +FROM netboxcommunity/netbox:v3.7 COPY ../ /opt/netbox-initializers/ COPY ./test/config/plugins.py /etc/netbox/config/