Skip to content

Commit

Permalink
Merge pull request #592 from bastelfreak/debian
Browse files Browse the repository at this point in the history
Drop EOL Debian 7/8 & Ubuntu 12/14
  • Loading branch information
bastelfreak committed Aug 1, 2020
2 parents d7bcc0a + ec80be8 commit f4465f4
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 94 deletions.
1 change: 1 addition & 0 deletions .fixtures.yml
Expand Up @@ -2,6 +2,7 @@ fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
translate: "https://github.com/puppetlabs/puppetlabs-translate.git"
zypprepo: "https://github.com/deadpoint/puppet-zypprepo.git"
inifile: "https://github.com/puppetlabs/puppetlabs-inifile.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
Expand Down
2 changes: 1 addition & 1 deletion manifests/dev.pp
Expand Up @@ -32,7 +32,7 @@
}

# Default PHP come with xml module and no seperate package for it
if $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16.04') >= 0 {
if $facts['os']['name'] == 'Ubuntu' {
ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => $require, })
}
package { $real_package:
Expand Down
15 changes: 0 additions & 15 deletions manifests/fpm.pp
Expand Up @@ -107,19 +107,4 @@
$real_global_pool_settings = $global_pool_settings
$real_pools = $pools
create_resources(::php::fpm::pool, $real_pools, $real_global_pool_settings)

# Create an override to use a reload signal as trusty and utopic's
# upstart version supports this
if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '14') >= 0 and versioncmp($facts['os']['release']['full'], '16') < 0) {
if ($service_enable) {
$fpm_override = 'reload signal USR2'
}
else {
$fpm_override = "reload signal USR2\nmanual"
}
file { "/etc/init/${php::fpm::service::service_name}.override":
content => $fpm_override,
before => Package[$real_package],
}
}
}
12 changes: 1 addition & 11 deletions manifests/fpm/service.pp
Expand Up @@ -24,17 +24,7 @@
warning('php::fpm::service is private')
}

$reload = "service ${service_name} reload"

if ($facts['os']['name'] == 'Ubuntu'
and versioncmp($facts['os']['release']['full'], '12') >= 0
and versioncmp($facts['os']['release']['full'], '14') < 0) {
# Precise upstart doesn't support reload signals, so use
# regular service restart instead
$restart = undef
} else {
$restart = $reload
}
$restart = "service ${service_name} reload"

service { $service_name:
ensure => $ensure,
Expand Down
15 changes: 2 additions & 13 deletions manifests/globals.pp
Expand Up @@ -28,13 +28,11 @@
$default_php_version = $facts['os']['name'] ? {
'Debian' => $facts['os']['release']['major'] ? {
'9' => '7.0',
'10' => '7.3',
default => '5.x',
default => '7.3',
},
'Ubuntu' => $facts['os']['release']['major'] ? {
'18.04' => '7.2',
'16.04' => '7.0',
default => '5.x',
default => '7.2',
},
default => '5.x',
}
Expand All @@ -45,15 +43,6 @@
'Debian': {
if $facts['os']['name'] == 'Ubuntu' {
case $globals_php_version {
/^5\.4/: {
$default_config_root = '/etc/php5'
$default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
$fpm_error_log = '/var/log/php5-fpm.log'
$fpm_service_name = 'php5-fpm'
$ext_tool_enable = '/usr/sbin/php5enmod'
$ext_tool_query = '/usr/sbin/php5query'
$package_prefix = 'php5-'
}
/^[57].[0-9]/: {
$default_config_root = "/etc/php/${globals_php_version}"
$default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
Expand Down
18 changes: 1 addition & 17 deletions manifests/repo/debian.pp
Expand Up @@ -50,23 +50,7 @@
key => $key,
}

if ($dotdeb) {
# both repositories are required to work correctly
# See: http://www.dotdeb.org/instructions/
if $release == 'wheezy-php56' {
apt::source { 'dotdeb-wheezy':
location => $location,
release => 'wheezy',
repos => $repos,
include => {
'src' => $include_src,
'deb' => true,
},
}
}
}

if ($sury and $php::globals::php_version in ['5.6','7.1','7.2']) {
if ($sury and $php::globals::php_version in ['7.1','7.2']) {
apt::source { 'source_php_sury':
location => 'https://packages.sury.org/php/',
repos => 'main',
Expand Down
3 changes: 3 additions & 0 deletions manifests/repo/ubuntu.pp
Expand Up @@ -8,6 +8,9 @@
class php::repo::ubuntu (
$version = undef,
) {
if $facts['os']['name'] != 'Ubuntu' {
fail("class php::repo::ubuntu does not work on OS ${facts['os']['name']}")
}
include 'apt'

if($version == undef) {
Expand Down
1 change: 0 additions & 1 deletion metadata.json
Expand Up @@ -47,7 +47,6 @@
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9",
"10"
]
Expand Down
5 changes: 5 additions & 0 deletions spec/classes/php_fpm_config_spec.rb
Expand Up @@ -8,6 +8,11 @@
facts
end

describe 'works without params' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('php::globals') }
it { is_expected.to contain_class('php::params') }
end
describe 'creates config file' do
let(:params) do
{
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/php_fpm_service_spec.rb
Expand Up @@ -9,6 +9,20 @@

let(:pre_condition) { 'class {"php": fpm => true}' }

describe 'works without default' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('php::cli') }
it { is_expected.to contain_class('php::composer::auto_update') }
it { is_expected.to contain_class('php::composer') }
it { is_expected.to contain_class('php::dev') }
it { is_expected.to contain_class('php::fpm::config') }
it { is_expected.to contain_class('php::fpm') }
it { is_expected.to contain_class('php::packages') }
it { is_expected.to contain_class('php::globals') }
it { is_expected.to contain_class('php::params') }
it { is_expected.to contain_class('php::pear') }
end

describe 'when called with no parameters' do
# rubocop:disable RSpec/RepeatedExample
case facts[:osfamily]
Expand Down
4 changes: 4 additions & 0 deletions spec/classes/php_fpm_spec.rb
Expand Up @@ -8,6 +8,10 @@
end
let(:pre_condition) { 'class {"php": fpm => false}' }

describe 'works without params' do
it { is_expected.to compile.with_all_deps }
end

describe 'when called with no parameters' do
# rubocop:disable RSpec/RepeatedExample
case facts[:osfamily]
Expand Down
7 changes: 7 additions & 0 deletions spec/classes/php_repo_spec.rb
Expand Up @@ -11,6 +11,13 @@
'include php'
end

describe 'works without params' do
if facts[:os]['name'] == 'Archlinux'
it { is_expected.to compile.and_raise_error(%r{No repo available for}) }
else
it { is_expected.to compile.with_all_deps }
end
end
describe 'when configuring a package repo' do
case facts[:osfamily]
when 'Debian'
Expand Down
41 changes: 6 additions & 35 deletions spec/classes/php_repo_ubuntu_spec.rb
Expand Up @@ -7,42 +7,13 @@
facts
end

case facts[:lsbdistcodename]
when 'trusty'
describe 'when called with no parameters on Ubuntu trusty' do
it { is_expected.to contain_exec('add-apt-repository-ppa:ondrej/php') }
describe 'works without params' do
if facts[:os]['name'] == 'Ubuntu'
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_apt__ppa('ppa:ondrej/php') }
else
it { is_expected.to compile.and_raise_error(%r{class php::repo::ubuntu does not work on OS}) }
end

describe 'when called with version 7.0 on Ubuntu trusty' do
let(:params) do
{
version: '7.0'
}
end

it { is_expected.to contain_exec('add-apt-repository-ppa:ondrej/php') }
end

describe 'when call with version 5.6 on Ubuntu trusty' do
let(:params) do
{
version: '5.6'
}
end

it { is_expected.to contain_exec('add-apt-repository-ppa:ondrej/php') }
end

describe 'when call with version 5.4 on Ubuntu trusty' do
let(:params) do
{
version: '5.4'
}
end

it { is_expected.to raise_error(Puppet::Error) }
end

end
end
end
Expand Down
4 changes: 3 additions & 1 deletion spec/classes/php_spec.rb
Expand Up @@ -67,7 +67,9 @@
'php5-dev'
end
end

describe 'works without params' do
it { is_expected.to compile.with_all_deps }
end
describe 'when called with no parameters' do
case facts[:osfamily]
when 'Suse', 'RedHat', 'CentOS'
Expand Down

0 comments on commit f4465f4

Please sign in to comment.