Skip to content

Commit

Permalink
Add unattended_url parameter
Browse files Browse the repository at this point in the history
Enables setting of unattended_url during install with foreman-installer
  • Loading branch information
matonb authored and mmoll committed Nov 24, 2017
1 parent 25897ca commit 157567d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#
# $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)
#
# $authentication:: Enable user authentication. Initial credentials are set using admin_username
# and admin_password.
#
Expand Down Expand Up @@ -205,6 +207,7 @@
Stdlib::HTTPUrl $foreman_url = $::foreman::params::foreman_url,
Boolean $puppetrun = $::foreman::params::puppetrun,
Boolean $unattended = $::foreman::params::unattended,
Optional[Stdlib::HTTPUrl] $unattended_url = $::foreman::params::unattended_url,
Boolean $authentication = $::foreman::params::authentication,
Boolean $passenger = $::foreman::params::passenger,
Optional[String] $passenger_ruby = $::foreman::params::passenger_ruby,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$receive_facts = true
# should foreman manage host provisioning as well
$unattended = true
$unattended_url = undef
# Enable users authentication (default user:admin pw:changeme)
$authentication = true
# configure foreman via apache and passenger
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/foreman_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
it 'should set up the config' do
should contain_concat__fragment('foreman_settings+01-header.yaml').
with_content(/^:unattended:\s*true$/).
without_content(/^:unattended_url:/).
with_content(/^:login:\s*true$/).
with_content(/^:require_ssl:\s*true$/).
with_content(/^:locations_enabled:\s*false$/).
Expand Down Expand Up @@ -161,6 +162,17 @@ class {'foreman':
end
end

describe 'with unattended_url' do
let :pre_condition do
"class {'foreman':
unattended_url => 'http://example.com',
}"
end

it { should contain_concat__fragment('foreman_settings+01-header.yaml').
with_content(%r{^:unattended_url:\s*http://example.com$}) }
end

describe 'with url ending with trailing slash' do
let :pre_condition do
"class {'foreman':
Expand Down
3 changes: 3 additions & 0 deletions templates/settings.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<%= @header %>

:unattended: <%= scope.lookupvar("foreman::unattended") %>
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("foreman::unattended_url")) -%>
:unattended_url: <%= scope.lookupvar("foreman::unattended_url") %>
<% end -%>
:login: <%= scope.lookupvar("foreman::authentication") %>
:require_ssl: <%= scope.lookupvar("foreman::ssl") %>
:locations_enabled: <%= scope.lookupvar("foreman::locations_enabled") %>
Expand Down

0 comments on commit 157567d

Please sign in to comment.