diff --git a/.ci/ansible/settings.py.j2 b/.ci/ansible/settings.py.j2 index ab8ebb3dce0..0b8a1a16a4d 100644 --- a/.ci/ansible/settings.py.j2 +++ b/.ci/ansible/settings.py.j2 @@ -1,3 +1,4 @@ +SECRET_KEY = "{{ django_secret }}" CONTENT_ORIGIN = "{{ pulp_scheme }}://pulp:{{ 443 if pulp_scheme == 'https' else 80 }}" ANSIBLE_API_HOSTNAME = "{{ pulp_scheme }}://pulp:{{ 443 if pulp_scheme == 'https' else 80 }}" ANSIBLE_CONTENT_HOSTNAME = "{{ pulp_scheme }}://pulp:{{ 443 if pulp_scheme == 'https' else 80 }}/pulp/content" diff --git a/.ci/ansible/start_container.yaml b/.ci/ansible/start_container.yaml index e0891b7ab5d..4ef94c861cf 100644 --- a/.ci/ansible/start_container.yaml +++ b/.ci/ansible/start_container.yaml @@ -18,6 +18,8 @@ ansible.builtin.template: src: "settings.py.j2" dest: "settings/settings.py" + vars: + django_secret: "lookup('community.general.random_string', length=50, overwrite_all='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')" - name: "Setup docker networking" community.docker.docker_network: diff --git a/pulp_file/tests/functional/api/test_domains.py b/pulp_file/tests/functional/api/test_domains.py index 07c18500f0a..c397e8fd8c1 100644 --- a/pulp_file/tests/functional/api/test_domains.py +++ b/pulp_file/tests/functional/api/test_domains.py @@ -3,7 +3,7 @@ import pytest -from pulpcore.app import settings +from pulpcore.app import settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.client.pulp_file import ApiException from pulpcore.client.pulpcore import ApiException as CoreApiException from pulpcore.client.pulpcore import Repair diff --git a/pulp_file/tests/functional/api/test_pulp_export.py b/pulp_file/tests/functional/api/test_pulp_export.py index 4650efc0498..e4a32f9aeeb 100644 --- a/pulp_file/tests/functional/api/test_pulp_export.py +++ b/pulp_file/tests/functional/api/test_pulp_export.py @@ -2,7 +2,7 @@ import pytest -from pulpcore.app import settings +from pulpcore.app import settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.client.pulpcore.exceptions import ApiException from pulpcore.constants import TASK_STATES diff --git a/pulpcore/app/authentication.py b/pulpcore/app/authentication.py index 5d5a3cdb449..e260af7fca2 100644 --- a/pulpcore/app/authentication.py +++ b/pulpcore/app/authentication.py @@ -10,7 +10,7 @@ from rest_framework.authentication import BaseAuthentication, RemoteUserAuthentication from rest_framework.exceptions import AuthenticationFailed -from pulpcore.app import settings +from pulpcore.app import settings # noqa: TID251 Unfixable in old dynaconf version. _logger = logging.getLogger(__name__) diff --git a/pulpcore/app/redis_connection.py b/pulpcore/app/redis_connection.py index e612680cbd0..8839f8aecb8 100644 --- a/pulpcore/app/redis_connection.py +++ b/pulpcore/app/redis_connection.py @@ -1,7 +1,7 @@ from redis import Redis from redis.asyncio import Redis as aRedis -from pulpcore.app.settings import settings +from pulpcore.app.settings import settings # noqa: TID251 Unfixable in old dynaconf version. _conn = None _a_conn = None diff --git a/pulpcore/app/serializers/exporter.py b/pulpcore/app/serializers/exporter.py index 33339c4eda3..14aad40eaae 100644 --- a/pulpcore/app/serializers/exporter.py +++ b/pulpcore/app/serializers/exporter.py @@ -5,7 +5,7 @@ from rest_framework import serializers from rest_framework.validators import UniqueValidator -from pulpcore.app import models, settings +from pulpcore.app import models, settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.app.serializers import ( DetailIdentityField, DetailRelatedField, diff --git a/pulpcore/app/serializers/importer.py b/pulpcore/app/serializers/importer.py index 742ad9ab176..75db641ecd1 100644 --- a/pulpcore/app/serializers/importer.py +++ b/pulpcore/app/serializers/importer.py @@ -5,7 +5,7 @@ from rest_framework import serializers from rest_framework.validators import UniqueValidator -from pulpcore.app import models, settings +from pulpcore.app import models, settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.app.serializers import ( DetailIdentityField, ImportIdentityField, diff --git a/pulpcore/app/serializers/repository.py b/pulpcore/app/serializers/repository.py index d2b90ff1c4a..e01a956e56c 100644 --- a/pulpcore/app/serializers/repository.py +++ b/pulpcore/app/serializers/repository.py @@ -6,7 +6,7 @@ from rest_framework import fields, serializers from rest_framework_nested.serializers import NestedHyperlinkedModelSerializer -from pulpcore.app import models, settings +from pulpcore.app import models, settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.app.serializers import ( DetailIdentityField, DetailRelatedField, diff --git a/pulpcore/app/views/importer.py b/pulpcore/app/views/importer.py index 5e5f104588a..00110bd5e42 100644 --- a/pulpcore/app/views/importer.py +++ b/pulpcore/app/views/importer.py @@ -6,7 +6,7 @@ from rest_framework.response import Response from rest_framework.views import APIView -from pulpcore.app import settings +from pulpcore.app import settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.app.serializers import PulpImportCheckResponseSerializer, PulpImportCheckSerializer diff --git a/pulpcore/cache/cache.py b/pulpcore/cache/cache.py index 4fdaf7d691f..cf5643ad76b 100644 --- a/pulpcore/cache/cache.py +++ b/pulpcore/cache/cache.py @@ -16,7 +16,7 @@ get_async_redis_connection, get_redis_connection, ) -from pulpcore.app.settings import settings +from pulpcore.app.settings import settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.responses import ArtifactResponse DEFAULT_EXPIRES_TTL = settings.CACHE_SETTINGS["EXPIRES_TTL"] diff --git a/pulpcore/tests/functional/api/test_auth.py b/pulpcore/tests/functional/api/test_auth.py index effd89c604d..eefb106fd4b 100644 --- a/pulpcore/tests/functional/api/test_auth.py +++ b/pulpcore/tests/functional/api/test_auth.py @@ -9,7 +9,7 @@ import pytest -from pulpcore.app import settings +from pulpcore.app import settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.client.pulpcore import ApiException diff --git a/pulpcore/tests/functional/api/using_plugin/test_filesystemexport.py b/pulpcore/tests/functional/api/using_plugin/test_filesystemexport.py index 414b1b94513..00403a272e3 100644 --- a/pulpcore/tests/functional/api/using_plugin/test_filesystemexport.py +++ b/pulpcore/tests/functional/api/using_plugin/test_filesystemexport.py @@ -9,7 +9,7 @@ import pytest -from pulpcore.app import settings +from pulpcore.app import settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.client.pulp_file import RepositorySyncURL from pulpcore.client.pulpcore.exceptions import ApiException diff --git a/pulpcore/tests/functional/api/using_plugin/test_pulpimport.py b/pulpcore/tests/functional/api/using_plugin/test_pulpimport.py index ef34be5a060..9c13f4efab5 100644 --- a/pulpcore/tests/functional/api/using_plugin/test_pulpimport.py +++ b/pulpcore/tests/functional/api/using_plugin/test_pulpimport.py @@ -12,7 +12,7 @@ import pytest -from pulpcore.app import settings +from pulpcore.app import settings # noqa: TID251 Unfixable in old dynaconf version. from pulpcore.client.pulp_file import RepositorySyncURL from pulpcore.client.pulpcore.exceptions import ApiException diff --git a/pyproject.toml b/pyproject.toml index e44ac1a73ef..5914ca16293 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,7 +162,6 @@ replace = "version = \"{new_version}\"" [[tool.bumpversion.files]] filename = "./setup.py" - [tool.ruff] # This section is managed by the plugin template. Do not edit manually. line-length = 100 @@ -184,6 +183,7 @@ extend-select = [ [tool.ruff.lint.flake8-tidy-imports.banned-api] # This section is managed by the plugin template. Do not edit manually. "distutils".msg = "The 'distutils' module has been deprecated since Python 3.9." +"pulpcore.app.settings".msg = "Always import 'settings' from 'django.conf' instead." [tool.ruff.lint.isort] # This section is managed by the plugin template. Do not edit manually.