diff --git a/.fixtures.yml b/.fixtures.yml index 9c310df2..3c6280a2 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -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" diff --git a/manifests/dev.pp b/manifests/dev.pp index c5cca3d2..3beb3f80 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -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: diff --git a/manifests/fpm.pp b/manifests/fpm.pp index a042b8a3..4b2790a3 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -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], - } - } } diff --git a/manifests/fpm/service.pp b/manifests/fpm/service.pp index 5aa7a0fb..fe87c87f 100644 --- a/manifests/fpm/service.pp +++ b/manifests/fpm/service.pp @@ -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, diff --git a/manifests/globals.pp b/manifests/globals.pp index 17b94575..f3b46706 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -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', } @@ -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" diff --git a/manifests/repo/debian.pp b/manifests/repo/debian.pp index 1bf4aeba..5dd4d507 100644 --- a/manifests/repo/debian.pp +++ b/manifests/repo/debian.pp @@ -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', diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index c375b25a..a8546f7b 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -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) { diff --git a/metadata.json b/metadata.json index 22f409c2..ac49eac4 100644 --- a/metadata.json +++ b/metadata.json @@ -47,7 +47,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "8", "9", "10" ] diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index 3e6d4c91..18f6c362 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -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 { diff --git a/spec/classes/php_fpm_service_spec.rb b/spec/classes/php_fpm_service_spec.rb index 5e15a836..96855c78 100644 --- a/spec/classes/php_fpm_service_spec.rb +++ b/spec/classes/php_fpm_service_spec.rb @@ -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] diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index afe1c595..45f29d96 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -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] diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb index c7be774f..dc1e5429 100644 --- a/spec/classes/php_repo_spec.rb +++ b/spec/classes/php_repo_spec.rb @@ -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' diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index 56b68a38..e283c6b0 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -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 diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index ebb765d7..7be513d9 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -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'