Project

General

Profile

« Previous | Next » 

Revision a64c58e8

Added by Dominic Cleal over 8 years ago

refs #4841 - change EL OSes to use 'tfm' SCL prefix

Parameters are supplied on the main foreman class to revert behaviour
for Foreman 1.9 and prior, plus on three plugin classes with
non-standard package names.

Closes GH-348

View differences:

README.md
The latest release (git tag, Puppet Forge) should support current and the
previous stable release.
### Foreman 1.8/1.9 compatibility notes
On EL or Amazon, set:
passenger_ruby => '/usr/bin/ruby193-ruby`,
passenger_ruby_package => 'ruby193-rubygem-passenger-native',
plugin_prefix => 'ruby193-rubygem-foreman_',
If using `foreman::plugin::ovirt_provision`, puppetdb or tasks, also set the
`package` parameter as appropriate to:
ruby193-rubygem-foreman-tasks
ruby193-rubygem-ovirt_provision_plugin
ruby193-rubygem-puppetdb_foreman
### Foreman 1.7 compatibility notes
* set `apipie_task => 'apipie:cache'` as Foreman 1.7 packages didn't have
manifests/params.pp
default => '/usr/share/ruby/vendor_ruby/puppet',
}
# add passenger::install::scl as EL uses SCL on Foreman 1.2+
$passenger_ruby = '/usr/bin/ruby193-ruby'
$passenger_ruby_package = 'ruby193-rubygem-passenger-native'
$plugin_prefix = 'ruby193-rubygem-foreman_'
$passenger_ruby = '/usr/bin/tfm-ruby'
$passenger_ruby_package = 'tfm-rubygem-passenger-native'
$plugin_prefix = 'tfm-rubygem-foreman_'
$passenger_prestart = true
$passenger_min_instances = 1
$passenger_start_timeout = 600
......
$puppet_home = '/var/lib/puppet'
$yumcode = 'el6'
# add passenger::install::scl as EL uses SCL on Foreman 1.2+
$passenger_ruby = '/usr/bin/ruby193-ruby'
$passenger_ruby_package = 'ruby193-rubygem-passenger-native'
$plugin_prefix = 'ruby193-rubygem-foreman_'
$passenger_ruby = '/usr/bin/tfm-ruby'
$passenger_ruby_package = 'tfm-rubygem-passenger-native'
$plugin_prefix = 'tfm-rubygem-foreman_'
$init_config = '/etc/sysconfig/foreman'
$init_config_tmpl = 'foreman.sysconfig'
$passenger_prestart = true
manifests/plugin/ovirt_provision.pp
# Installs ovirt_provision plugin
class foreman::plugin::ovirt_provision {
case $::osfamily {
'RedHat': {
case $::operatingsystem {
'fedora': {
$package = 'rubygem-ovirt_provision_plugin'
}
default: {
$package = 'ruby193-rubygem-ovirt_provision_plugin'
}
}
}
'Debian': {
$package = 'ruby-ovirt-provision-plugin'
}
'Linux': {
case $::operatingsystem {
'Amazon': {
$package = 'ruby193-ovirt_provision_plugin'
}
default: {
fail("${::hostname}: ovirt_provision_plugin does not support operatingsystem ${::operatingsystem}")
}
}
}
default: {
fail("${::hostname}: ovirt_provision_plugin does not support osfamily ${::osfamily}")
}
}
# = oVirt Provisioning Plugin
#
# Installs the ovirt_provision plugin
#
# === Parameters:
#
# $package:: Package name to install, use ruby193-rubygem-ovirt_provision_plugin on Foreman 1.8/1.9 on EL
#
class foreman::plugin::ovirt_provision (
$package = $foreman::plugin::ovirt_provision::params::package,
) inherits foreman::plugin::ovirt_provision::params {
foreman::plugin {'ovirt_provision':
package => $package,
}
manifests/plugin/ovirt_provision/params.pp
# Data for the ovirt_provision plugin
class foreman::plugin::ovirt_provision::params {
case $::osfamily {
'RedHat': {
case $::operatingsystem {
'fedora': {
$package = 'rubygem-ovirt_provision_plugin'
}
default: {
$package = 'tfm-rubygem-ovirt_provision_plugin'
}
}
}
'Debian': {
$package = 'ruby-ovirt-provision-plugin'
}
'Linux': {
case $::operatingsystem {
'Amazon': {
$package = 'tfm-rubygem-ovirt_provision_plugin'
}
default: {
fail("${::hostname}: ovirt_provision_plugin does not support operatingsystem ${::operatingsystem}")
}
}
}
default: {
fail("${::hostname}: ovirt_provision_plugin does not support osfamily ${::osfamily}")
}
}
}
manifests/plugin/puppetdb.pp
# Installs puppetdb_foreman plugin
class foreman::plugin::puppetdb {
case $::osfamily {
'RedHat': {
case $::operatingsystem {
'fedora': {
$package = 'rubygem-puppetdb_foreman'
}
default: {
$package = 'ruby193-rubygem-puppetdb_foreman'
}
}
}
'Debian': {
$package = 'ruby-puppetdb-foreman'
}
'Linux': {
case $::operatingsystem {
'Amazon': {
$package = 'ruby193-rubygem-puppetdb_foreman'
}
default: {
fail("${::hostname}: puppetdb_foreman does not support operatingsystem ${::operatingsystem}")
}
}
}
default: {
fail("${::hostname}: puppetdb_foreman does not support osfamily ${::osfamily}")
}
}
# = PuppetDB Foreman plugin
#
# Installs the puppetdb_foreman plugin
#
# === Parameters:
#
# $package:: Package name to install, use ruby193-rubygem-puppetdb_foreman on Foreman 1.8/1.9 on EL
#
class foreman::plugin::puppetdb(
$package = $foreman::plugin::puppetdb::params::package,
) inherits foreman::plugin::puppetdb::params {
foreman::plugin {'puppetdb':
package => $package,
}
manifests/plugin/puppetdb/params.pp
# Data for the puppetdb_foreman plugin
class foreman::plugin::puppetdb::params {
case $::osfamily {
'RedHat': {
case $::operatingsystem {
'fedora': {
$package = 'rubygem-puppetdb_foreman'
}
default: {
$package = 'tfm-rubygem-puppetdb_foreman'
}
}
}
'Debian': {
$package = 'ruby-puppetdb-foreman'
}
'Linux': {
case $::operatingsystem {
'Amazon': {
$package = 'tfm-rubygem-puppetdb_foreman'
}
default: {
fail("${::hostname}: puppetdb_foreman does not support operatingsystem ${::operatingsystem}")
}
}
}
default: {
fail("${::hostname}: puppetdb_foreman does not support osfamily ${::osfamily}")
}
}
}
manifests/plugin/tasks.pp
# Installs foreman-tasks plugin
class foreman::plugin::tasks {
case $::osfamily {
'RedHat': {
$service = 'foreman-tasks'
case $::operatingsystem {
'fedora': {
$package = 'rubygem-foreman-tasks'
}
default: {
$package = 'ruby193-rubygem-foreman-tasks'
}
}
}
'Debian': {
$package = 'ruby-foreman-tasks'
$service = 'ruby-foreman-tasks'
}
default: {
fail("${::hostname}: foreman-tasks does not support osfamily ${::osfamily}")
}
}
# = Foreman Tasks
#
# Installs the foreman-tasks plugin
#
# === Parameters:
#
# $package:: Package name to install, use ruby193-rubygem-foreman-tasks on Foreman 1.8/1.9 on EL
#
# $service:: Service name
#
class foreman::plugin::tasks(
$package = $foreman::plugin::tasks::params::package,
$service = $foreman::plugin::tasks::params::service,
) inherits foreman::plugin::tasks::params {
foreman::plugin { 'tasks':
package => $package,
} ~>
manifests/plugin/tasks/params.pp
# Data for the foreman-tasks plugin
class foreman::plugin::tasks::params {
case $::osfamily {
'RedHat': {
$service = 'foreman-tasks'
case $::operatingsystem {
'fedora': {
$package = 'rubygem-foreman-tasks'
}
default: {
$package = 'tfm-rubygem-foreman-tasks'
}
}
}
'Debian': {
$package = 'ruby-foreman-tasks'
$service = 'ruby-foreman-tasks'
}
default: {
fail("${::hostname}: foreman-tasks does not support osfamily ${::osfamily}")
}
}
}
spec/classes/foreman_config_passenger_spec.rb
:prestart => true,
:min_instances => '1',
:start_timeout => '600',
:ruby => '/usr/bin/ruby193-ruby'
:ruby => '/usr/bin/tfm-ruby'
} end
it 'should contain the docroot' do
......
:passenger_min_instances => '1',
:passenger_pre_start => "http://#{facts[:fqdn]}",
:passenger_start_timeout => '600',
:passenger_ruby => "/usr/bin/ruby193-ruby",
:passenger_ruby => "/usr/bin/tfm-ruby",
:custom_fragment => %r{^<Directory #{params[:app_root]}/public>$},
})
end
......
:passenger_min_instances => '1',
:passenger_pre_start => "https://#{facts[:fqdn]}",
:passenger_start_timeout => '600',
:passenger_ruby => "/usr/bin/ruby193-ruby",
:passenger_ruby => "/usr/bin/tfm-ruby",
:ssl => true,
:ssl_cert => params[:ssl_cert],
:ssl_key => params[:ssl_key],
......
:prestart => true,
:min_instances => '1',
:start_timeout => '600',
:ruby => '/usr/bin/ruby193-ruby'
:ruby => '/usr/bin/tfm-ruby'
} end
it do
......
:prestart => true,
:min_instances => '1',
:start_timeout => '600',
:ruby => '/usr/bin/ruby193-ruby'
:ruby => '/usr/bin/tfm-ruby'
} end
it do
spec/classes/foreman_config_spec.rb
it 'should contain foreman::config::passenger' do
should contain_class('foreman::config::passenger').
with_listen_on_interface(nil).
with_ruby('/usr/bin/ruby193-ruby').
with_ruby('/usr/bin/tfm-ruby').
that_comes_before('Anchor[foreman::config_end]')
end
spec/classes/foreman_install_spec.rb
it { should contain_package('foreman-postgresql').with_ensure('present') }
it { should contain_package('foreman-postgresql').that_requires('Foreman::Install::Repos[foreman]') }
it { should contain_package('foreman-postgresql').that_requires('Class[foreman::install::repos::extra]') }
it { should contain_package('ruby193-rubygem-passenger-native') }
it { should contain_package('tfm-rubygem-passenger-native') }
end
describe 'with version' do
spec/classes/foreman_plugin_ovirt_provision_spec.rb
require 'spec_helper'
describe 'foreman::plugin::ovirt_provision' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
if facts[:operatingsystem] == 'Fedora'
it 'should call the plugin' do
should contain_foreman__plugin('ovirt_provision').with_package('rubygem-ovirt_provision_plugin')
end
elsif facts[:osfamily] == 'RedHat'
it 'should call the plugin' do
should contain_foreman__plugin('ovirt_provision').with_package('tfm-rubygem-ovirt_provision_plugin')
end
elsif facts[:osfamily] == 'Debian'
it 'should call the plugin' do
should contain_foreman__plugin('ovirt_provision').with_package('ruby-ovirt-provision-plugin')
end
end
end
end
end
spec/classes/foreman_plugin_puppetdb_spec.rb
require 'spec_helper'
describe 'foreman::plugin::puppetdb' do
let :facts do {
:osfamily => 'Debian',
} end
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
it 'should call the plugin' do
should contain_foreman__plugin('puppetdb').with_package('ruby-puppetdb-foreman')
if facts[:operatingsystem] == 'Fedora'
it 'should call the plugin' do
should contain_foreman__plugin('puppetdb').with_package('rubygem-puppetdb_foreman')
end
elsif facts[:osfamily] == 'RedHat'
it 'should call the plugin' do
should contain_foreman__plugin('puppetdb').with_package('tfm-rubygem-puppetdb_foreman')
end
elsif facts[:osfamily] == 'Debian'
it 'should call the plugin' do
should contain_foreman__plugin('puppetdb').with_package('ruby-puppetdb-foreman')
end
end
end
end
end
spec/classes/foreman_plugin_tasks_spec.rb
end
it 'should call the plugin' do
should contain_foreman__plugin('tasks').with_package('ruby193-rubygem-foreman-tasks')
should contain_foreman__plugin('tasks').with_package('tfm-rubygem-foreman-tasks')
should contain_service('foreman-tasks').with('ensure' => 'running', 'enable' => 'true', 'name' => 'foreman-tasks')
end
end
spec/defines/foreman_plugin_spec.rb
} end
it 'should install the correct package' do
should contain_package('ruby193-rubygem-foreman_myplugin').with_ensure('installed')
should contain_package('tfm-rubygem-foreman_myplugin').with_ensure('installed')
end
it 'should not contain the config file' do

Also available in: Unified diff