diff --git a/.travis.yml b/.travis.yml index 124d7af6..387e3758 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ matrix: - rvm: 2.4.3 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-7 script: 'bundle exec rspec spec/acceptance/php56_spec.rb' services: docker sudo: require @@ -81,6 +81,13 @@ matrix: script: 'bundle exec rspec spec/acceptance/php_spec.rb' services: docker sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-9 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + services: docker + sudo: require branches: only: - master diff --git a/manifests/globals.pp b/manifests/globals.pp index a2fbcf11..522a7b41 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -17,12 +17,14 @@ Optional[Stdlib::Absolutepath] $fpm_pid_file = undef, ) { - $default_php_version = $facts['os']['family'] ? { - 'Debian' => $facts['os']['name'] ? { - 'Ubuntu' => $facts['os']['release']['full'] ? { - /^(1[67].04)$/ => '7.0', - default => '5.x', - }, + $default_php_version = $facts['os']['name'] ? { + 'Debian' => $facts['os']['release']['major'] ? { + '9' => '7.0', + default => '5.x', + }, + 'Ubuntu' => $facts['os']['release']['major'] ? { + '18.04' => '7.2', + '16.04' => '7.0', default => '5.x', }, default => '5.x', diff --git a/metadata.json b/metadata.json index 877592d6..01532502 100644 --- a/metadata.json +++ b/metadata.json @@ -48,7 +48,8 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "7", - "8" + "8", + "9" ] }, { diff --git a/spec/acceptance/php_spec.rb b/spec/acceptance/php_spec.rb index 36bc845b..c3857428 100644 --- a/spec/acceptance/php_spec.rb +++ b/spec/acceptance/php_spec.rb @@ -16,8 +16,10 @@ packagename = 'php5-fpm' when %r{el} packagename = 'php-fpm' - when %r{debian} + when %r{debian-8} packagename = 'php5-fpm' + when %r{debian-9} + packagename = 'php7.0-fpm' end describe package(packagename) do it { is_expected.to be_installed } diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index 75f624ce..7f739e53 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -7,6 +7,61 @@ facts end + php_cli_package = case facts[:os]['name'] + when 'Debian' + case facts[:os]['release']['major'] + when '9' + 'php7.0-cli' + else + 'php5-cli' + end + when 'Ubuntu' + case facts[:os]['release']['major'] + when '18.04' + 'php7.2-cli' + when '16.04' + 'php7.0-cli' + else + 'php5-cli' + end + end + php_fpm_ackage = case facts[:os]['name'] + when 'Debian' + case facts[:os]['release']['major'] + when '9' + 'php7.0-fpm' + else + 'php5-fpm' + end + when 'Ubuntu' + case facts[:os]['release']['major'] + when '18.04' + 'php7.2-fpm' + when '16.04' + 'php7.0-fpm' + else + 'php5-fpm' + end + end + php_dev_ackage = case facts[:os]['name'] + when 'Debian' + case facts[:os]['release']['major'] + when '9' + 'php7.0-dev' + else + 'php5-dev' + end + when 'Ubuntu' + case facts[:os]['release']['major'] + when '18.04' + 'php7.2-dev' + when '16.04' + 'php7.0-dev' + else + 'php5-dev' + end + end + describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' @@ -14,16 +69,9 @@ it { is_expected.to contain_class('php::fpm') } it { is_expected.to contain_package('php-pear').with_ensure('present') } it { is_expected.to contain_class('php::composer') } - case facts[:os]['release']['major'] - when '14.04' - it { is_expected.to contain_package('php5-cli').with_ensure('present') } - it { is_expected.to contain_package('php5-fpm').with_ensure('present') } - it { is_expected.to contain_package('php5-dev').with_ensure('present') } - when '16.04' - it { is_expected.to contain_package('php7.0-cli').with_ensure('present') } - it { is_expected.to contain_package('php7.0-fpm').with_ensure('present') } - it { is_expected.to contain_package('php7.0-dev').with_ensure('present') } - end + it { is_expected.to contain_package(php_cli_package).with_ensure('present') } + it { is_expected.to contain_package(php_fpm_ackage).with_ensure('present') } + it { is_expected.to contain_package(php_dev_ackage).with_ensure('present') } when 'Suse' it { is_expected.to contain_class('php::global') } it { is_expected.to contain_package('php5').with_ensure('present') } @@ -66,11 +114,23 @@ dstfile = case facts[:osfamily] when 'Debian' - case facts[:os]['release']['major'] - when '16.04' - '/etc/php/7.0/fpm/pool.d/www.conf' - else - '/etc/php5/fpm/pool.d/www.conf' + case facts[:os]['name'] + when 'Debian' + case facts[:os]['release']['major'] + when '9' + '/etc/php/7.0/fpm/pool.d/www.conf' + else + '/etc/php5/fpm/pool.d/www.conf' + end + when 'Ubuntu' + case facts[:os]['release']['major'] + when '18.04' + '/etc/php/7.2/fpm/pool.d/www.conf' + when '16.04' + '/etc/php/7.0/fpm/pool.d/www.conf' + else + '/etc/php5/fpm/pool.d/www.conf' + end end when 'Archlinux' '/etc/php/php-fpm.d/www.conf' @@ -89,13 +149,26 @@ it { is_expected.to contain_class('php::fpm').with(group: 'nginx') } it { is_expected.to contain_php__fpm__pool('www').with(group: 'nginx') } + dstfile = case facts[:osfamily] when 'Debian' - case facts[:os]['release']['major'] - when '16.04' - '/etc/php/7.0/fpm/pool.d/www.conf' - else - '/etc/php5/fpm/pool.d/www.conf' + case facts[:os]['name'] + when 'Debian' + case facts[:os]['release']['major'] + when '9' + '/etc/php/7.0/fpm/pool.d/www.conf' + else + '/etc/php5/fpm/pool.d/www.conf' + end + when 'Ubuntu' + case facts[:os]['release']['major'] + when '18.04' + '/etc/php/7.2/fpm/pool.d/www.conf' + when '16.04' + '/etc/php/7.0/fpm/pool.d/www.conf' + else + '/etc/php5/fpm/pool.d/www.conf' + end end when 'Archlinux' '/etc/php/php-fpm.d/www.conf' diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index db74f2ff..ea8310c5 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -10,19 +10,28 @@ let(:pre_condition) { 'include php' } unless facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD' # FIXME: something is wrong on these - etcdir = case facts[:osfamily] - when 'Debian' - case facts[:os]['release']['major'] - when '16.04' - '/etc/php/7.0/mods-available' - else - '/etc/php5/mods-available' - end - when 'Archlinux' - '/etc/php/conf.d' - else - '/etc/php.d' - end + etcdir = case facts[:os]['name'] + when 'Debian' + case facts[:os]['release']['major'] + when '9' + '/etc/php/7.0/mods-available' + else + '/etc/php5/mods-available' + end + when 'Ubuntu' + case facts[:os]['release']['major'] + when '18.04' + '/etc/php/7.0/mods-available' + when '16.04' + '/etc/php/7.0/mods-available' + else + '/etc/php5/mods-available' + end + when 'Archlinux' + '/etc/php/conf.d' + else + '/etc/php.d' + end context 'installation from repository' do let(:title) { 'json' } diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index dc3c5165..8cb30d32 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -8,26 +8,30 @@ end let(:pre_condition) { 'include php' } - case facts[:osfamily] + case facts[:os]['name'] when 'Debian' - case facts[:operatingsystem] - when 'Ubuntu' - context 'plain config' do - let(:title) { 'unique-name' } - let(:params) { {} } + context 'plain config' do + let(:title) { 'unique-name' } + let(:params) { {} } - case facts[:os]['release']['major'] - when '14.04' - it { is_expected.to contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } - when '16.04' - it { is_expected.to contain_file('/etc/php/7.0/fpm/pool.d/unique-name.conf') } - end + case facts[:os]['release']['major'] + when '9' + it { is_expected.to contain_file('/etc/php/7.0/fpm/pool.d/unique-name.conf') } + else + it { is_expected.to contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } end - when 'Debian' - context 'plain config' do - let(:title) { 'unique-name' } - let(:params) { {} } + end + when 'Ubuntu' + context 'plain config' do + let(:title) { 'unique-name' } + let(:params) { {} } + case facts[:os]['release']['major'] + when '18.04' + it { is_expected.to contain_file('/etc/php/7.2/fpm/pool.d/unique-name.conf') } + when '16.04' + it { is_expected.to contain_file('/etc/php/7.0/fpm/pool.d/unique-name.conf') } + else it { is_expected.to contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } end end