From db04deca0dceaa39501fcb6a340771785971ce7c Mon Sep 17 00:00:00 2001 From: Tobias Genannt Date: Mon, 14 Oct 2019 09:47:18 +0200 Subject: [PATCH] Add support for custom scripts Custom scripts were added to Netbox in version 2.6.3. This adds a new directory to the image where custom scripts can be placed. --- configuration/configuration.py | 4 ++++ docker-compose.yml | 1 + scripts/__init__.py | 0 3 files changed, 5 insertions(+) create mode 100644 scripts/__init__.py diff --git a/configuration/configuration.py b/configuration/configuration.py index d1f38a6..14c5d83 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -161,6 +161,10 @@ PREFER_IPV4 = os.environ.get('PREFER_IPV4', 'False').lower() == 'true' # this setting is derived from the installed location. REPORTS_ROOT = os.environ.get('REPORTS_ROOT', '/etc/netbox/reports') +# The file path where custom scripts will be stored. A trailing slash is not needed. Note that the default value of +# this setting is derived from the installed location. +SCRIPTS_ROOT = os.environ.get('SCRIPTS_ROOT', '/etc/netbox/scripts') + # Time zone (default: UTC) TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC') diff --git a/docker-compose.yml b/docker-compose.yml index 6c80b72..dcf9a14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: - ./initializers:/opt/netbox/initializers:z,ro - ./configuration:/etc/netbox/config:z,ro - ./reports:/etc/netbox/reports:z,ro + - ./scripts:/etc/netbox/scripts:z,ro - netbox-nginx-config:/etc/netbox-nginx:z - netbox-static-files:/opt/netbox/netbox/static:z - netbox-media-files:/opt/netbox/netbox/media:z diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29