14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [15.0.2](https://github.com/theforeman/puppet-foreman/tree/15.0.2) (2020-08-03)

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

**Implemented enhancements:**

- Add foreman\_statistics plugin [\#855](https://github.com/theforeman/puppet-foreman/pull/855) ([ezr-ondrej](https://github.com/ezr-ondrej))
- add plugin foreman\_column\_view [\#601](https://github.com/theforeman/puppet-foreman/pull/601) ([dgoetz](https://github.com/dgoetz))

**Fixed bugs:**

- Fixes [\#30456](https://projects.theforeman.org/issues/30456) - Fix missing icons on /pub page [\#867](https://github.com/theforeman/puppet-foreman/pull/867) ([adamruzicka](https://github.com/adamruzicka))
- fix: indent for rails\_cache\_store redis type [\#859](https://github.com/theforeman/puppet-foreman/pull/859) ([ministicraft](https://github.com/ministicraft))

## [15.0.1](https://github.com/theforeman/puppet-foreman/tree/15.0.1) (2020-06-15)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/15.0.0...15.0.1)
Expand Down
2 changes: 1 addition & 1 deletion manifests/config/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
Stdlib::Port $server_ssl_port = 443,
Stdlib::HTTPUrl $proxy_backend = 'http://localhost:3000/',
Hash $proxy_params = {'retry' => '0'},
Array[String] $proxy_no_proxy_uris = ['/pulp', '/pulp2', '/streamer', '/pub'],
Array[String] $proxy_no_proxy_uris = ['/pulp', '/pulp2', '/streamer', '/pub', '/icons'],
Boolean $ssl = false,
Optional[Stdlib::Absolutepath] $ssl_ca = undef,
Optional[Stdlib::Absolutepath] $ssl_chain = undef,
Expand Down
15 changes: 15 additions & 0 deletions manifests/plugin/column_view.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @summary Install the column view plugin and optionally manage the configuration file
#
# @param columns
# an hash of columns to add to the configuration
#
class foreman::plugin::column_view (
Hash[String, Hash] $columns = {},
){
# https://projects.theforeman.org/issues/21398
assert_type(Hash[String, Foreman::Column_view_column], $columns)

foreman::plugin { 'column_view':
config => template('foreman/foreman_column_view.yaml.erb'),
}
}
8 changes: 8 additions & 0 deletions manifests/plugin/statistics.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# = Foreman Statistics plugin
#
# This class installs trends and statistics plugin
#
class foreman::plugin::statistics {
foreman::plugin {'statistics':
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-foreman",
"version": "15.0.1",
"version": "15.0.2",
"author": "theforeman",
"summary": "Foreman server configuration",
"license": "GPL-3.0+",
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/foreman_config_apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
'set SSL_CLIENT_VERIFY ""'
])
.with_proxy_pass(
"no_proxy_uris" => ['/pulp', '/pulp2', '/streamer', '/pub'],
"no_proxy_uris" => ['/pulp', '/pulp2', '/streamer', '/pub', '/icons'],
"path" => '/',
"url" => 'http://localhost:3000/',
"params" => { "retry" => '0' },
Expand All @@ -249,7 +249,7 @@
])
.with_ssl_proxyengine(true)
.with_proxy_pass(
"no_proxy_uris" => ['/pulp', '/pulp2', '/streamer', '/pub'],
"no_proxy_uris" => ['/pulp', '/pulp2', '/streamer', '/pub', '/icons'],
"path" => '/',
"url" => 'http://localhost:3000/',
"params" => { "retry" => '0' },
Expand Down
63 changes: 63 additions & 0 deletions spec/classes/plugin/column_view_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
require 'spec_helper'

describe 'foreman::plugin::column_view' do
include_examples 'basic foreman plugin tests', 'column_view'

context 'with columns hash architecture' do
let(:params) do
{
'columns' => {
'architecture' => {
'title' => 'Architecture',
'after' => 'last_report',
'content' => 'facts_hash["architecture"]',
}
}
}
end

it { is_expected.to contain_file('/etc/foreman/plugins/foreman_column_view.yaml').with_content(/.*:title: Architecture.*/) }

it { is_expected.to compile.with_all_deps }
end

context 'with columns hash architecture and console' do
let(:params) do
{
'columns' => {
'architecture' => {
'title' => 'Architecture',
'after' => 'last_report',
'content' => 'facts_hash["architecture"]',
},
'console' => {
'title' => 'Console',
'after' => '0',
'content' => 'link_to(_("Console"), "https://#{host.interfaces.first.name}.domainname", { :class => "btn btn-info" } )',
'conditional' => ':bmc_available?',
'eval_content' => 'true',
'view' => ':hosts_properties',
}
}
}
end

it { is_expected.to contain_file('/etc/foreman/plugins/foreman_column_view.yaml').with_content(/.*:title: Console.*/) }

it { is_expected.to compile.with_all_deps }
end

context 'with columns hash broken' do
let(:params) do
{
'columns' => {
'broken' => {
'title' => 'Broken',
}
}
}
end

it { is_expected.to compile.and_raise_error(%r{broken}) }
end
end
5 changes: 5 additions & 0 deletions spec/classes/plugin/statistics_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'spec_helper'

describe 'foreman::plugin::statistics' do
include_examples 'basic foreman plugin tests', 'statistics'
end
12 changes: 12 additions & 0 deletions templates/foreman_column_view.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%= ERB.new(File.read(File.expand_path("_header.erb",File.dirname(file)))).result(binding) -%>
#
# See tfm-rubygem-foreman_column_view-doc and /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_column_view-0.3.0/README.md for more information
:column_view:
<% if @columns -%>
<% @columns.each do |column, hash| -%>
:<%= column %>:
<% hash.each do |key,value| -%>
:<%= key %>: <%= value %>
<% end -%>
<% end -%>
<% end -%>
14 changes: 7 additions & 7 deletions templates/settings.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@
:rails_cache_store:
:type: <%= scope["foreman::rails_cache_store"]["type"] %>
<% if scope["foreman::rails_cache_store"]["type"] == "redis" -%>
:urls:
:urls:
<% if scope["foreman::rails_cache_store"].key?("urls") -%>
<% scope["foreman::rails_cache_store"]["urls"].each do |url| -%>
- redis://<%= url %>
- redis://<%= url %>
<% end -%>
<% else -%>
- redis://localhost:8479/0
- redis://localhost:8479/0
<% end -%>
:options:
:options:
<% if scope["foreman::rails_cache_store"].key?("options") -%>
<% scope["foreman::rails_cache_store"]["options"].each do |option,value| -%>
:<%= option %>: <%= value %>
:<%= option %>: <%= value %>
<% end -%>
<% else -%>
:compress: true
:namespace: foreman
:compress: true
:namespace: foreman
<% end -%>
<% end -%>
<% if scope.lookupvar("foreman::apache") && !scope.lookupvar("foreman::passenger") -%>
Expand Down
12 changes: 12 additions & 0 deletions types/column_view_column.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type Foreman::Column_view_column = Struct[
{
title => String[1],
after => String[1],
content => String[1],
Optional['conditional'] => String[1],
Optional['eval_content'] => String[1],
Optional['view'] => String[1],
Optional['width'] => String[1],
Optional['custom_method'] => String[1],
}
]