Skip to content

Commit

Permalink
Refs #32910: Add ability to enable content caching
Browse files Browse the repository at this point in the history
Adds a flag to enable content caching via Redis. This is disabled
by default as its a new optional feature in Pulp 3.14.
  • Loading branch information
ehelms committed Jun 29, 2021
1 parent 137128e commit a6ee974
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All supported versions are listed below. For every supported version, acceptance

Supported operating systems are listed in `metadata.json` but individual releases can divert from that. For example, if Pulpcore x.y drops EL7, it will still be listed in metadata.json until all versions supported by the module have dropped it. Similarly, if x.z adds support for EL9, it'll be listed in `metadata.json` and all versions that don't support EL9 will have a note.

### Pulpcore 3.13
### Pulpcore 3.14

Only supported version.

Expand Down
9 changes: 9 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@
# @param api_client_auth_cn_map
# Mapping of certificate common name and Pulp user to authenticate to Pulp API.
#
# @param pulp_cache_enable
# Enables Redis based content caching within the Pulp content app.
#
# @param pulp_cache_expires_ttl
# The number of seconds that content should be cached for.
#
# @example Default configuration
# include pulpcore
#
Expand Down Expand Up @@ -204,6 +210,9 @@
Integer[0] $content_service_worker_timeout = 90,
Integer[0] $api_service_worker_timeout = 90,
Hash[String[1], String[1]] $api_client_auth_cn_map = {},
Boolean $pulp_cache_enable = false,
Integer[0] $pulp_cache_expires_ttl = 60,
String[1] $pulp_cache_default_base_key = 'PULP_CACHE',
) {
$settings_file = "${config_dir}/settings.py"

Expand Down
2 changes: 2 additions & 0 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
.with_content(%r{ALLOWED_EXPORT_PATHS = \[\]})
.with_content(%r{ALLOWED_IMPORT_PATHS = \["/var/lib/pulp/sync_imports"\]})
.with_content(%r{ALLOWED_CONTENT_CHECKSUMS = \["sha224", "sha256", "sha384", "sha512"\]})
.with_content(%r{PULP_CACHE_ENABLED = False})
.with_content(%r{PULP_CACHE_SETTINGS = \{\n 'EXPIRES_TTL': 60,\n\}})
.without_content(/sslmode/)
is_expected.to contain_file('/etc/pulp')
is_expected.to contain_file('/var/lib/pulp')
Expand Down
5 changes: 5 additions & 0 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ ALLOWED_CONTENT_CHECKSUMS = <%= scope['pulpcore::allowed_content_checksums'] %>

# Derive HTTP/HTTPS via the X-Forwarded-Proto header set by Apache
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

PULP_CACHE_ENABLED = <%= scope['pulpcore::pulp_cache_enable'] ? 'True' : 'False' %>
PULP_CACHE_SETTINGS = {
'EXPIRES_TTL': <%= scope['pulpcore::pulp_cache_expires_ttl'] %>,
}

0 comments on commit a6ee974

Please sign in to comment.