Skip to content

Commit

Permalink
Construct foreman_url from servername and drop parameter
Browse files Browse the repository at this point in the history
Drops the foreman_url parameter and constructs it from the servername
given to Apache. The foreman_url and servername should match
and this gives one less parameter that needs to be configured to get
a correct installation.
  • Loading branch information
ehelms committed Feb 21, 2023
1 parent f32405c commit 96a446e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
5 changes: 2 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
#
# === Advanced parameters:
#
# $foreman_url:: URL on which foreman is going to run
#
# $unattended:: Should Foreman manage host provisioning as well
#
# $unattended_url:: URL hosts will retrieve templates from during build (normally http as many installers don't support https)
Expand Down Expand Up @@ -203,7 +201,6 @@
# $keycloak_realm:: The realm as passed to keycloak-httpd-client-install
#
class foreman (
Stdlib::HTTPUrl $foreman_url = $foreman::params::foreman_url,
Boolean $unattended = true,
Optional[Stdlib::HTTPUrl] $unattended_url = undef,
Boolean $apache = true,
Expand Down Expand Up @@ -303,6 +300,8 @@
$db_sslmode_real = $db_sslmode
}

$foreman_url = "https://${servername}"

include foreman::install
include foreman::config
include foreman::database
Expand Down
2 changes: 0 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
class foreman::params inherits foreman::globals {
$lower_fqdn = downcase($facts['networking']['fqdn'])

# Basic configurations
$foreman_url = "https://${lower_fqdn}"
# Server name of the VirtualHost
$servername = $facts['networking']['fqdn']

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/foreman_cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
class { 'foreman':
initial_admin_username => 'jane',
initial_admin_password => 'supersecret',
foreman_url => 'https://foreman.example.com',
servername => 'foreman.example.com',
server_ssl_chain => '/etc/puppetlabs/puppet/ssl/certs/ca.pub',
}
PUPPET
Expand Down
1 change: 0 additions & 1 deletion spec/classes/foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@
describe 'with all parameters' do
let :params do
{
foreman_url: 'http://localhost',
unattended: true,
servername: 'localhost',
serveraliases: ['foreman'],
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/plugin/remote_execution_cockpit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:pre_condition) do
<<-PUPPET
class {'foreman':
foreman_url => 'https://foreman.example.com',
servername => 'foreman.example.com',
server_ssl_chain => '/path/to/ca.pem',
client_ssl_cert => '/path/to/cert.pem',
client_ssl_key => '/path/to/key.pem',
Expand Down

0 comments on commit 96a446e

Please sign in to comment.