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

Set release compatibility to 1.17+ #661

Merged
merged 5 commits into from
Aug 15, 2018
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: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ previous stable release.

### Foreman version compatibility notes

For Foreman 1.16 or older, please set the `dynflow_in_core` parameter to false.
For Foreman 1.13 or older, please use the 5.x release series of this module.
For Foreman 1.16 or older, please use the 9.x release series of this module.

## Types and providers

Expand Down
5 changes: 1 addition & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@
#
# $jobs_service:: Name of the service for running the background Dynflow executor
#
# $dynflow_in_core:: Whether the Dynflow executor service is provided by Foreman or tasks
#
# $hsts_enabled:: Should HSTS enforcement in https requests be enabled
#
class foreman (
Expand Down Expand Up @@ -322,8 +320,7 @@
Boolean $telemetry_logger_enabled = $::foreman::params::telemetry_logger_enabled,
Enum['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'] $telemetry_logger_level = $::foreman::params::telemetry_logger_level,
Integer[0, 65535] $dynflow_pool_size = $::foreman::params::dynflow_pool_size,
Optional[String] $jobs_service = $::foreman::params::jobs_service,
Boolean $dynflow_in_core = $::foreman::params::dynflow_in_core,
String $jobs_service = $::foreman::params::jobs_service,
Boolean $hsts_enabled = $::foreman::params::hsts_enabled,
) inherits foreman::params {
if $db_adapter == 'UNSET' {
Expand Down
13 changes: 5 additions & 8 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class foreman::params {
$lower_fqdn = downcase($::fqdn)

# Basic configurations
# Basic configurations
$foreman_url = "https://${lower_fqdn}"
$foreman_user = undef
$foreman_password = undef
Expand Down Expand Up @@ -43,14 +43,13 @@
# Only configure extra SCL repos on EL
$configure_scl_repo = ($::osfamily == 'RedHat' and $::operatingsystem != 'Fedora')

# Advanced configuration - no need to change anything here by default
# if set to true, no repo will be added by this module, letting you
# Advanced configuration - no need to change anything here by default
# if set to true, no repo will be added by this module, letting you
# set it to some custom location.
$custom_repo = false
# this can be stable, or nightly
$repo = 'stable'
$railspath = '/usr/share'
$app_root = "${railspath}/foreman"
$app_root = '/usr/share/foreman'
$plugin_config_dir = '/etc/foreman/plugins'
$manage_user = true
$user = 'foreman'
Expand Down Expand Up @@ -101,11 +100,9 @@

# Configure how many workers should Dynflow use
$dynflow_pool_size = 5
# Defines whether Foreman or the tasks plugin provides the Dynflow executor
$dynflow_in_core = true

# Define job processing service properties
$jobs_service = undef
$jobs_service = 'dynflowd'
$jobs_service_ensure = 'running'
$jobs_service_enable = true

Expand Down
1 change: 0 additions & 1 deletion manifests/plugin/ansible.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
include ::foreman::plugin::tasks

foreman::plugin {'ansible':
notify => Class['foreman::service::jobs'],
}
}
1 change: 0 additions & 1 deletion manifests/plugin/remote_execution.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
include ::foreman::plugin::tasks

foreman::plugin {'remote_execution':
notify => Class['foreman::service::jobs'],
}
}
3 changes: 0 additions & 3 deletions manifests/plugin/tasks.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
Boolean $automatic_cleanup = $::foreman::plugin::tasks::params::automatic_cleanup,
String $cron_line = $::foreman::plugin::tasks::params::cron_line,
) inherits foreman::plugin::tasks::params {
include ::foreman::service::jobs

foreman::plugin { 'tasks':
package => $package,
notify => Class['foreman::service::jobs'],
}
$cron_state = $automatic_cleanup ? {
true => 'present',
Expand Down
15 changes: 9 additions & 6 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Configure the foreman service
class foreman::service(
$passenger = $::foreman::passenger,
$app_root = $::foreman::app_root,
$ssl = $::foreman::ssl,
$dynflow_in_core = $::foreman::dynflow_in_core,
Boolean $passenger = $::foreman::passenger,
Stdlib::Absolutepath $app_root = $::foreman::app_root,
Boolean $ssl = $::foreman::ssl,
String $jobs_service = $::foreman::jobs_service,
Enum['running', 'stopped'] $jobs_service_ensure = $::foreman::jobs_service_ensure,
Boolean $jobs_service_enable = $::foreman::jobs_service_enable,
) {
anchor { ['foreman::service_begin', 'foreman::service_end']: }

if $dynflow_in_core {
contain ::foreman::service::jobs
service { $jobs_service:
ensure => $jobs_service_ensure,
enable => $jobs_service_enable,
}

if $passenger {
Expand Down
39 changes: 0 additions & 39 deletions manifests/service/jobs.pp

This file was deleted.

1 change: 0 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9"
]
},
Expand Down
51 changes: 0 additions & 51 deletions spec/classes/foreman_service_jobs.rb

This file was deleted.

36 changes: 20 additions & 16 deletions spec/classes/foreman_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('foreman::service::jobs') }
it { is_expected.to contain_service('dynflowd').with_ensure('running').with_enable(true) }

it 'should restart passenger' do
should contain_exec('restart_foreman').with({
Expand All @@ -37,10 +37,12 @@

let :params do
{
:passenger => true,
:app_root => '/usr/share/foreman',
:ssl => true,
:dynflow_in_core => false,
:passenger => true,
:app_root => '/usr/share/foreman',
:ssl => true,
:jobs_service => 'dynflower',
:jobs_service_ensure => 'stopped',
:jobs_service_enable => false,
}
end

Expand All @@ -49,7 +51,7 @@
end

it { is_expected.to compile.with_all_deps }
it { is_expected.not_to contain_class('foreman::service::jobs') }
it { is_expected.to contain_service('dynflower').with_ensure('stopped').with_enable(false) }

it 'should restart passenger' do
should contain_exec('restart_foreman').with({
Expand All @@ -72,30 +74,32 @@
context 'without ssl' do
let :params do
{
:passenger => true,
:app_root => '/usr/share/foreman',
:ssl => false,
:dynflow_in_core => false,
:passenger => true,
:app_root => '/usr/share/foreman',
:ssl => false,
:jobs_service => 'dynflowd',
:jobs_service_ensure => 'running',
:jobs_service_enable => true,
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.not_to contain_class('foreman::service::jobs') }
end
end

context 'without passenger' do
let :params do
{
:passenger => false,
:app_root => '/usr/share/foreman',
:ssl => true,
:dynflow_in_core => false,
:passenger => false,
:app_root => '/usr/share/foreman',
:ssl => true,
:jobs_service => 'dynflowd',
:jobs_service_ensure => 'running',
:jobs_service_enable => true,
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.not_to contain_class('foreman::service::jobs') }

it 'should not restart passenger' do
should_not contain_exec('restart_foreman')
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/plugin/remote_execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:pre_condition) { 'include foreman' }

it { should compile.with_all_deps }
it { should contain_foreman__plugin('remote_execution').that_notifies("Class[foreman::service::jobs]") }
it { should contain_foreman__plugin('remote_execution').that_notifies("Class[foreman::service]") }
it { should contain_foreman__plugin('tasks') }
end
end
Expand Down
2 changes: 0 additions & 2 deletions spec/classes/plugin/tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

it { should compile.with_all_deps }

it { should contain_class('foreman::service::jobs') }

it 'should call the plugin' do
should contain_foreman__plugin('tasks').with_package(package_name)
should contain_file('/etc/cron.d/foreman-tasks').
Expand Down
18 changes: 9 additions & 9 deletions spec/defines/foreman_repos_apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:title) { 'foreman' }

let :facts do
on_supported_os['debian-8-x86_64']
on_supported_os['debian-9-x86_64']
end

context 'with repo => stable' do
Expand All @@ -18,7 +18,7 @@
with_repos('stable')

should contain_file('/etc/apt/sources.list.d/foreman.list').
with_content(/deb http:\/\/deb.theforeman.org\/ jessie stable/)
with_content(%r{deb http://deb\.theforeman\.org/ stretch stable})

should contain_apt__source('foreman-plugins').
with_location('http://deb.theforeman.org/').
Expand All @@ -37,23 +37,23 @@
it { should contain_apt_key(apt_key_title).with_id(apt_key) }
end

context 'with repo => 1.11' do
let(:params) { {:repo => '1.11'} }
context 'with repo => 1.18' do
let(:params) { {:repo => '1.18'} }

it { should contain_class('apt') }

it 'should add the 1.11 repo' do
it 'should add the 1.18 repo' do
should contain_apt__source('foreman').
with_location('http://deb.theforeman.org/').
with_repos('1.11')
with_repos('1.18')

should contain_file('/etc/apt/sources.list.d/foreman.list').
with_content(/deb http:\/\/deb.theforeman.org\/ jessie 1.11/)
with_content(%r{deb http://deb\.theforeman\.org/ stretch 1\.18})

should contain_apt__source('foreman-plugins').
with_location('http://deb.theforeman.org/').
with_release('plugins').
with_repos('1.11')
with_repos('1.18')
end
end

Expand All @@ -68,7 +68,7 @@
with_repos('nightly')

should contain_file('/etc/apt/sources.list.d/foreman.list').
with_content(/deb http:\/\/deb.theforeman.org\/ jessie nightly/)
with_content(%r{deb http://deb\.theforeman\.org/ stretch nightly})

should contain_apt__source('foreman-plugins').
with_location('http://deb.theforeman.org/').
Expand Down