Skip to content

Commit

Permalink
Fixes #25787 - Make login and taxonomy settings optional
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrisker authored and mmoll committed Jan 13, 2019
1 parent 6ac2958 commit f404fb1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ previous stable release.
### Foreman version compatibility notes

For Foreman 1.16 or older, please use the 9.x release series of this module.
The parameters `locations_enabled`, `organizations_enabled` and `authentication`
will only have any affect on Foreman 1.20 or older, in newer versions these
settings have been removed.

## Types and providers

Expand Down
18 changes: 9 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#
# $email_smtp_password:: Password for SMTP server auth, if authentication is enabled
#
# $locations_enabled:: Enable locations?
#
# $organizations_enabled:: Enable organizations?
#
# $initial_organization:: Name of an initial organization
#
# $initial_location:: Name of an initial location
Expand All @@ -50,8 +46,12 @@
#
# $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.
# $locations_enabled:: Enable locations? (Unused since 1.21)
#
# $organizations_enabled:: Enable organizations? (Unused since 1.21)
#
# $authentication:: Enable user authentication. (Unused since 1.21)
# Initial credentials are set using initial_admin_username and initial_admin_password.
#
# $passenger:: Configure foreman via apache and passenger
#
Expand Down Expand Up @@ -216,7 +216,7 @@
Boolean $puppetrun = $::foreman::params::puppetrun,
Boolean $unattended = $::foreman::params::unattended,
Optional[Stdlib::HTTPUrl] $unattended_url = $::foreman::params::unattended_url,
Boolean $authentication = $::foreman::params::authentication,
Optional[Boolean] $authentication = $::foreman::params::authentication,
Boolean $passenger = $::foreman::params::passenger,
Optional[String] $passenger_ruby = $::foreman::params::passenger_ruby,
Optional[String] $passenger_ruby_package = $::foreman::params::passenger_ruby_package,
Expand Down Expand Up @@ -250,8 +250,8 @@
String $group = $::foreman::params::group,
Array[String] $user_groups = $::foreman::params::user_groups,
String $rails_env = $::foreman::params::rails_env,
Boolean $locations_enabled = $::foreman::params::locations_enabled,
Boolean $organizations_enabled = $::foreman::params::organizations_enabled,
Optional[Boolean] $locations_enabled = $::foreman::params::locations_enabled,
Optional[Boolean] $organizations_enabled = $::foreman::params::organizations_enabled,
Optional[String] $passenger_interface = $::foreman::params::passenger_interface,
String $vhost_priority = $::foreman::params::vhost_priority,
Stdlib::Port $server_port = $::foreman::params::server_port,
Expand Down
10 changes: 5 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# should foreman manage host provisioning as well
$unattended = true
$unattended_url = undef
# Enable users authentication (default user:admin pw:changeme)
$authentication = true
# Enable users authentication (default user:admin pw:changeme) (Unused since 1.21)
$authentication = undef
# configure foreman via apache and passenger
$passenger = true
# Enclose apache configuration in <VirtualHost>...</VirtualHost>
Expand All @@ -27,9 +27,9 @@
$passenger_prestart = true
$passenger_min_instances = 1
$passenger_start_timeout = 90
# Choose whether you want to enable locations and organizations.
$locations_enabled = false
$organizations_enabled = false
# Choose whether you want to enable locations and organizations. (Unused since 1.21)
$locations_enabled = undef
$organizations_enabled = undef

# Additional software repos
$configure_epel_repo = ($::osfamily == 'RedHat' and $::operatingsystem != 'Fedora')
Expand Down
3 changes: 0 additions & 3 deletions spec/classes/foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@
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$/)
.with_content(/^:organizations_enabled:\s*false$/)
.with_content(/^:puppetrun:\s*false$/)
.with_content(/^:oauth_active:\s*true$/)
.with_content(/^:oauth_map_users:\s*false$/)
Expand Down
6 changes: 6 additions & 0 deletions templates/settings.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("foreman::unattended_url")) -%>
:unattended_url: <%= scope.lookupvar("foreman::unattended_url") %>
<% end -%>
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("foreman::authentication")) -%>
:login: <%= scope.lookupvar("foreman::authentication") %>
<% end -%>
:require_ssl: <%= scope.lookupvar("foreman::ssl") %>
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("foreman::locations_enabled")) -%>
:locations_enabled: <%= scope.lookupvar("foreman::locations_enabled") %>
<% end -%>
<% unless [nil, :undefined, :undef].include?(scope.lookupvar("foreman::organizations_enabled")) -%>
:organizations_enabled: <%= scope.lookupvar("foreman::organizations_enabled") %>
<% end -%>
:puppetrun: <%= scope.lookupvar("foreman::puppetrun") %>

# The following values are used for providing default settings during db migrate
Expand Down

0 comments on commit f404fb1

Please sign in to comment.