From 5d482cba80c8ed4a6c914f701949c9f1f7177e3e Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 13 Jul 2021 14:00:17 +0200 Subject: [PATCH] Use REDIS_URL as a configuration option This is shorter in the config, but it also prepares for a connection using a different mechanism. For example, a remote Redis or using a unix socket. --- spec/classes/pulpcore_spec.rb | 1 + templates/settings.py.erb | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/classes/pulpcore_spec.rb b/spec/classes/pulpcore_spec.rb index 3ae332f6..fe5f64b6 100644 --- a/spec/classes/pulpcore_spec.rb +++ b/spec/classes/pulpcore_spec.rb @@ -24,6 +24,7 @@ .with_content(%r{ALLOWED_IMPORT_PATHS = \["/var/lib/pulp/sync_imports"\]}) .with_content(%r{ALLOWED_CONTENT_CHECKSUMS = \["sha224", "sha256", "sha384", "sha512"\]}) .with_content(%r{\s'level': 'INFO',}) + .with_content(%r{REDIS_URL = "redis://localhost:6379/8"}) .with_content(%r{CACHE_ENABLED = False}) .without_content(%r{sslmode}) is_expected.to contain_file('/etc/pulp') diff --git a/templates/settings.py.erb b/templates/settings.py.erb index 8b814849..db79d87e 100644 --- a/templates/settings.py.erb +++ b/templates/settings.py.erb @@ -19,9 +19,7 @@ DATABASES = { <% end -%> }, } -REDIS_HOST = "localhost" -REDIS_PORT = "<%= scope['redis::port'] %>" -REDIS_DB = <%= scope['pulpcore::redis_db'] %> +REDIS_URL = "redis://localhost:<%= scope['redis::port'] %>/<%= scope['pulpcore::redis_db'] %>" USE_NEW_WORKER_TYPE = <%= scope['pulpcore::use_rq_tasking_system'] ? "False" : "True" %>