From 7b1335825be66074ef98db7bd96a5f85d8b42810 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 3 Nov 2021 10:47:17 -0400 Subject: [PATCH 1/3] Closes #7687: Update CentOS installation docs --- docs/installation/1-postgresql.md | 3 --- docs/installation/3-netbox.md | 7 ++++++- docs/installation/index.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/installation/1-postgresql.md b/docs/installation/1-postgresql.md index 43b12f0e8..4d49d8f43 100644 --- a/docs/installation/1-postgresql.md +++ b/docs/installation/1-postgresql.md @@ -21,9 +21,6 @@ This section entails the installation and configuration of a local PostgreSQL da sudo postgresql-setup --initdb ``` - !!! info - PostgreSQL 9.6 and later are available natively on CentOS 8.2. If using an earlier CentOS release, you may need to [install it from an RPM](https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/). - CentOS configures ident host-based authentication for PostgreSQL by default. Because NetBox will need to authenticate using a username and password, modify `/var/lib/pgsql/data/pg_hba.conf` to support MD5 authentication by changing `ident` to `md5` for the lines below: ```no-highlight diff --git a/docs/installation/3-netbox.md b/docs/installation/3-netbox.md index 87a64b325..bf1b27895 100644 --- a/docs/installation/3-netbox.md +++ b/docs/installation/3-netbox.md @@ -17,8 +17,13 @@ Begin by installing all system packages required by NetBox and its dependencies. === "CentOS" + !!! warning + CentOS 8 does not provide Python 3.7 or later via its native package manager. You will need to install it via some other means. [Here is an example](https://tecadmin.net/install-python-3-7-on-centos-8/) of installing Python 3.7 from source. + + Once you have Python 3.7 or later installed, install the remaining system packages: + ```no-highlight - sudo yum install -y gcc python36 python36-devel python3-pip libxml2-devel libxslt-devel libffi-devel libpq-devel openssl-devel redhat-rpm-config + sudo yum install -y gcc libxml2-devel libxslt-devel libffi-devel libpq-devel openssl-devel redhat-rpm-config ``` Before continuing with either platform, update pip (Python's package management tool) to its latest release: diff --git a/docs/installation/index.md b/docs/installation/index.md index bd1074b5e..ccfb8821d 100644 --- a/docs/installation/index.md +++ b/docs/installation/index.md @@ -1,6 +1,6 @@ # Installation -The installation instructions provided here have been tested to work on Ubuntu 20.04 and CentOS 8.2. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors. +The installation instructions provided here have been tested to work on Ubuntu 20.04 and CentOS 8.3. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors. The following sections detail how to set up a new instance of NetBox: From 8f1acb700d72467ffe7ae5c8502422a1eac0693d Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 4 Nov 2021 11:31:39 -0400 Subject: [PATCH 2/3] Fix ID list creation in API tests --- netbox/utilities/testing/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/testing/api.py b/netbox/utilities/testing/api.py index 8498f93ae..b3fa5704f 100644 --- a/netbox/utilities/testing/api.py +++ b/netbox/utilities/testing/api.py @@ -345,7 +345,7 @@ class APIViewTestCases: obj_perm.users.add(self.user) obj_perm.object_types.add(ContentType.objects.get_for_model(self.model)) - id_list = self._get_queryset().values_list('id', flat=True)[:3] + id_list = list(self._get_queryset().values_list('id', flat=True)[:3]) self.assertEqual(len(id_list), 3, "Insufficient number of objects to test bulk update") data = [ {'id': id, **self.bulk_update_data} for id in id_list @@ -416,7 +416,7 @@ class APIViewTestCases: # Target the three most recently created objects to avoid triggering recursive deletions # (e.g. with MPTT objects) - id_list = self._get_queryset().order_by('-id').values_list('id', flat=True)[:3] + id_list = list(self._get_queryset().order_by('-id').values_list('id', flat=True)[:3]) self.assertEqual(len(id_list), 3, "Insufficient number of objects to test bulk deletion") data = [{"id": id} for id in id_list] From 773fd47ca6f7a33238d63816e4a589c2f2f5687c Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 5 Nov 2021 08:45:57 -0400 Subject: [PATCH 3/3] Fixes #7752: Fix minimum version check under Python v3.10 --- docs/release-notes/version-3.0.md | 4 ++++ netbox/netbox/settings.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 528b90846..eaac82444 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -2,6 +2,10 @@ ## v3.0.10 (FUTURE) +### Bug Fixes + +* [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 + --- ## v3.0.9 (2021-11-03) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index ccf3b3752..b0c996141 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -4,6 +4,7 @@ import os import platform import re import socket +import sys import warnings from urllib.parse import urlsplit @@ -25,7 +26,7 @@ HOSTNAME = platform.node() BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Validate Python version -if platform.python_version_tuple() < ('3', '7'): +if sys.version_info < (3, 7): raise RuntimeError( f"NetBox requires Python 3.7 or higher (current: Python {platform.python_version()})" )