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

Add unattended_url parameter #606

Merged
merged 1 commit into from
Nov 24, 2017
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 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