Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs #35005 - use foreman client certs for pulp-cli auth #420

Merged
merged 3 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ spec/spec_helper.rb:
- name: root_home
value: /root
source: puppetlabs-stdlib
- name: service_provider
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was my intention to move to add_mocked_facts! (from voxpupuli-test) but haven't gotten around to it. We should implement this in our modulesynced spec_helper.rb. It would make all these custom facts redundant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but this would be out of scope for this PR IMHO.

value: systemd
source: puppetlabs-stdlib
spec/spec_helper_acceptance.rb:
locale_workaround: true
7 changes: 4 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,13 @@
}

if $shared_with_foreman_vhost {
include certs::pulp_client
include certs::foreman
class { 'pulpcore::cli':
pulpcore_url => "https://${servername}",
dry_run => true,
cert => $certs::pulp_client::client_cert,
key => $certs::pulp_client::client_key,
cert => $certs::foreman::client_cert,
key => $certs::foreman::client_key,
require => Class['certs::foreman'],
}
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/reverse_proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
apache::vhost { $vhost_name:
ensure => $ensure,
servername => $certs::apache::hostname,
aliases => $certs::apache::cname,
serveraliases => $certs::apache::cname,
evgeni marked this conversation as resolved.
Show resolved Hide resolved
port => $port,
docroot => '/var/www/',
priority => $priority,
Expand Down
8 changes: 8 additions & 0 deletions spec/acceptance/content_with_foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<~PUPPET
group { 'foreman':
ensure => present,
}

file { '/etc/foreman':
ensure => directory
}

include certs::foreman_proxy

class { 'foreman_proxy':
Expand Down
6 changes: 3 additions & 3 deletions spec/defines/foreman_proxy_content__reverse_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
it do
is_expected.to contain_apache__vhost('my-reverse-proxy')
.with_servername(facts[:fqdn])
.with_aliases([])
.with_serveraliases([])
.with_port(8443)
.with_proxy_pass([{
'path' => '/',
Expand All @@ -37,7 +37,7 @@
it do
is_expected.to contain_apache__vhost('katello-reverse-proxy-443')
.with_servername('foo.example.com')
.with_aliases([])
.with_serveraliases([])
.with_port(443)
.without_keepalive # Not part of the vhost but used in the vhost_params
.with_proxy_pass([{
Expand Down Expand Up @@ -65,7 +65,7 @@ class { 'certs::apache':
it do
is_expected.to contain_apache__vhost('katello-reverse-proxy')
.with_servername('proxy.example.com')
.with_aliases(['proxy-01.example.com'])
.with_serveraliases(['proxy-01.example.com'])
end
end

Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

add_custom_fact :systemd, true # puppet-systemd
add_custom_fact :root_home, "/root" # puppetlabs-stdlib
add_custom_fact :service_provider, "systemd" # puppetlabs-stdlib

def get_content(subject, title)
is_expected.to contain_file(title)
Expand Down