Revision 6a315685
Added by Ewoud Kohl van Wijngaarden about 5 years ago
manifests/plugin/pulp.pp | ||
---|---|---|
#
|
||
# $pulpnode_enabled:: enables/disables the pulpnode plugin
|
||
#
|
||
# $pulp3_enabled:: enables/disables the pulp3 plugin
|
||
#
|
||
# $pulp3_mirror:: Whether this pulp3 plugin acts as a mirror or another pulp node. A pulp3 mirror is the pulp3 equivalent of a pulpnode.
|
||
#
|
||
# $puppet_content_dir:: directory for puppet content
|
||
#
|
||
# $mongodb_dir:: directory for Mongo DB
|
||
... | ... | |
Boolean $enabled = $::foreman_proxy::plugin::pulp::params::enabled,
|
||
Foreman_proxy::ListenOn $listen_on = $::foreman_proxy::plugin::pulp::params::listen_on,
|
||
Boolean $pulpnode_enabled = $::foreman_proxy::plugin::pulp::params::pulpnode_enabled,
|
||
Boolean $pulp3_enabled = $::foreman_proxy::plugin::pulp::params::pulp3_enabled,
|
||
Boolean $pulp3_mirror = $::foreman_proxy::plugin::pulp::params::pulp3_mirror,
|
||
Optional[String] $version = $::foreman_proxy::plugin::pulp::params::version,
|
||
Optional[String] $group = $::foreman_proxy::plugin::pulp::params::group,
|
||
Stdlib::HTTPUrl $pulp_url = $::foreman_proxy::plugin::pulp::params::pulp_url,
|
||
... | ... | |
enabled => $pulpnode_enabled,
|
||
listen_on => $listen_on,
|
||
}
|
||
-> foreman_proxy::settings_file { 'pulp3':
|
||
template_path => 'foreman_proxy/plugin/pulp3.yml.erb',
|
||
group => $group,
|
||
enabled => $pulp3_enabled,
|
||
listen_on => $listen_on,
|
||
}
|
||
}
|
manifests/plugin/pulp/params.pp | ||
---|---|---|
$version = undef
|
||
$group = undef
|
||
$pulpnode_enabled = false
|
||
$pulp3_enabled = false
|
||
$pulp3_mirror = false
|
||
$pulp_url = "https://${::fqdn}/pulp"
|
||
$pulp_dir = '/var/lib/pulp'
|
||
$pulp_content_dir = '/var/lib/pulp/content'
|
spec/classes/foreman_proxy__plugin__pulp_spec.rb | ||
---|---|---|
end
|
||
|
||
let :pre_condition do
|
||
"include foreman_proxy"
|
||
'include foreman_proxy'
|
||
end
|
||
|
||
let :etc_dir do
|
||
... | ... | |
.with_ensure('file')
|
||
.with_owner('root')
|
||
.with_group('foreman-proxy')
|
||
end
|
||
|
||
it 'should generate correct pulp.yml' do
|
||
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp.yml", [
|
||
'---',
|
||
':enabled: https',
|
||
":pulp_url: https://#{facts[:fqdn]}/pulp",
|
||
':pulp_dir: /var/lib/pulp',
|
||
':pulp_content_dir: /var/lib/pulp/content',
|
||
':puppet_content_dir: /etc/puppetlabs/code/environments',
|
||
':mongodb_dir: /var/lib/mongodb',
|
||
])
|
||
'---',
|
||
':enabled: https',
|
||
":pulp_url: https://#{facts[:fqdn]}/pulp",
|
||
':pulp_dir: /var/lib/pulp',
|
||
':pulp_content_dir: /var/lib/pulp/content',
|
||
':puppet_content_dir: /etc/puppetlabs/code/environments',
|
||
':mongodb_dir: /var/lib/mongodb'
|
||
])
|
||
end
|
||
|
||
it 'should configure pulpnode.yml' do
|
||
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpnode.yml")
|
||
.with_ensure('file')
|
||
.with_owner('root')
|
||
.with_group('foreman-proxy')
|
||
|
||
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpnode.yml", [
|
||
'---',
|
||
':enabled: false',
|
||
":pulp_url: https://#{facts[:fqdn]}/pulp",
|
||
':pulp_dir: /var/lib/pulp',
|
||
':pulp_content_dir: /var/lib/pulp/content',
|
||
':puppet_content_dir: /etc/puppetlabs/code/environments',
|
||
':mongodb_dir: /var/lib/mongodb'
|
||
])
|
||
end
|
||
|
||
it 'should configure pulp3.yml' do
|
||
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml")
|
||
.with_ensure('file')
|
||
.with_owner('root')
|
||
.with_group('foreman-proxy')
|
||
|
||
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp3.yml", [
|
||
'---',
|
||
':enabled: false',
|
||
":pulp_url: https://#{facts[:fqdn]}/pulp",
|
||
':pulp_dir: /var/lib/pulp',
|
||
':pulp_content_dir: /var/lib/pulp/content',
|
||
':puppet_content_dir: /etc/puppetlabs/code/environments',
|
||
':mirror: false'
|
||
])
|
||
end
|
||
end
|
||
|
||
describe 'with overrides' do
|
||
let :params do {
|
||
:group => 'example',
|
||
:puppet_content_dir => '/tmp/foo',
|
||
} end
|
||
let :params do
|
||
{
|
||
group: 'example',
|
||
pulpnode_enabled: true,
|
||
pulp3_enabled: true,
|
||
pulp3_mirror: true,
|
||
pulp_url: 'https://pulp.example.com',
|
||
pulp_dir: '/tmp/pulp',
|
||
pulp_content_dir: '/tmp/content',
|
||
puppet_content_dir: '/tmp/puppet',
|
||
mongodb_dir: '/tmp/mongodb',
|
||
}
|
||
end
|
||
|
||
it { is_expected.to compile.with_all_deps }
|
||
it { is_expected.to contain_foreman_proxy__plugin('pulp') }
|
||
|
||
it 'should change pulp.yml group' do
|
||
it 'should configure pulp.yml' do
|
||
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp.yml")
|
||
.with_owner('root')
|
||
.with_group('example')
|
||
end
|
||
|
||
it 'should generate correct pulp.yml' do
|
||
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp.yml", [
|
||
'---',
|
||
':enabled: https',
|
||
":pulp_url: https://#{facts[:fqdn]}/pulp",
|
||
':pulp_dir: /var/lib/pulp',
|
||
':pulp_content_dir: /var/lib/pulp/content',
|
||
':puppet_content_dir: /tmp/foo',
|
||
':mongodb_dir: /var/lib/mongodb',
|
||
])
|
||
'---',
|
||
':enabled: https',
|
||
':pulp_url: https://pulp.example.com',
|
||
':pulp_dir: /tmp/pulp',
|
||
':pulp_content_dir: /tmp/content',
|
||
':puppet_content_dir: /tmp/puppet',
|
||
':mongodb_dir: /tmp/mongodb'
|
||
])
|
||
end
|
||
|
||
it 'should configure pulpnode.yml' do
|
||
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpnode.yml")
|
||
.with_ensure('file')
|
||
.with_owner('root')
|
||
.with_group('example')
|
||
|
||
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpnode.yml", [
|
||
'---',
|
||
':enabled: https',
|
||
':pulp_url: https://pulp.example.com',
|
||
':pulp_dir: /tmp/pulp',
|
||
':pulp_content_dir: /tmp/content',
|
||
':puppet_content_dir: /tmp/puppet',
|
||
':mongodb_dir: /tmp/mongodb'
|
||
])
|
||
end
|
||
|
||
it 'should configure pulp3.yml' do
|
||
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml")
|
||
.with_ensure('file')
|
||
.with_owner('root')
|
||
.with_group('example')
|
||
|
||
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp3.yml", [
|
||
'---',
|
||
':enabled: https',
|
||
':pulp_url: https://pulp.example.com',
|
||
':pulp_dir: /tmp/pulp',
|
||
':pulp_content_dir: /tmp/content',
|
||
':puppet_content_dir: /tmp/puppet',
|
||
':mirror: true'
|
||
])
|
||
end
|
||
end
|
||
end
|
templates/plugin/pulp3.yml.erb | ||
---|---|---|
---
|
||
# Pulp integration
|
||
:enabled: <%= @module_enabled %>
|
||
:pulp_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_url") %>
|
||
:pulp_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_dir") %>
|
||
:pulp_content_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_content_dir") %>
|
||
:puppet_content_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::puppet_content_dir") %>
|
||
:mirror: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp3_mirror") %>
|
Also available in: Unified diff
Add pulp3 options to the pulp plugin
Since smart_proxy_pulp 1.4.0 pulp3.yml is created.