Skip to content

Commit

Permalink
Fixes #30436 - add allowed_export_paths to settings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz committed Nov 12, 2020
1 parent 233347f commit 73351dc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
8 changes: 6 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@
# Django remote user environment variable
#
# @param allowed_import_path
# Allowed paths that pulp can sync from using file:// protocol
# Allowed paths that pulp can use for content view imports, or sync from using file:// protocol
#
# @param allowed_export_path
# Allowed paths that pulp can use for content view exports
#
# @param worker_count
# Number of pulpcore workers. Defaults to 8 or the number of CPU cores, whichever is smaller. Enabling more than 8 workers, even with additional CPU cores
Expand Down Expand Up @@ -174,7 +177,8 @@
String $django_secret_key = extlib::cache_data('pulpcore_cache_data', 'secret_key', extlib::random_password(32)),
Integer[0] $redis_db = 8,
Stdlib::Fqdn $servername = $facts['networking']['fqdn'],
Array[Stdlib::Absolutepath] $allowed_import_path = ['/var/lib/pulp/sync_imports'],
Array[Stdlib::Absolutepath] $allowed_import_path = ['/var/lib/pulp/sync_imports', '/var/lib/pulp/imports'],
Array[Stdlib::Absolutepath] $allowed_export_path = ['/var/lib/pulp/exports'],
String[1] $remote_user_environ_name = 'HTTP_REMOTE_USER',
Integer[0] $worker_count = min(8, $facts['processors']['count']),
Boolean $service_enable = true,
Expand Down
26 changes: 25 additions & 1 deletion spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,31 @@
it do
is_expected.to compile.with_all_deps
is_expected.to contain_concat__fragment('base')
.with_content(%r{ALLOWED_IMPORT_PATHS = \["/var/lib/pulp/sync_imports"\]})
.with_content(%r{ALLOWED_IMPORT_PATHS = \["/var/lib/pulp/sync_imports", "/var/lib/pulp/imports"\]})

end
end

context 'with allowed export paths' do
let :params do
{
allowed_export_path: ['/test/path', '/test/path2'],
}
end

it do
is_expected.to compile.with_all_deps
is_expected.to contain_concat__fragment('base')
.with_content(%r{ALLOWED_EXPORT_PATHS = \["/test/path", "/test/path2"\]})

end
end

context 'with empty allowed export paths' do
it do
is_expected.to compile.with_all_deps
is_expected.to contain_concat__fragment('base')
.with_content(%r{ALLOWED_EXPORT_PATHS = \["/var/lib/pulp/exports"\]})

end
end
Expand Down
5 changes: 4 additions & 1 deletion templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES = (
'pulpcore.app.authentication.PulpRemoteUserAuthentication'
)

<%# This setting whitelists paths that can be used for repository sync with file protocol. Katello uses the path /var/lib/pulp/sync_imports/ to run tests -%>
<%# These settings specify paths that can be used for repository sync with file protocol, -%>
<%# and for content view version import/export. -%>
<%# Katello uses the path /var/lib/pulp/sync_imports/ to run tests -%>
ALLOWED_IMPORT_PATHS = <%= scope['pulpcore::allowed_import_path'] %>
ALLOWED_EXPORT_PATHS = <%= scope['pulpcore::allowed_export_path'] %>

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

0 comments on commit 73351dc

Please sign in to comment.