Showing with 28 additions and 9 deletions.
  1. +10 −0 CHANGELOG.md
  2. +2 −2 README.md
  3. +9 −1 manifests/config.pp
  4. +1 −1 manifests/init.pp
  5. +2 −2 metadata.json
  6. +3 −2 spec/classes/foreman_spec.rb
  7. +1 −1 templates/settings.yaml.erb
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [23.1.0](https://github.com/theforeman/puppet-foreman/tree/23.1.0) (2023-08-16)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/23.0.0...23.1.0)

**Implemented enhancements:**

- Fixes [\#36582](https://projects.theforeman.org/issues/36582) - Detect logging layout based on type [\#1124](https://github.com/theforeman/puppet-foreman/pull/1124) ([ekohl](https://github.com/ekohl))
- Fixes [\#36645](https://projects.theforeman.org/issues/36645) - Change the default Redis cache DB to 4 [\#1122](https://github.com/theforeman/puppet-foreman/pull/1122) ([ekohl](https://github.com/ekohl))
- allow puppet/redis 9.x [\#1121](https://github.com/theforeman/puppet-foreman/pull/1121) ([evgeni](https://github.com/evgeni))

## [23.0.0](https://github.com/theforeman/puppet-foreman/tree/23.0.0) (2023-05-16)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/22.2.0...23.0.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module using the parameter `rails_cache_store`. The parameter takes a hash
containing the type and options specfic to the backend.

The default is the file backend, configured via `{'type' => 'file'}`. To
setup for redis use a hash similar to `{'type' => 'redis', 'urls' => ['localhost:8479/0'], 'options' => {'compress' => 'true', 'namespace' => 'foreman'}}`
setup for redis use a hash similar to `{'type' => 'redis', 'urls' => ['localhost:8479/4'], 'options' => {'compress' => 'true', 'namespace' => 'foreman'}}`
where `urls` takes an array of redis urls which get prepended with `redis://`
and `options` using a hash with options from [rails](https://guides.rubyonrails.org/caching_with_rails.html#activesupport-cache-store)
falling back to `{'compress' => 'true', 'namespace' => 'foreman'}` if no
Expand All @@ -53,7 +53,7 @@ could look like this:
class { 'foreman':
rails_cache_store => {
'type' => 'redis',
'urls' => ['localhost:8479/0'],
'urls' => ['localhost:8479/4'],
'options' => {
'compress' => 'true',
'namespace' => 'foreman'
Expand Down
10 changes: 9 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$redis_cache_urls = prefix($foreman::rails_cache_store['urls'], 'redis://')
} else {
include redis
$redis_cache_urls = ["redis://localhost:${redis::port}/0"]
$redis_cache_urls = ["redis://localhost:${redis::port}/4"]
}
} else {
$redis_cache_urls = undef
Expand All @@ -35,6 +35,14 @@
$websockets_ssl_cert = pick($foreman::websockets_ssl_cert, $foreman::server_ssl_cert)
$websockets_ssl_key = pick($foreman::websockets_ssl_key, $foreman::server_ssl_key)

if $foreman::logging_layout {
$logging_layout = $foreman::logging_layout
} elsif $foreman::logging_type == 'journald' {
$logging_layout = 'pattern'
} else {
$logging_layout = 'multiline_request_pattern'
}

foreman::settings_fragment { 'header.yaml':
content => template('foreman/settings.yaml.erb'),
order => '01',
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
Optional[Stdlib::Absolutepath] $websockets_ssl_cert = undef,
Enum['debug', 'info', 'warn', 'error', 'fatal'] $logging_level = 'info',
Enum['file', 'syslog', 'journald'] $logging_type = 'file',
Enum['pattern', 'multiline_pattern', 'multiline_request_pattern', 'json'] $logging_layout = 'multiline_request_pattern',
Optional[Enum['pattern', 'multiline_pattern', 'multiline_request_pattern', 'json']] $logging_layout = undef,
Hash[String, Boolean] $loggers = {},
Optional[Enum['sendmail', 'smtp']] $email_delivery_method = undef,
Optional[Stdlib::Absolutepath] $email_sendmail_location = undef,
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-foreman",
"version": "23.0.0",
"version": "23.1.0",
"author": "theforeman",
"summary": "Foreman server configuration",
"license": "GPL-3.0+",
Expand Down Expand Up @@ -42,7 +42,7 @@
},
{
"name": "puppet/redis",
"version_requirement": ">= 5.0.0 < 9.0.0"
"version_requirement": ">= 5.0.0 < 10.0.0"
}
],
"requirements": [
Expand Down
5 changes: 3 additions & 2 deletions spec/classes/foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
.with_content(%r{^:ssl_ca_file:\s*/etc/puppetlabs/puppet/ssl/certs/ca.pem$})
.with_content(%r{^:ssl_priv_key:\s*/etc/puppetlabs/puppet/ssl/private_keys/foo\.example\.com\.pem$})
.with_content(/^:logging:\n\s*:level:\s*info$/)
.with_content(/^\s+:layout:\s+multiline_request_pattern$/)
.with_content(/^:hsts_enabled:\s*true$/)

should contain_concat('/etc/foreman/settings.yaml')
Expand Down Expand Up @@ -278,7 +279,7 @@
' :level: info',
' :production:',
' :type: journald',
' :layout: multiline_request_pattern'
' :layout: pattern'
])
end
end
Expand Down Expand Up @@ -334,7 +335,7 @@
let(:params) { super().merge(rails_cache_store: { type: "redis" }) }
it 'should set rails_cache_store config' do
should contain_concat__fragment('foreman_settings+01-header.yaml')
.with_content(%r{^:rails_cache_store:\n\s+:type:\s*redis\n\s+:urls:\n\s*- redis://localhost:6379/0\n\s+:options:\n\s+:compress:\s*true\n\s+:namespace:\s*foreman$})
.with_content(%r{^:rails_cache_store:\n\s+:type:\s*redis\n\s+:urls:\n\s*- redis://localhost:6379/4\n\s+:options:\n\s+:compress:\s*true\n\s+:namespace:\s*foreman$})
end
it { is_expected.to contain_package('foreman-redis') }

Expand Down
2 changes: 1 addition & 1 deletion templates/settings.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
:level: <%= scope.lookupvar("foreman::logging_level") %>
:production:
:type: <%= scope.lookupvar("foreman::logging_type") %>
:layout: <%= scope.lookupvar("foreman::logging_layout") %>
:layout: <%= @logging_layout %>
<% unless scope.lookupvar('foreman::cors_domains').empty? -%>
# List of domains allowed for Cross-Origin Resource Sharing
Expand Down