Skip to content

Commit

Permalink
use pulpcore naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
wbclark committed Jan 8, 2020
1 parent 5560a32 commit 1436247
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 55 deletions.
57 changes: 31 additions & 26 deletions manifests/plugin/pulp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#
# $pulpnode_enabled:: enables/disables the pulpnode plugin
#
# $pulp3_enabled:: enables/disables the pulp3 plugin
# $pulpcore_enabled:: enables/disables the pulpcore 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.
# $pulpcore_mirror:: Whether this pulpcore plugin acts as a mirror or another pulp node. A pulpcore mirror is the pulpcore equivalent of a pulpnode.
#
# $pulp3_api_url:: The URL to the Pulp 3 API
# $pulpcore_api_url:: The URL to the Pulp 3 API
#
# $pulp3_content_url:: The URL to the Pulp 3 content
# $pulpcore_content_url:: The URL to the Pulp 3 content
#
# $puppet_content_dir:: directory for puppet content
#
Expand All @@ -37,10 +37,10 @@
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,
Stdlib::HTTPUrl $pulp3_api_url = $::foreman_proxy::plugin::pulp::params::pulp3_api_url,
Stdlib::HTTPUrl $pulp3_content_url = $::foreman_proxy::plugin::pulp::params::pulp3_content_url,
Boolean $pulp3_mirror = $::foreman_proxy::plugin::pulp::params::pulp3_mirror,
Boolean $pulpcore_enabled = $::foreman_proxy::plugin::pulp::params::pulpcore_enabled,
Stdlib::HTTPUrl $pulpcore_api_url = $::foreman_proxy::plugin::pulp::params::pulpcore_api_url,
Stdlib::HTTPUrl $pulpcore_content_url = $::foreman_proxy::plugin::pulp::params::pulpcore_content_url,
Boolean $pulpcore_mirror = $::foreman_proxy::plugin::pulp::params::pulpcore_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,
Expand All @@ -52,22 +52,27 @@
foreman_proxy::plugin {'pulp':
version => $version,
}
-> foreman_proxy::settings_file { 'pulp':
template_path => 'foreman_proxy/plugin/pulp.yml.erb',
group => $group,
enabled => $enabled,
listen_on => $listen_on,
}
-> foreman_proxy::settings_file { 'pulpnode':
template_path => 'foreman_proxy/plugin/pulpnode.yml.erb',
group => $group,
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,
}
-> [
foreman_proxy::settings_file { 'pulp':
template_path => 'foreman_proxy/plugin/pulp.yml.erb',
group => $group,
enabled => $enabled,
listen_on => $listen_on,
},
foreman_proxy::settings_file { 'pulpnode':
template_path => 'foreman_proxy/plugin/pulpnode.yml.erb',
group => $group,
enabled => $pulpnode_enabled,
listen_on => $listen_on,
},
foreman_proxy::settings_file { 'pulpcore':
template_path => 'foreman_proxy/plugin/pulpcore.yml.erb',
group => $group,
enabled => $pulpcore_enabled,
listen_on => $listen_on,
},
foreman_proxy::settings_file { 'pulp3': # file removed in rubygem-smart_proxy_pulp 2.0
ensure => absent,
},
]
}
28 changes: 14 additions & 14 deletions manifests/plugin/pulp/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
class foreman_proxy::plugin::pulp::params {
include ::foreman_proxy::params

$enabled = true
$listen_on = 'https'
$version = undef
$group = undef
$pulpnode_enabled = false
$pulp3_enabled = false
$pulp3_mirror = false
$pulp_url = "https://${::fqdn}/pulp"
$pulp3_api_url = "https://${::fqdn}"
$pulp3_content_url = "${pulp_url}/content"
$pulp_dir = '/var/lib/pulp'
$pulp_content_dir = '/var/lib/pulp/content'
$puppet_content_dir = pick($::puppet_environmentpath, "${::foreman_proxy::params::puppetdir}/environments")
$mongodb_dir = '/var/lib/mongodb'
$enabled = true
$listen_on = 'https'
$version = undef
$group = undef
$pulpnode_enabled = false
$pulpcore_enabled = false
$pulpcore_mirror = false
$pulp_url = "https://${::fqdn}/pulp"
$pulpcore_api_url = "https://${::fqdn}"
$pulpcore_content_url = "${pulp_url}/content"
$pulp_dir = '/var/lib/pulp'
$pulp_content_dir = '/var/lib/pulp/content'
$puppet_content_dir = pick($::puppet_environmentpath, "${::foreman_proxy::params::puppetdir}/environments")
$mongodb_dir = '/var/lib/mongodb'
}
24 changes: 12 additions & 12 deletions spec/classes/foreman_proxy__plugin__pulp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
])
end

it 'should configure pulp3.yml' do
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml")
it 'should configure pulpcore.yml' do
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml")
.with_ensure('file')
.with_owner('root')
.with_group('foreman-proxy')

verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp3.yml", [
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml", [
'---',
':enabled: false',
":pulp_url: https://#{facts[:fqdn]}",
Expand All @@ -66,10 +66,10 @@
{
group: 'example',
pulpnode_enabled: true,
pulp3_enabled: true,
pulp3_mirror: true,
pulp3_api_url: 'https://pulp3.example.com',
pulp3_content_url: 'https://pulp3.example.com/pulp/content',
pulpcore_enabled: true,
pulpcore_mirror: true,
pulpcore_api_url: 'https://pulpcore.example.com',
pulpcore_content_url: 'https://pulpcore.example.com/pulp/content',
pulp_url: 'https://pulp.example.com',
pulp_dir: '/tmp/pulp',
pulp_content_dir: '/tmp/content',
Expand Down Expand Up @@ -114,17 +114,17 @@
])
end

it 'should configure pulp3.yml' do
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml")
it 'should configure pulpcore.yml' do
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml")
.with_ensure('file')
.with_owner('root')
.with_group('example')

verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp3.yml", [
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml", [
'---',
':enabled: https',
':pulp_url: https://pulp3.example.com',
":content_app_url: https://pulp3.example.com/pulp/content",
':pulp_url: https://pulpcore.example.com',
":content_app_url: https://pulpcore.example.com/pulp/content",
':mirror: true'
])
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
:enabled: <%= @module_enabled %>
:pulp_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp3_api_url") %>
:content_app_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp3_content_url") %>
:mirror: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp3_mirror") %>
:pulp_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulpcore_api_url") %>
:content_app_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulpcore_content_url") %>
:mirror: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulpcore_mirror") %>

0 comments on commit 1436247

Please sign in to comment.