From efc53318733e9befbe539f206aed26ddfc522f25 Mon Sep 17 00:00:00 2001 From: Guillaume COURS Date: Sat, 24 Jul 2021 17:53:34 +0200 Subject: [PATCH 1/3] create netbox/static folder before collect static files --- manifests/config.pp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index e9ce50e..ef2ef6e 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -248,9 +248,16 @@ require => File[$config_file], notify => Exec['collect static files'], } + file { 'static_folder': + ensure => 'directory', + path => "${software_directory}/netbox/static", + owner => $user, + group => $group, + mode => '0644', + } exec { 'collect static files': command => "${venv_dir}/bin/python3 netbox/manage.py collectstatic --no-input", - require => File[$config_file], + require => [ File[$config_file], File['static_folder'] ], refreshonly => true, } } From 7904c1829c1ef85540d64cbce64c392992ab0131 Mon Sep 17 00:00:00 2001 From: Guillaume COURS Date: Sat, 24 Jul 2021 17:54:29 +0200 Subject: [PATCH 2/3] remove deprecated parameter when install netbox v3 and above --- manifests/config.pp | 7 +++++++ manifests/init.pp | 1 + templates/configuration.py.epp | 3 +++ 3 files changed, 11 insertions(+) diff --git a/manifests/config.pp b/manifests/config.pp index ef2ef6e..1b9282d 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -2,6 +2,11 @@ # # Configures Netbox and gunicorn, and load the database schema. # +# @param version +# The version of Netbox. This must match the version in the +# tarball. This is used for managing files, directories and paths in +# the service. +# # @param user # The user owning the Netbox installation files, and running the # service. @@ -135,6 +140,7 @@ # @example # include netbox::config class netbox::config ( + String $version, String $user, String $group, Stdlib::Absolutepath $install_root, @@ -195,6 +201,7 @@ file { $config_file: content => epp('netbox/configuration.py.epp', { + 'version' => $version, 'allowed_hosts' => $allowed_hosts, 'database_name' => $database_name, 'database_user' => $database_user, diff --git a/manifests/init.pp b/manifests/init.pp index 633c5c7..1b88723 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -347,6 +347,7 @@ } class { 'netbox::config': + version => $version, user => $user, group => $group, install_root => $install_root, diff --git a/templates/configuration.py.epp b/templates/configuration.py.epp index dbf3c47..67bc477 100644 --- a/templates/configuration.py.epp +++ b/templates/configuration.py.epp @@ -1,4 +1,5 @@ <% | + String $version, Array[Stdlib::Host] $allowed_hosts, String $database_name, String $database_user, @@ -115,8 +116,10 @@ BANNER_LOGIN = '<%= $banner_login %>' # BASE_PATH = 'netbox/' BASE_PATH = '<%= $base_path %>' +<% if versioncmp(split($version, '[.]')[0], '3') < 0 { -%> # Cache timeout in seconds. Set to 0 to dissable caching. Defaults to 900 (15 minutes) CACHE_TIMEOUT = 900 +<% } -%> # Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90) CHANGELOG_RETENTION = 90 From 5b3a9c6e478fe90b9ec28f26cceb804c23bad26f Mon Sep 17 00:00:00 2001 From: Guillaume COURS Date: Sat, 24 Jul 2021 16:46:22 +0200 Subject: [PATCH 3/3] bump python version 3.6 to 3.9 --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 5ed143e..457420c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -81,8 +81,8 @@ $packages =[ gcc, - python36, - python36-devel, + python39, + python39-devel, libxml2-devel, libxslt-devel, libffi-devel,