From 2897c363fed601f2f3b5ca9bda21ea276aa6ed53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arkadiusz=20Dzi=C4=99giel?= Date: Tue, 8 Sep 2015 00:01:41 +0200 Subject: [PATCH 001/221] added embedded SAPI support --- manifests/embedded.pp | 45 +++++++++++++++++++++++++++++++++++++++++++ manifests/init.pp | 14 ++++++++++++++ manifests/params.pp | 8 ++++++++ 3 files changed, 67 insertions(+) create mode 100644 manifests/embedded.pp diff --git a/manifests/embedded.pp b/manifests/embedded.pp new file mode 100644 index 00000000..c03ea9be --- /dev/null +++ b/manifests/embedded.pp @@ -0,0 +1,45 @@ +# Install and configure php embedded SAPI +# +# === Parameters +# +# [*inifile*] +# The path to the ini php5-embeded ini file +# +# [*settings*] +# Hash with nested hash of key => value to set in inifile +# +class php::embedded( + $ensure = $::php::ensure, + $package = + "${::php::package_prefix}${::php::params::embedded_package_suffix}", + $inifile = $::php::params::embedded_inifile, + $settings = {}, +) inherits ::php::params { + + if $caller_module_name != $module_name { + warning('php::embedded is private') + } + + validate_absolute_path($inifile) + validate_hash($settings) + + $real_settings = deep_merge( + $settings, + hiera_hash('php::embedded::settings', {}) + ) + + $real_package = $::osfamily ? { + 'Debian' => "lib${package}", + default => $package, + } + + package { $real_package: + ensure => $ensure, + require => Class['::php::packages'], + }-> + ::php::config { 'embedded': + file => $inifile, + config => $real_settings, + } + +} diff --git a/manifests/init.pp b/manifests/init.pp index 7caa8bff..9ba18d4e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -37,6 +37,7 @@ $ensure = $::php::params::ensure, $manage_repos = $::php::params::manage_repos, $fpm = true, + $embedded = false, $dev = true, $composer = true, $pear = true, @@ -50,6 +51,7 @@ validate_string($ensure) validate_bool($manage_repos) validate_bool($fpm) + validate_bool($embedded) validate_bool($dev) validate_bool($composer) validate_bool($pear) @@ -80,6 +82,18 @@ } -> Anchor['php::end'] } + if $embedded { + if $::osfamily == 'RedHat' and $fpm { + # Both fpm and embeded SAPIs are using same php.ini + fail('Enabling both cli and embedded sapis is not currently supported') + } + + Anchor['php::begin'] -> + class { '::php::embedded': + settings => $real_settings, + } -> + Anchor['php::end'] + } if $dev { Anchor['php::begin'] -> class { '::php::dev': } -> diff --git a/manifests/params.pp b/manifests/params.pp index 519a3180..5b06b196 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -29,6 +29,8 @@ $fpm_service_name = 'php5-fpm' $fpm_user = 'www-data' $fpm_group = 'www-data' + $embedded_package_suffix = 'embed' + $embedded_inifile = "${config_root}/embed/php.ini" $package_prefix = 'php5-' $compiler_packages = 'build-essential' $manage_repos = $::lsbdistcodename == 'wheezy' @@ -49,6 +51,8 @@ $fpm_service_name = 'php-fpm' $fpm_user = 'wwwrun' $fpm_group = 'www' + $embedded_package_suffix = 'embed' + $embedded_inifile = "${config_root}/embed/php.ini" $package_prefix = 'php5-' $manage_repos = true $root_group = 'root' @@ -78,6 +82,8 @@ $fpm_service_name = 'php-fpm' $fpm_user = 'apache' $fpm_group = 'apache' + $embedded_package_suffix = 'embedded' + $embedded_inifile = '/etc/php.ini' $package_prefix = 'php-' $compiler_packages = ['gcc', 'gcc-c++', 'make'] $manage_repos = false @@ -101,6 +107,8 @@ $fpm_service_name = 'php-fpm' $fpm_user = 'www' $fpm_group = 'www' + $embedded_package_suffix = 'embed' + $embedded_inifile = "${config_root}/php-embed.ini" $package_prefix = 'php56-' $compiler_packages = ['gcc'] $manage_repos = false From 741a461d26f18ed34bdc022d11cf9562b98eb7f0 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Fri, 9 Oct 2015 00:11:38 +0200 Subject: [PATCH 002/221] Pass the auto_discover setting directly to the pear cmd That way, we avoid dependency problems because it will always be set when a package is to be installed or updated. --- lib/puppet/provider/package/pear.rb | 2 +- manifests/pear.pp | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 7159cd86..43570523 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -85,7 +85,7 @@ def self.instances end def install(useversion = true) - command = ["upgrade"] + command = ["-D", "auto_discover=1", "upgrade"] if @resource[:install_options] command << @resource[:install_options] else diff --git a/manifests/pear.pp b/manifests/pear.pp index 8d85009b..04d83c57 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -43,11 +43,4 @@ require => Class['::php::cli'], } - exec { '::php::pear::auto_discover': - command => 'pear config-set auto_discover 1 system', - unless => 'pear config-get auto_discover system | grep -q 1', - path => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', - '/usr/local/bin', '/usr/local/sbin'], - require => Package[$package_name], - } } From f904fe75c978afb06a271a9175da6063b8a5de31 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Sat, 10 Oct 2015 14:32:22 +0200 Subject: [PATCH 003/221] Make the ::php::extension module part of the public API --- manifests/extension.pp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index bb9bd695..660cae3e 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -59,10 +59,6 @@ $settings_prefix = false, ) { - if $caller_module_name != $module_name { - warning('php::extension is private') - } - validate_string($ensure) validate_string($package_prefix) validate_string($so_name) From 2aa806182a287d999bcbdc7fd39106de25be5148 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Mon, 12 Oct 2015 09:57:19 +0200 Subject: [PATCH 004/221] This is required when the package is already installed but the extension is not enabled --- manifests/extension.pp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index bb9bd695..f55b7d63 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -183,11 +183,10 @@ $cmd = "/usr/sbin/php5enmod ${lowercase_title}" exec { $cmd: - refreshonly => true, + unless => "/usr/sbin/php5query -s cli -m ${lowercase_title}", + require =>::Php::Config[$title], } - ::Php::Config[$title] ~> Exec[$cmd] - if $::php::fpm { Package[$::php::fpm::package] ~> Exec[$cmd] } From a38fb24965cb802086bb2a79723f054e89204aa3 Mon Sep 17 00:00:00 2001 From: Matthew Robinson Date: Thu, 3 Dec 2015 11:17:33 -0800 Subject: [PATCH 005/221] Add a couple options to fpm config and pool configs --- manifests/fpm/config.pp | 8 +++++ manifests/fpm/pool.pp | 2 ++ templates/fpm/php-fpm.conf.erb | 6 +++- templates/fpm/pool.conf.erb | 61 ++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 1 deletion(-) diff --git a/manifests/fpm/config.pp b/manifests/fpm/config.pp index e37d142a..06be6696 100644 --- a/manifests/fpm/config.pp +++ b/manifests/fpm/config.pp @@ -40,6 +40,12 @@ # [*process_control_timeout*] # The php-fpm process_control_timeout # +# [*process_max*] +# The maximum number of processes FPM will fork. +# +# [*rlimit_files*] +# Set open file descriptor rlimit for the master process. +# # [*systemd_interval*] # The interval between health report notification to systemd # @@ -72,6 +78,8 @@ $emergency_restart_threshold = '0', $emergency_restart_interval = '0', $process_control_timeout = '0', + $process_max = '0', + $rlimit_files = undef, $systemd_interval = undef, $log_owner = $::php::params::fpm_user, $log_group = $::php::params::fpm_group, diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index 40108790..509efc7a 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -112,6 +112,8 @@ $pm_status_path = undef, $ping_path = undef, $ping_response = 'pong', + $access_log = undef, + $access_log_format = "%R - %u %t \"%m %r\" %s", $request_terminate_timeout = '0', $request_slowlog_timeout = '0', $security_limit_extensions = undef, diff --git a/templates/fpm/php-fpm.conf.erb b/templates/fpm/php-fpm.conf.erb index e8fd207d..e7a3fd73 100644 --- a/templates/fpm/php-fpm.conf.erb +++ b/templates/fpm/php-fpm.conf.erb @@ -74,7 +74,7 @@ process_control_timeout = <%= @process_control_timeout %> ; Use it with caution. ; Note: A value of 0 indicates no limit ; Default Value: 0 -; process.max = 128 +process.max = <%= @process_max %> ; Specify the nice(2) priority to apply to the master process (only if set) ; The value can vary from -19 (highest priority) to 20 (lower priority) @@ -90,7 +90,11 @@ process_control_timeout = <%= @process_control_timeout %> ; Set open file descriptor rlimit for the master process. ; Default Value: system defined value +<% if @rlimit_files -%> +rlimit_files = <%= @rlimit_files %> +<% else -%> ;rlimit_files = 1024 +<% end -%> ; Set max core size rlimit for the master process. ; Possible Values: 'unlimited' or an integer greater or equal to 0 diff --git a/templates/fpm/pool.conf.erb b/templates/fpm/pool.conf.erb index 1e38b648..2ef3a415 100644 --- a/templates/fpm/pool.conf.erb +++ b/templates/fpm/pool.conf.erb @@ -152,6 +152,67 @@ ping.path = <%= @ping_path %> ; Default Value: pong ping.response = <%= @ping_response %> +; The access log file +; Default: not set +<% if @access_log -%> +access.log = <%= @access_log %> +<$ end -%> + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: ouput header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +access.format = <%= @access_log_format %> + ; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. From 8c1953141a51688e5460edee0232e11871930f03 Mon Sep 17 00:00:00 2001 From: Matthew Robinson Date: Thu, 3 Dec 2015 11:21:09 -0800 Subject: [PATCH 006/221] Add comments for pools --- manifests/fpm/pool.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index 509efc7a..1ce42d37 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -48,6 +48,12 @@ # # [*ping_reponse*] # +# [*access_log*] +# The path to the file to write access log requests to +# +# [*access_log_format*] +# The format to save the access log entries as +# # [*request_terminate_timeout*] # # [*request_slowlog_timeout*] From 310e93fcdb99a4b513a766ca39a7bbd526d3ad70 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Thu, 3 Dec 2015 22:54:25 +0100 Subject: [PATCH 007/221] use travis docker infra --- .gitignore | 1 + .travis.yml | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 0f737922..479ee755 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ Gemfile.lock spec/fixtures/modules/ .vagrant .bundle +.idea vendor/ diff --git a/.travis.yml b/.travis.yml index 2d92d0f1..ce48595b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -sudo: true +sudo: false language: ruby rvm: - 2.1.6 @@ -6,26 +6,26 @@ rvm: - 1.9.3 env: matrix: - - PUPPET_VERSION=3.7.5 - - PUPPET_VERSION=3.7.5 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes + - PUPPET_VERSION=3.8.4 + - PUPPET_VERSION=3.8.4 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes global: - secure: Zc0V6JqwpFTTtVE7jVFg5R6UgXZrzsBGa6ckbOnIHPCOyJsV4oWO6RxKsYI+ozzD9nrEdrT/DTcHKRz84YqrMXxvBU9HA4S/ZrNQoRiH3bEnI3UHC6jQJRX0c71gaJEMQ3S33my39vLD7EsealX3p+j8asL8e8glYR1am9ekUB8= matrix: exclude: - rvm: 2.1.6 - env: PUPPET_VERSION=3.7.5 + env: PUPPET_VERSION=3.8.4 include: - rvm: 2.1.6 - env: PUPPET_VERSION=3.7.5 DOCS=true + env: PUPPET_VERSION=3.8.4 DOCS=true after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ -n "$DOCS" ] && puppet module install puppetlabs/strings && puppet strings && - sudo pip install ghp-import && + pip install --user ghp-import && echo php.puppet.mayflower.de > doc/CNAME && - ghp-import -n doc && + ~/.local/bin/ghp-import -n doc && git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages notifications: webhooks: From 2994ed0392089e2a44a9b4d400dff7a15d5bccd3 Mon Sep 17 00:00:00 2001 From: Matthew Robinson Date: Thu, 3 Dec 2015 16:04:15 -0800 Subject: [PATCH 008/221] Fix typo --- templates/fpm/pool.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/fpm/pool.conf.erb b/templates/fpm/pool.conf.erb index 2ef3a415..9309f303 100644 --- a/templates/fpm/pool.conf.erb +++ b/templates/fpm/pool.conf.erb @@ -156,7 +156,7 @@ ping.response = <%= @ping_response %> ; Default: not set <% if @access_log -%> access.log = <%= @access_log %> -<$ end -%> +<% end -%> ; The access log format. ; The following syntax is allowed From f550e8b9f9c9ffe2f2a54f0112a6a41b05d33d74 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Fri, 4 Dec 2015 01:45:51 +0100 Subject: [PATCH 009/221] use rspec-puppet-facts --- Gemfile | 1 + metadata.json | 8 +- spec/classes/php_fpm_config_spec.rb | 46 ++-- spec/classes/php_fpm_spec.rb | 49 ++-- spec/classes/php_repo_ubuntu_spec.rb | 122 ++++------ spec/classes/php_spec.rb | 107 ++++----- spec/defines/config_spec.rb | 88 +++---- spec/defines/extension_spec.rb | 331 ++++++++++++++------------- spec/defines/fpm_pool_spec.rb | 22 +- spec/spec_helper.rb | 3 + 10 files changed, 399 insertions(+), 378 deletions(-) diff --git a/Gemfile b/Gemfile index 4ea9baf1..bc25ba1b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ group :development, :test do gem 'rake' gem 'rspec' gem 'rspec-puppet' + gem 'rspec-puppet-facts' gem 'puppetlabs_spec_helper' gem 'puppet-module' gem 'beaker', :github => 'Mayflower/beaker', :branch => 'master' diff --git a/metadata.json b/metadata.json index 6c04d102..5da4746e 100644 --- a/metadata.json +++ b/metadata.json @@ -45,7 +45,13 @@ "7" ] }, - { "operatingsystem": "FreeBSD" }, + { "operatingsystem": "FreeBSD", + "operatingsystemrelease": [ + "9", + "10", + "11" + ] + }, { "operatingsystem": "SLES", "operatingsystemrelease": [ "11" diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index 6cc4d1bf..b31fd4fa 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -1,28 +1,34 @@ require 'spec_helper' describe 'php::fpm::config' do - let(:facts) { { :osfamily => 'Debian' } } + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end - context 'creates config file' do - let(:params) {{ - :inifile => '/etc/php5/conf.d/unique-name.ini', - :settings => { - 'apc.enabled' => 1, - }, - }} + describe 'creates config file' do + let(:params) {{ + :inifile => '/etc/php5/conf.d/unique-name.ini', + :settings => { + 'apc.enabled' => 1, + }, + }} - it { should contain_class('php::fpm::config').with({ - :inifile => '/etc/php5/conf.d/unique-name.ini', - :settings => { - 'apc.enabled' => 1, - }, - })} + it { should contain_class('php::fpm::config').with({ + :inifile => '/etc/php5/conf.d/unique-name.ini', + :settings => { + 'apc.enabled' => 1, + }, + })} - it { should contain_php__config('fpm').with({ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => { - 'apc.enabled' => 1, - }, - })} + it { should contain_php__config('fpm').with({ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => { + 'apc.enabled' => 1, + }, + })} + end + end end end diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index 44c5377b..e45ee4ce 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -1,29 +1,32 @@ require 'spec_helper' describe 'php::fpm', :type => :class do - let(:facts) { { :path => '/usr/local/bin:/usr/bin:/bin' } } + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end - describe 'when called with no parameters on Debian' do - let(:facts) { { :osfamily => 'Debian' } } - let(:params) { { :package => 'php5-fpm', :ensure => 'latest' } } - - it { - should contain_package('php5-fpm').with({ - 'ensure' => 'latest', - }) - should contain_service('php5-fpm').with({ - 'ensure' => 'running', - }) - } - end - - describe 'when called with no parameters on Suse' do - let(:facts) { { :osfamily => 'Suse', :operatingsystem => 'SLES' } } - - it { - should contain_service('php-fpm').with({ - 'ensure' => 'running', - }) - } + describe 'when called with no parameters' do + case facts[:osfamily] + when 'Debian' + let(:params) { { :package => 'php5-fpm', :ensure => 'latest' } } + it { + should contain_package('php5-fpm').with({ + 'ensure' => 'latest', + }) + should contain_service('php5-fpm').with({ + 'ensure' => 'running', + }) + } + else + it { + should contain_service('php-fpm').with({ + 'ensure' => 'running', + }) + } + end + end + end end end diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index a70c245c..b2120c23 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -1,77 +1,53 @@ require 'spec_helper' describe 'php::repo::ubuntu', :type => :class do - describe 'when called with no parameters on Ubuntu trusty' do - let(:facts) {{ - :osfamily => 'Debian', - :operatingsystem => 'Ubuntu', - :lsbdistid => 'Ubuntu', - :lsbdistcodename => 'trusty' - }} - - it { - should contain_exec('add-apt-repository-ppa:ondrej/php5') - } - end - - describe 'when called with no parameters on Ubuntu precise' do - let(:facts) {{ - :osfamily => 'Debian', - :operatingsystem => 'Ubuntu', - :lsbdistid => 'Ubuntu', - :lsbdistcodename => 'precise' - }} - - it { - should contain_exec('add-apt-repository-ppa:ondrej/php5-oldstable') - } - end - - describe 'when called with parameter oldstable' do - let(:facts) {{ - :osfamily => 'Debian', - :osfamily => 'Debian', - :operatingsystem => 'Ubuntu', - :lsbdistid => 'Ubuntu', - :lsbdistcodename => 'trusty' - }} - let(:params) {{ - :oldstable => true - }} - - it { - should contain_exec('add-apt-repository-ppa:ondrej/php5-oldstable') - } - end - - describe 'when call with parameter ppa without prefix "ppa:"' do - let(:facts) {{ - :osfamily => 'Debian', - :operatingsystem => 'Ubuntu', - :lsbdistid => 'Ubuntu', - :lsbdistcodename => 'trusty' - }} - let(:params) {{ - :ppa => 'ondrej/php5-5.6' - }} - - it { - should contain_exec('add-apt-repository-ppa:ondrej/php5-5.6') - } - end - - describe 'when call with parameter ppa and oldstable' do - let(:facts) {{ - :osfamily => 'Debian', - :operatingsystem => 'Ubuntu', - :lsbdistid => 'Ubuntu', - :lsbdistcodename => 'trusty' - }} - let(:params) {{ - :oldstable => true, - :ppa => 'ondrej/php5-5.6' - }} - - it { expect { should raise_error(Puppet::Error) }} + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + + case facts[:lsbdistcodename] + when 'trusty' + describe 'when called with no parameters on Ubuntu trusty' do + it { + should contain_exec('add-apt-repository-ppa:ondrej/php5') + } + end + + describe 'when called with parameter oldstable on Ubuntu trusty' do + let(:params) {{ + :oldstable => true + }} + it { + should contain_exec('add-apt-repository-ppa:ondrej/php5-oldstable') + } + end + + describe 'when call with parameter ppa without prefix "ppa:" on Ubuntu trusty' do + let(:params) {{ + :ppa => 'ondrej/php5-5.6' + }} + it { + should contain_exec('add-apt-repository-ppa:ondrej/php5-5.6') + } + end + + describe 'when call with parameter ppa and oldstable on Ubuntu trusty' do + let(:params) {{ + :oldstable => true, + :ppa => 'ondrej/php5-5.6' + }} + it { expect { should raise_error(Puppet::Error) }} + end + + when 'precise' + describe 'when called with no parameters on Ubuntu precise' do + it { + should contain_exec('add-apt-repository-ppa:ondrej/php5-oldstable') + } + end + end + end end -end +end \ No newline at end of file diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index 01bdcd69..2b339965 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -1,60 +1,61 @@ require 'spec_helper' describe 'php', :type => :class do - let(:facts) { { :osfamily => 'Debian', - :lsbdistid => 'Debian', - :operatingsystem => 'Debian', - :path => '/usr/local/bin:/usr/bin:/bin' } } + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end - describe 'when called with no parameters on Debian' do - it { - should contain_package('php5-cli').with({ - 'ensure' => 'present', - }) - should contain_class('php::fpm') - should contain_package('php5-fpm').with({ - 'ensure' => 'present', - }) - should contain_package('php5-dev').with({ - 'ensure' => 'present', - }) - should contain_package('php-pear').with({ - 'ensure' => 'present', - }) - should contain_class('php::composer') - } - end - - describe 'when called with no parameters on Suse' do - let(:facts) { { :osfamily => 'Suse', - :operatingsystem => 'SLES', - :path => '/usr/local/bin:/usr/bin:/bin' } } - it { - should contain_package('php5').with({ - 'ensure' => 'present', - }) - should contain_package('php5-devel').with({ - 'ensure' => 'present', - }) - should contain_package('php5-pear').with({ - 'ensure' => 'present', - }) - should_not contain_package('php5-cli') - should_not contain_package('php5-dev') - should_not contain_package('php-pear') - } - end + describe 'when called with no parameters' do + case facts[:osfamily] + when 'Debian' + it { + should contain_class('php::fpm') + should contain_package('php5-cli').with({ + 'ensure' => 'present', + }) + should contain_package('php5-fpm').with({ + 'ensure' => 'present', + }) + should contain_package('php5-dev').with({ + 'ensure' => 'present', + }) + should contain_package('php-pear').with({ + 'ensure' => 'present', + }) + should contain_class('php::composer') + } + when 'Suse' + it { + should contain_package('php5').with({ + 'ensure' => 'present', + }) + should contain_package('php5-devel').with({ + 'ensure' => 'present', + }) + should contain_package('php5-pear').with({ + 'ensure' => 'present', + }) + should_not contain_package('php5-cli') + should_not contain_package('php5-dev') + should_not contain_package('php-pear') + } + end + end - describe 'when fpm is disabled' do - let(:params) { { :fpm => false, } } - it { - should_not contain_class('php::fpm') - } - end - describe 'when composer is disabled' do - let(:params) { { :composer => false, } } - it { - should_not contain_class('php::composer') - } + describe 'when fpm is disabled' do + let(:params) { { :fpm => false, } } + it { + should_not contain_class('php::fpm') + } + end + describe 'when composer is disabled' do + let(:params) { { :composer => false, } } + it { + should_not contain_class('php::composer') + } + end + end end end diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index 16c6f48d..1e8536a7 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -1,46 +1,50 @@ require 'spec_helper' describe 'php::config' do - let(:facts) { { :osfamily => 'Debian', - :path => '/usr/local/bin:/usr/bin:/bin' } } - - context 'default config' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => {} - }} - end - - context 'simple example' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => { - 'apc.enabled' => 1 - } - }} - - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} - end - - context 'empty array' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => {} - }} - - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} - end - - context 'invalid config (string)' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => 'hello world' - }} - - it { expect { should raise_error(Puppet::Error) }} + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + context 'default config' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => {} + }} + end + + context 'simple example' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => { + 'apc.enabled' => 1 + } + }} + + it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} + end + + context 'empty array' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => {} + }} + + it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} + end + + context 'invalid config (string)' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => 'hello world' + }} + + it { expect { should raise_error(Puppet::Error) }} + end + end end -end +end \ No newline at end of file diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 0d5a502a..23ac5382 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -1,163 +1,176 @@ require 'spec_helper' describe 'php::extension' do - let(:facts) { { :osfamily => 'Debian', - :path => '/usr/local/bin:/usr/bin:/bin' } } - let(:pre_condition) { 'include php::params' } - - context 'installation from repository' do - let(:title) { 'json' } - let(:params) {{ - :package_prefix => 'php5-', - :settings => { - 'test' => 'foo' - } - }} - - it { - should contain_package('php5-json') - should contain_php__config('json').with({ - :file => '/etc/php5/mods-available/json.ini', - :config => { - 'test' => 'foo' - }, - }) - } + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + let(:pre_condition) { 'include php::params' } + + unless (facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD') # FIXME - something is wrong on these + case facts[:osfamily] + when 'Debian' + etcdir = '/etc/php5/mods-available' + else + etcdir = '/etc/php.d' + end + + context 'installation from repository' do + let(:title) { 'json' } + let(:params) {{ + :package_prefix => 'php5-', + :settings => { + 'test' => 'foo' + } + }} + + it { + should contain_package('php5-json') + should contain_php__config('json').with({ + :file => "#{etcdir}/json.ini", + :config => { + 'test' => 'foo' + }, + }) + } + end + + context 'add settings prefix if requested' do + let(:title) {'json' } + let(:params) {{ + :name => 'json', + :settings_prefix => true, + :settings => { + 'test' => 'foo' + } + }} + + it { + should contain_php__config('json').with({ + :config => { + 'json.test' => 'foo' + } + }) + } + end + + context 'use specific settings prefix if requested' do + let(:title) {'json' } + let(:params) {{ + :name => 'json', + :settings_prefix => 'bar', + :settings => { + 'test' => 'foo' + } + }} + + it { + should contain_php__config('json').with({ + :config => { + 'bar.test' => 'foo' + } + }) + } + end + + context 'non-pecl extensions cannot be configured as zend' do + let(:title) { 'xdebug' } + let(:params) {{ + :zend => true, + }} + + it { expect { should raise_error(Puppet::Error) }} + end + + context 'pecl extensions can be configured as zend' do + let(:title) { 'xdebug' } + let(:params) {{ + :provider => 'pecl', + :zend => true + }} + + it { + should contain_php__config('xdebug').with({ + :config => { + 'zend_extension' => 'xdebug.so' + } + }) + } + end + + context 'pecl extensions support so_name' do + let(:title) { 'zendopcache' } + let(:params) {{ + :provider => 'pecl', + :zend => true, + :so_name => 'opcache', + }} + + it { + should contain_php__config('zendopcache').with({ + :file => "#{etcdir}/opcache.ini", + :config => { + 'zend_extension' => 'opcache.so' + }, + }) + } + end + + context 'pecl extensions support php_api_version' do + let(:title) { 'xdebug' } + let(:params) {{ + :provider => 'pecl', + :zend => true, + :php_api_version => '20100525', + }} + + it { + should contain_php__config('xdebug').with({ + :config => { + 'zend_extension' => '/usr/lib/php5/20100525/xdebug.so' + } + }) + } + end + + case facts[:osfamily] + when 'Debian' + context 'on Debian' do + let(:title) { 'xdebug' } + + it { + should contain_php__config('xdebug').with({ + :file => '/etc/php5/mods-available/xdebug.ini', + }) + } + context 'pecl installation' do + let(:title) { 'json' } + let(:params) {{ + :provider => 'pecl', + :header_packages => ['libmemcached-dev'], + :name => 'nice_name', + :settings => { + 'test' => 'foo' + } + }} + + it { + should contain_package('pecl-json') + should contain_package('libmemcached-dev') + should contain_package('build-essential') + should contain_php__config('json').with({ + :file => "#{etcdir}/json.ini", + :config => { + 'extension' => 'nice_name.so', + 'test' => 'foo' + }, + }) + } + end + end + end + end + end end - - context 'add settings prefix if requested' do - let(:title) {'json' } - let(:params) {{ - :name => 'json', - :settings_prefix => true, - :settings => { - 'test' => 'foo' - } - }} - - it { - should contain_php__config('json').with({ - :config => { - 'json.test' => 'foo' - } - }) - } - end - - context 'use specific settings prefix if requested' do - let(:title) {'json' } - let(:params) {{ - :name => 'json', - :settings_prefix => 'bar', - :settings => { - 'test' => 'foo' - } - }} - - it { - should contain_php__config('json').with({ - :config => { - 'bar.test' => 'foo' - } - }) - } - end - - context 'non-pecl extensions cannot be configured as zend' do - let(:title) { 'xdebug' } - let(:params) {{ - :zend => true, - }} - - it { expect { should raise_error(Puppet::Error) }} - end - - context 'pecl installation' do - let(:title) { 'json' } - let(:params) {{ - :provider => 'pecl', - :header_packages => ['libmemcached-dev'], - :name => 'nice_name', - :settings => { - 'test' => 'foo' - } - }} - - it { - should contain_package('pecl-json') - should contain_package('libmemcached-dev') - should contain_package('build-essential') - should contain_php__config('json').with({ - :file => '/etc/php5/mods-available/json.ini', - :config => { - 'extension' => 'nice_name.so', - 'test' => 'foo' - }, - }) - } - end - - context 'pecl extensions can be configured as zend' do - let(:title) { 'xdebug' } - let(:params) {{ - :provider => 'pecl', - :zend => true - }} - - it { - should contain_php__config('xdebug').with({ - :config => { - 'zend_extension' => 'xdebug.so' - } - }) - } - end - - context 'pecl extensions support so_name' do - let(:title) { 'zendopcache' } - let(:params) {{ - :provider => 'pecl', - :zend => true, - :so_name => 'opcache', - }} - - it { - should contain_php__config('zendopcache').with({ - :file => '/etc/php5/mods-available/opcache.ini', - :config => { - 'zend_extension' => 'opcache.so' - }, - }) - } - end - - context 'pecl extensions support php_api_version' do - let(:title) { 'xdebug' } - let(:params) {{ - :provider => 'pecl', - :zend => true, - :php_api_version => '20100525', - }} - - it { - should contain_php__config('xdebug').with({ - :config => { - 'zend_extension' => '/usr/lib/php5/20100525/xdebug.so' - } - }) - } - end - - context 'on Debian' do - let(:facts) { { - :osfamily => 'Debian', - } } - let(:title) { 'xdebug' } - - it { - should contain_php__config('xdebug').with({ - :file => '/etc/php5/mods-available/xdebug.ini', - }) - } - end -end +end \ No newline at end of file diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index da5ea9ce..750525c6 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -1,12 +1,20 @@ require 'spec_helper' describe 'php::fpm::pool' do - let(:facts) { { :osfamily => 'Debian' } } + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + case facts[:osfamily] + when 'Debian' + context 'plain config' do + let(:title) { 'unique-name' } + let(:params) {{ }} - context 'plain config' do - let(:title) { 'unique-name' } - let(:params) {{ }} - - it { should contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } + it { should contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } + end + end + end end -end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2c6f5664..1ae4d589 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1,4 @@ require 'puppetlabs_spec_helper/module_spec_helper' + +require 'rspec-puppet-facts' +include RspecPuppetFacts \ No newline at end of file From f45e1d5d8cb6e248ff1dfdb1d237f9561827cfad Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Fri, 4 Dec 2015 13:46:08 +0100 Subject: [PATCH 010/221] test Ruby 2.2 and Puppet 4 --- .travis.yml | 3 +++ metadata.json | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ce48595b..7f9c79a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ rvm: - 1.9.3 env: matrix: + - PUPPET_VERSION=4.3.1 - PUPPET_VERSION=3.8.4 - PUPPET_VERSION=3.8.4 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes global: @@ -17,6 +18,8 @@ matrix: include: - rvm: 2.1.6 env: PUPPET_VERSION=3.8.4 DOCS=true + - rvm: 2.2.3 + env: PUPPET_VERSION=4.3.1 after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && diff --git a/metadata.json b/metadata.json index 5da4746e..1a609be0 100644 --- a/metadata.json +++ b/metadata.json @@ -16,8 +16,8 @@ { "name": "example42/yum", "version_requirement": "2.x" } ], "requirements": [ - { "name": "puppet", "version_requirement": "3.x" }, - { "name": "pe", "version_requirement": "3.x" } + { "name": "puppet", "version_requirement": ">= 3.0.0 < 5.0.0" }, + { "name": "pe", "version_requirement": ">= 3.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "Ubuntu", From dc759f83489e92f822420749c373c38d22091667 Mon Sep 17 00:00:00 2001 From: Prachetas Prabhu Date: Fri, 4 Dec 2015 19:19:17 -0500 Subject: [PATCH 011/221] Fixes pecl provider for newer versions of PEAR: - Discards header lines of the output of pecl list that are emphasized with coloration - Pecl does case-insensitive searches so downcases pecl package names to always match --- lib/puppet/provider/package/pecl.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 3f1a5176..89156008 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -58,12 +58,13 @@ def self.peclsplit(desc) when /No packages installed from channel/i then return nil when /^=/ then return nil when /^PACKAGE/ then return nil + when /\[1m/ then return nil # Newer versions of PEAR use colorized output when /^(\S+)\s+(\S+)\s+\S+/ then name = $1 version = $2 return { - :name => "pecl-#{name}", + :name => "pecl-#{name.downcase}", :ensure => version } else @@ -79,7 +80,7 @@ def self.instances end def peclname - self.name.sub('pecl-', '') + self.name.sub('pecl-', '').downcase end def install(useversion = true) From 52c1c8a9a79c359783fc82a17e59d9629f47ce80 Mon Sep 17 00:00:00 2001 From: Tom Llewellyn-Smith Date: Thu, 10 Dec 2015 15:02:18 +0000 Subject: [PATCH 012/221] add details of PPA override --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 47ae64f4..83cd8abd 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,12 @@ older though still supported distribution release. Our default is to have Ubuntu with packages for the current stable PHP version closely tracking upstream. +To use an alternate PPA, Ondrej's PHP 5.6 for example, use the below hiera snippet +```yaml +php::repo::ubuntu::ppa: 'ondrej/php5-5.6' +php::manage_repos: true +``` + ### Apache support Apache with `mod_php` is not supported by this module. Please use From 6c1e69e85f9aca4288e9d887eb3b58194e60ff0f Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Thu, 10 Dec 2015 17:36:50 +0100 Subject: [PATCH 013/221] phpversion fact: Don't output errors of php is not found Fixes #134. --- lib/facter/phpversion.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/facter/phpversion.rb b/lib/facter/phpversion.rb index 6f4b6ece..1460adb0 100644 --- a/lib/facter/phpversion.rb +++ b/lib/facter/phpversion.rb @@ -1,7 +1,10 @@ Facter.add(:phpversion) do setcode do - Facter::Util::Resolution.exec('php -v'). - split("\n").first.split(' '). - select { |x| x =~ /^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)/ }.first + output = Facter::Util::Resolution.exec('php -v') + + unless output.nil? + output.split("\n").first.split(' '). + select { |x| x =~ /^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)/ }.first + end end end From b4e8f83d01fd30bdd2f4a07b1cbb91dbb860355d Mon Sep 17 00:00:00 2001 From: steev Date: Sun, 13 Dec 2015 23:55:52 +0000 Subject: [PATCH 014/221] temp fix for automation --- manifests/repo/redhat.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index c2321fc5..66189c22 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -10,4 +10,5 @@ $yum_repo = 'remi_php56', ) { contain "::yum::repo::${yum_repo}" + contain "::yum::repo::remi" } From 54795216fa6fbc9a269451b7c552e0869cf946e0 Mon Sep 17 00:00:00 2001 From: Steve Power Date: Mon, 14 Dec 2015 15:54:10 +0000 Subject: [PATCH 015/221] replaced double quotes with single quotes --- manifests/repo/redhat.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index 66189c22..5885a593 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -10,5 +10,5 @@ $yum_repo = 'remi_php56', ) { contain "::yum::repo::${yum_repo}" - contain "::yum::repo::remi" + contain '::yum::repo::remi' } From f246596ecb9311c1238e11fa9ceba03f36aed2b0 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Wed, 16 Dec 2015 17:22:35 +0100 Subject: [PATCH 016/221] add .puppet-lint.rc --- .puppet-lint.rc | 3 +++ Rakefile | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 .puppet-lint.rc diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 00000000..50816ba3 --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,3 @@ +--fail-on-warnings +--no-80chars-check +--no-class_inherits_from_params_class-check diff --git a/Rakefile b/Rakefile index 79086eed..30c6bcd9 100644 --- a/Rakefile +++ b/Rakefile @@ -8,9 +8,6 @@ PuppetLint::RakeTask.new :lint do |config| config.fail_on_warnings = true end -PuppetLint.configuration.relative = true -PuppetLint.configuration.send('disable_class_inherits_from_params_class') - task :default => [:metadata, :lint, :spec] task :metadata do From 4d476dc3c771c32ec92d23d8d4b3c439f54c2c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Garc=C3=ADa?= Date: Mon, 14 Dec 2015 10:35:37 +0100 Subject: [PATCH 017/221] Adds support for PHP7, closes GH-146 Fixes non-overridable paths Added validations and isolated fpm pool base dir - Added validations for new path parameters - `$::php::fpm::pool::base_dir` is now mapped internally to another variable, taking first the value of `$::php::fpm::pool::base_dir` when provided, then inheriting from `$::php::fpm::config::pool_base_dir` when the class `$::php::fpm::config` has been instantiated, and finally inheriting from `$::php::params::fpm_pool_dir` if not provided and not instantiated. Change variable assignment logic Replaces ternaries and fixes misbehaviour Converts LFCR to LF and fixes test Replacement of ternaries with pick_default --- manifests/extension.pp | 9 ++++++--- manifests/fpm/pool.pp | 15 +++++++++++++-- manifests/init.pp | 25 +++++++++++++++++++++++++ manifests/params.pp | 18 +++++++++++++----- spec/defines/extension_spec.rb | 2 +- 5 files changed, 58 insertions(+), 11 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index 39362a50..d32fcf00 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -168,18 +168,21 @@ } } + $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) ::php::config { $title: - file => "${::php::params::config_root_ini}/${lowercase_title}.ini", + file => "${config_root_ini}/${lowercase_title}.ini", config => $final_settings, } # Ubuntu/Debian systems use the mods-available folder. We need to enable # settings files ourselves with php5enmod command. + $ext_tool_enable = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable) + $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) if $::osfamily == 'Debian' { - $cmd = "/usr/sbin/php5enmod ${lowercase_title}" + $cmd = "${ext_tool_enable} ${lowercase_title}" exec { $cmd: - unless => "/usr/sbin/php5query -s cli -m ${lowercase_title}", + unless => "${ext_tool_query} -s cli -m ${lowercase_title}", require =>::Php::Config[$title], } diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index 1ce42d37..315b1309 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -98,6 +98,11 @@ # [*php_directives*] # List of custom directives that are appended to the pool config # +# [*base_dir*] +# The folder that contains the php-fpm pool configs. This defaults to a +# sensible default depending on your operating system, like +# '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d' +# define php::fpm::pool ( $ensure = 'present', $listen = '127.0.0.1:9000', @@ -138,10 +143,15 @@ $php_admin_flag = {}, $php_directives = [], $root_group = $::php::params::root_group, + $base_dir = undef, ) { include ::php::params + if $base_dir != undef { + validate_absolute_path($base_dir) + } + $pool = $title # Hack-ish to default to user for group too @@ -154,13 +164,14 @@ default => $::php::fpm::package, } + $pool_base_dir = pick_default($base_dir, $::php::fpm::config::pool_base_dir, $::php::params::fpm_pool_dir) if ($ensure == 'absent') { - file { "${::php::params::fpm_pool_dir}/${pool}.conf": + file { "${pool_base_dir}/${pool}.conf": ensure => absent, notify => Class['::php::fpm::service'], } } else { - file { "${::php::params::fpm_pool_dir}/${pool}.conf": + file { "${pool_base_dir}/${pool}.conf": ensure => file, notify => Class['::php::fpm::service'], require => Package[$real_package], diff --git a/manifests/init.pp b/manifests/init.pp index ac6aaefd..6c76f60a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,6 +33,19 @@ # to a sensible default depending on your operating system, like 'php-' or # 'php5-'. # +# [*config_root_ini*] +# This is the path to the config .ini files of the extensions. This defaults +# to a sensible default depending on your operating system, like +# '/etc/php5/mods-available' or '/etc/php5/conf.d'. +# +# [*$ext_tool_enable*] +# Absolute path to php tool for enabling extensions in debian/ubuntu systems. +# This defaults to '/usr/sbin/php5enmod'. +# +# [*$ext_tool_query*] +# Absolute path to php tool for querying information about extensions in +# debian/ubuntu systems. This defaults to '/usr/sbin/php5query'. +# class php ( $ensure = $::php::params::ensure, $manage_repos = $::php::params::manage_repos, @@ -46,6 +59,9 @@ $extensions = {}, $settings = {}, $package_prefix = $::php::params::package_prefix, + $config_root_ini = $::php::params::config_root_ini, + $ext_tool_enable = $::php::params::ext_tool_enable, + $ext_tool_query = $::php::params::ext_tool_query, ) inherits ::php::params { validate_string($ensure) @@ -59,6 +75,15 @@ validate_bool($phpunit) validate_hash($extensions) validate_hash($settings) + if $config_root_ini != undef { + validate_absolute_path($config_root_ini) + } + if $ext_tool_enable != undef { + validate_absolute_path($ext_tool_enable) + } + if $ext_tool_query != undef { + validate_absolute_path($ext_tool_query) + } # Deep merge global php settings $real_settings = deep_merge($settings, hiera_hash('php::settings', {})) diff --git a/manifests/params.pp b/manifests/params.pp index 1e2b1e49..e2e31ee9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,6 +1,12 @@ # PHP params class # -class php::params { +class php::params( + $cfg_root = undef, +) { + + if $cfg_root != undef { + validate_absolute_path($cfg_root) + } $ensure = 'present' $fpm_service_enable = true @@ -15,8 +21,8 @@ case $::osfamily { 'Debian': { - $config_root = '/etc/php5' - $config_root_ini = "${::php::params::config_root}/mods-available" + $config_root = pick($cfg_root, '/etc/php5') + $config_root_ini = "${config_root}/mods-available" $common_package_names = [] $common_package_suffixes = ['cli', 'common'] $cli_inifile = "${config_root}/cli/php.ini" @@ -35,6 +41,8 @@ $package_prefix = 'php5-' $compiler_packages = 'build-essential' $root_group = 'root' + $ext_tool_enable = '/usr/sbin/php5enmod' + $ext_tool_query = '/usr/sbin/php5query' case $::operatingsystem { 'Debian': { @@ -52,7 +60,7 @@ } 'Suse': { - $config_root = '/etc/php5' + $config_root = pick($cfg_root, '/etc/php5') $config_root_ini = "${config_root}/conf.d" $common_package_names = ['php5'] $common_package_suffixes = [] @@ -107,7 +115,7 @@ $root_group = 'root' } 'FreeBSD': { - $config_root = '/usr/local/etc' + $config_root = pick($cfg_root, '/usr/local/etc') $config_root_ini = "${config_root}/php" # No common packages, because the required PHP base package will be # pulled in as a dependency. This preserves the ability to choose diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 23ac5382..27d4de11 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -141,7 +141,7 @@ it { should contain_php__config('xdebug').with({ - :file => '/etc/php5/mods-available/xdebug.ini', + :file => "#{etcdir}/xdebug.ini", }) } context 'pecl installation' do From 601199f3c99b264a310da8ef6ea5a39af4ea063a Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Fri, 18 Dec 2015 17:44:35 +0100 Subject: [PATCH 018/221] change supported Puppet versions closes GH-129 --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 1a609be0..dc99d4d4 100644 --- a/metadata.json +++ b/metadata.json @@ -16,8 +16,8 @@ { "name": "example42/yum", "version_requirement": "2.x" } ], "requirements": [ - { "name": "puppet", "version_requirement": ">= 3.0.0 < 5.0.0" }, - { "name": "pe", "version_requirement": ">= 3.0.0" } + { "name": "puppet", "version_requirement": ">= 3.3.0 < 5.0.0" }, + { "name": "pe", "version_requirement": ">= 3.3.0" } ], "operatingsystem_support": [ { "operatingsystem": "Ubuntu", From 2da2d228a6e99b85473db65cf170c547733904ba Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Mon, 4 Jan 2016 11:32:29 +0100 Subject: [PATCH 019/221] Fix documentation for php::ensure This was changed to "present" in d4785f65e10520b3cf2c30c850a9b2eaceb1d726 --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 6c76f60a..b037a302 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,7 +4,7 @@ # === Parameters # # [*ensure*] -# Specify which version of PHP packages to install, defaults to 'latest'. +# Specify which version of PHP packages to install, defaults to 'present'. # Please note that 'absent' to remove packages is not supported! # # [*manage_repos*] From 5d82be9cd93f93f7036c4bf4d2eb0915e7623c7a Mon Sep 17 00:00:00 2001 From: Ryan Kennedy Date: Mon, 11 Jan 2016 14:50:23 -0800 Subject: [PATCH 020/221] added condition to pear.pp for Amazon linux to prevent error if package_prefix is specified --- manifests/pear.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifests/pear.pp b/manifests/pear.pp index 04d83c57..f84819f3 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -23,6 +23,11 @@ # Debian is a litte stupid: The pear package is called 'php-pear' # even though others are called 'php5-fpm' or 'php5-dev' $package_name = "php-${::php::params::pear_package_suffix}" + } elsif $::operatingsystem == 'Amazon' { + # On Amazon Linux the package name is also just 'php-pear'. + # This would normally not be problematic but if you specify a + # package_prefix other than 'php' then it will fail. + $package_name = "php-${::php::params::pear_package_suffix}" } elsif $::osfamily == 'FreeBSD' { # On FreeBSD the package name is just 'pear'. $package_name = $::php::params::pear_package_suffix From e1c38c2f3411ab5c4f085e0e10b60e4761460bd3 Mon Sep 17 00:00:00 2001 From: "Sean S. King" Date: Sat, 28 Nov 2015 02:19:24 -0500 Subject: [PATCH 021/221] Adding examples of Puppet DSL code, and curtailing Hiera examples --- README.md | 164 ++++++++++++++++++++++++++++++++------------------ metadata.json | 2 +- 2 files changed, 108 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 47ae64f4..385c6ed2 100644 --- a/README.md +++ b/README.md @@ -4,37 +4,35 @@ [![Build Status](https://travis-ci.org/mayflower/puppet-php.svg?branch=master)](https://travis-ci.org/mayflower/puppet-php) mayflower/php is a Puppet module for managing PHP with a strong focus -on php-fpm. We strive to support all recent versions of Debian, Ubuntu, -RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache with `mod_php` -is not supported. +on php-fpm. The module aims to use sane defaults for the supported +architectures. We strive to support all recent versions of Debian, +Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache +with `mod_php` is not supported. This originally was a fork of [jippi/puppet-php](https://github.com/jippi/puppet-php) (nodes-php on Puppet Forge) but has since been rewritten in large parts. ## Usage -The module aims to use sane defaults for the supported architectures. You -must use hiera to configure most aspects of this module in a simple way. - -The recommended way is to include the `php` main class in your manifests: +Quickest way to get started is simply `include`'ing the _`php` class_. ```puppet -include ::php +include '::php' ``` -You can configure the module through hiera. Here are the defaults for some -parameters as you would specify them in hiera: +Or, you can override defaults and specify additional custom +configurations by declaring `class { '::php': }` with parameters: -```yaml -php::ensure: latest -php::manage_repos: true -php::fpm: true -php::dev: true -php::composer: true -php::pear: true -php::phpunit: false -php::fpm::config::log_level: notice -php::composer::auto_update: true +```puppet +class { '::php': + ensure => latest, + manage_repos => true, + fpm => true, + dev => true, + composer => true, + pear => true, + phpunit => false, +} ``` There are more configuration options available. Please refer to the @@ -42,68 +40,120 @@ auto-generated documention at http://php.puppet.mayflower.de/. ### Defining `php.ini` settings -PHP configuration parmaters in `php.ini` files can be defined as parameter -`settings` on the `php`, `php::fpm` and `php::cli` classes or -`php::extension` resources for each component independently. +PHP configuration parameters in `php.ini` files can be defined as parameter +`settings` on the main `php` class, or `php::fpm` / `php::cli` classes, +or `php::extension` resources for each component independently. These settings are written into their respective `php.ini` file. Global settings in `php::settings` are merged with the settings of all components. Please note that settings of extensions are always independent. -In the following example the timezone will be set in the PHP cli application -and all php-fpm pools. +In the following example the PHP options and timezone will be set in +all PHP configurations, i.e. the PHP cli application and all php-fpm pools. -```yaml -php::settings: - Date/date.timezone: Europe/Berlin -php::cli::settings: - PHP/memory_limit: 512M -php::fpm::settings: - PHP/short_open_tag: 'On' +```puppet + class { '::php': + settings => { + 'PHP/max_execution_time' => '90', + 'PHP/max_input_time' => '300', + 'PHP/memory_limit' => '64M', + 'PHP/post_max_size' => '32M', + 'PHP/upload_max_filesize' => '32M', + 'Date/date.timezone' => 'Europe/Berlin', + }, + } ``` ### Installing extensions -Extensions can be installed and configured by defining the hash -`php::extensions` in hiera. They are activated for all activated SAPIs. +PHP configuration parameters in `php.ini` files can be defined +as parameter `extensions` on the main `php` class. They are +activated for all activated SAPIs. -```yaml -php::extensions: - json: {} - mysql: {} - memcached: - provider: pecl - header_packages: - - libmemcached-dev - apc: - package_prefix: php- - settings: - apc.stat: 1 - apc.stat_ctime: 1 +```puppet + class { '::php': + extensions => { + bcmath => { }, + imagick => { + provider => pecl, + }, + xmlrpc => { }, + memcached => { + provider => 'pecl', + header_packages => [ 'libmemcached-devel', ], + }, + apc => { + provider => 'pecl', + settings => { + 'apc/stat' => '1', + 'apc/stat_ctime' => '1', + }, + }, + + }, + } ``` See [the documentation](http://php.puppet.mayflower.de/php/extension.html) -of the `php::extension` resource for all available parmeters and default +of the `php::extension` resource for all available parameters and default values. ### Defining php-fpm pools If different php-fpm pools are required, you can use `php::fpm::pool` -resources. Use the parameter `$pools` from the class `php::fpm` to define -`php::fpm::pool` resources as a hash from hiera. - -If not defined in your hiera data, a single pool called `www` will be -configured by default: +defined resource type. A single pool called `www` will be configured +by default. Specify additional pools like so: -```yaml -php::fpm::pools: - www: - listen: 127.0.0.1:9000 +```puppet + php::fpm::pool { 'www2': + listen => '127.0.1.1:9000', + } ``` For an overview of all possible parameters for `php::fpm::pool` resources please see [its documention](http://php.puppet.mayflower.de/php/fpm/pool.html). +### Alternative examples using Hiera +Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera. + +Below are all the examples you see above, but defined in YAML format for use with Hiera. + +```yaml +--- +php::ensure: latest +php::manage_repos: true +php::fpm: true +php::dev: true +php::composer: true +php::pear: true +php::phpunit: false +php::settings: + 'PHP/max_execution_time': '90' + 'PHP/max_input_time': '300' + 'PHP/memory_limit': '64M' + 'PHP/post_max_size': '32M' + 'PHP/upload_max_filesize': '32M' + 'Date/date.timezone': 'Europe/Berlin' +php::extensions: + bcmath: {} + xmlrpc: {} + imagick: + provider: pecl + memcached: + provider: pecl + header_packages: + - libmemcached-dev + apc: + provider: pecl + settings: + 'apc/stat': 1 + 'apc/stat_ctime': 1 +php::fpm::pool: + www2: + listen: '127.0.1.1:9000' +``` + + ## Notes ### Debian squeeze & Ubuntu precise come with PHP 5.3 diff --git a/metadata.json b/metadata.json index 6c04d102..ec6fdd1b 100644 --- a/metadata.json +++ b/metadata.json @@ -7,7 +7,7 @@ "source": "https://github.com/mayflower/puppet-php", "project_page": "http://php.puppet.mayflower.de/", "issues_url": "https://github.com/mayflower/puppet-php/issues", - "description": "Puppet module that aims to manage PHP and extensions in a generic way on many platforms with sane defaults and easy, hiera-centric configuration", + "description": "Puppet module that aims to manage PHP and extensions in a generic way on many platforms with sane defaults and easy configuration", "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.2.0 < 5.0.0" }, { "name": "puppetlabs/apt", "version_requirement": ">= 1.8.0 < 3.0.0" }, From 4e42d885239f7d8eb5de6bc07273bdb5bcb80922 Mon Sep 17 00:00:00 2001 From: Andre Keller Date: Mon, 8 Feb 2016 18:36:39 +0100 Subject: [PATCH 022/221] Make it possible to enable/disable the fpm service. --- manifests/fpm.pp | 31 +++++++++++++++++++++------- manifests/fpm/service.pp | 2 +- manifests/init.pp | 44 ++++++++++++++++++++++++---------------- manifests/params.pp | 1 + 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index bbb4db36..67af3a69 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -2,6 +2,12 @@ # # === Parameters # +# [*service_enable*] +# Enable/disable FPM service +# +# [*service_ensure*] +# Ensure FPM service is either 'running' or 'stopped' +# # [*pools*] # Hash of php::fpm::pool resources that will be created. Defaults # to a single php::fpm::pool named www with default parameters. @@ -9,11 +15,13 @@ # FIXME # class php::fpm ( - $ensure = $::php::ensure, - $package = "${::php::package_prefix}${::php::params::fpm_package_suffix}", - $inifile = $::php::params::fpm_inifile, - $settings = {}, - $pools = { 'www' => {} }, + $ensure = $::php::ensure, + $service_ensure = $::php::params::fpm_service_ensure, + $service_enable = $::php::params::fpm_service_enable, + $package = "${::php::package_prefix}${::php::params::fpm_package_suffix}", + $inifile = $::php::params::fpm_inifile, + $settings = {}, + $pools = { 'www' => {} }, ) inherits ::php::params { if $caller_module_name != $module_name { @@ -44,7 +52,10 @@ inifile => $inifile, settings => $real_settings, } -> - class { '::php::fpm::service': } -> + class { '::php::fpm::service': + ensure => $service_ensure, + enable => $service_enable, + } -> anchor { '::php::fpm::end': } $real_pools = hiera_hash('php::fpm::pools', $pools) @@ -54,8 +65,14 @@ # upstart version supports this if $::osfamily == 'Debian' and ($::lsbdistcodename == 'trusty' or $::lsbdistcodename == 'utopic') { + 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 => 'reload signal USR2', + content => $fpm_override, before => Package[$real_package], } } diff --git a/manifests/fpm/service.pp b/manifests/fpm/service.pp index c327ffa6..62aac44b 100644 --- a/manifests/fpm/service.pp +++ b/manifests/fpm/service.pp @@ -13,7 +13,7 @@ # class php::fpm::service( $service_name = $::php::params::fpm_service_name, - $ensure = 'running', + $ensure = $::php::params::fpm_service_ensure, $enable = $::php::params::fpm_service_enable, ) inherits ::php::params { diff --git a/manifests/init.pp b/manifests/init.pp index b037a302..b1d42196 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,6 +13,12 @@ # [*fpm*] # Install and configure php-fpm # +# [*fpm_service_enable*] +# Enable/disable FPM service +# +# [*fpm_service_ensure*] +# Ensure FPM service is either 'running' or 'stopped' +# # [*dev*] # Install php header files, needed to install pecl modules # @@ -47,21 +53,23 @@ # debian/ubuntu systems. This defaults to '/usr/sbin/php5query'. # class php ( - $ensure = $::php::params::ensure, - $manage_repos = $::php::params::manage_repos, - $fpm = true, - $embedded = false, - $dev = true, - $composer = true, - $pear = true, - $pear_ensure = $::php::params::pear_ensure, - $phpunit = false, - $extensions = {}, - $settings = {}, - $package_prefix = $::php::params::package_prefix, - $config_root_ini = $::php::params::config_root_ini, - $ext_tool_enable = $::php::params::ext_tool_enable, - $ext_tool_query = $::php::params::ext_tool_query, + $ensure = $::php::params::ensure, + $manage_repos = $::php::params::manage_repos, + $fpm = true, + $fpm_service_enable = $::php::params::fpm_service_enable, + $fpm_service_ensure = $::php::params::fpm_service_ensure, + $embedded = false, + $dev = true, + $composer = true, + $pear = true, + $pear_ensure = $::php::params::pear_ensure, + $phpunit = false, + $extensions = {}, + $settings = {}, + $package_prefix = $::php::params::package_prefix, + $config_root_ini = $::php::params::config_root_ini, + $ext_tool_enable = $::php::params::ext_tool_enable, + $ext_tool_query = $::php::params::ext_tool_query, ) inherits ::php::params { validate_string($ensure) @@ -106,7 +114,9 @@ if $fpm { Anchor['php::begin'] -> class { '::php::fpm': - settings => $real_settings, + service_enable => $fpm_service_enable, + service_ensure => $fpm_service_ensure, + settings => $real_settings, } -> Anchor['php::end'] } @@ -115,7 +125,7 @@ # Both fpm and embeded SAPIs are using same php.ini fail('Enabling both cli and embedded sapis is not currently supported') } - + Anchor['php::begin'] -> class { '::php::embedded': settings => $real_settings, diff --git a/manifests/params.pp b/manifests/params.pp index e2e31ee9..6dc60128 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -10,6 +10,7 @@ $ensure = 'present' $fpm_service_enable = true + $fpm_service_ensure = 'running' $composer_source = 'https://getcomposer.org/composer.phar' $composer_path = '/usr/local/bin/composer' $composer_max_age = 30 From ef7ce86ca6dd3558db2b003118bf04930c7fb633 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 17 Feb 2016 15:55:00 +0000 Subject: [PATCH 023/221] Added the option to select which user PHP-FPM runs as via the init class --- manifests/fpm.pp | 14 ++++++++++++-- manifests/init.pp | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 67af3a69..afa6fafc 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -12,6 +12,12 @@ # Hash of php::fpm::pool resources that will be created. Defaults # to a single php::fpm::pool named www with default parameters. # +# [*log_owner*] +# The php-fpm log owner +# +# [*log_group*] +# The group owning php-fpm logs +# # FIXME # class php::fpm ( @@ -22,6 +28,8 @@ $inifile = $::php::params::fpm_inifile, $settings = {}, $pools = { 'www' => {} }, + $log_owner = $::php::params::fpm_user, + $log_group = $::php::params::fpm_group ) inherits ::php::params { if $caller_module_name != $module_name { @@ -49,8 +57,10 @@ require => Class['::php::packages'], } -> class { '::php::fpm::config': - inifile => $inifile, - settings => $real_settings, + inifile => $inifile, + settings => $real_settings, + log_owner => $log_owner, + log_group => $log_group, } -> class { '::php::fpm::service': ensure => $service_ensure, diff --git a/manifests/init.pp b/manifests/init.pp index b1d42196..07840277 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,6 +52,13 @@ # Absolute path to php tool for querying information about extensions in # debian/ubuntu systems. This defaults to '/usr/sbin/php5query'. # +# [*log_owner*] +# The php-fpm log owner +# +# [*log_group*] +# The group owning php-fpm logs +# +# class php ( $ensure = $::php::params::ensure, $manage_repos = $::php::params::manage_repos, @@ -70,6 +77,8 @@ $config_root_ini = $::php::params::config_root_ini, $ext_tool_enable = $::php::params::ext_tool_enable, $ext_tool_query = $::php::params::ext_tool_query, + $log_owner = $::php::params::fpm_user, + $log_group = $::php::params::fpm_group, ) inherits ::php::params { validate_string($ensure) @@ -83,6 +92,9 @@ validate_bool($phpunit) validate_hash($extensions) validate_hash($settings) + validate_string($log_owner) + validate_string($log_group) + if $config_root_ini != undef { validate_absolute_path($config_root_ini) } @@ -117,6 +129,8 @@ service_enable => $fpm_service_enable, service_ensure => $fpm_service_ensure, settings => $real_settings, + log_owner => $log_owner, + log_group => $log_group, } -> Anchor['php::end'] } From 7e1c2031cd3f23d03a4ee5d6428f249120d75334 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk Date: Wed, 24 Feb 2016 22:41:00 +0200 Subject: [PATCH 024/221] Enable Override of $fpm_service_name in case of using php7.0 - installing php7.0 fpm service called as 'php7.0-fpm' --- manifests/fpm.pp | 10 ++++++++-- manifests/init.pp | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 67af3a69..05a4a8c6 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -8,6 +8,10 @@ # [*service_ensure*] # Ensure FPM service is either 'running' or 'stopped' # +# [*service_name*] +# This is the name of the php-fpm service. It defaults to reasonable OS +# defaults but can be different in case of using php7.0/other OS/custom fpm service +# # [*pools*] # Hash of php::fpm::pool resources that will be created. Defaults # to a single php::fpm::pool named www with default parameters. @@ -18,6 +22,7 @@ $ensure = $::php::ensure, $service_ensure = $::php::params::fpm_service_ensure, $service_enable = $::php::params::fpm_service_enable, + $service_name = $::php::params::fpm_service_name, $package = "${::php::package_prefix}${::php::params::fpm_package_suffix}", $inifile = $::php::params::fpm_inifile, $settings = {}, @@ -53,8 +58,9 @@ settings => $real_settings, } -> class { '::php::fpm::service': - ensure => $service_ensure, - enable => $service_enable, + ensure => $service_ensure, + enable => $service_enable, + service_name => $service_name, } -> anchor { '::php::fpm::end': } diff --git a/manifests/init.pp b/manifests/init.pp index b1d42196..5c56f99e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,6 +19,10 @@ # [*fpm_service_ensure*] # Ensure FPM service is either 'running' or 'stopped' # +# [*fpm_service_name*] +# This is the name of the php-fpm service. It defaults to reasonable OS +# defaults but can be different in case of using php7.0/other OS/custom fpm service +# # [*dev*] # Install php header files, needed to install pecl modules # @@ -58,6 +62,7 @@ $fpm = true, $fpm_service_enable = $::php::params::fpm_service_enable, $fpm_service_ensure = $::php::params::fpm_service_ensure, + $fpm_service_name = $::php::params::fpm_service_name, $embedded = false, $dev = true, $composer = true, @@ -116,6 +121,7 @@ class { '::php::fpm': service_enable => $fpm_service_enable, service_ensure => $fpm_service_ensure, + service_name => $fpm_service_name, settings => $real_settings, } -> Anchor['php::end'] From edf6006bb8fd0f8da6a674f97049d97a63033f23 Mon Sep 17 00:00:00 2001 From: Vadym Chepkov Date: Wed, 2 Mar 2016 08:08:12 -0500 Subject: [PATCH 025/221] class uses 'pools' hiera key, not 'pool' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 622ce4e6..1b77b5b0 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ php::extensions: settings: 'apc/stat': 1 'apc/stat_ctime': 1 -php::fpm::pool: +php::fpm::pools: www2: listen: '127.0.1.1:9000' ``` From 2659ae29bca50cff26d568d8208b609c411f3d9c Mon Sep 17 00:00:00 2001 From: Mathew Winstone Date: Tue, 17 Nov 2015 16:40:52 -0500 Subject: [PATCH 026/221] feat(global) Add php.ini global settings Fixes #132. --- manifests/global.pp | 33 +++++++++++++++++++++++++++++++++ manifests/init.pp | 7 +++++++ manifests/params.pp | 8 ++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 manifests/global.pp diff --git a/manifests/global.pp b/manifests/global.pp new file mode 100644 index 00000000..f172aa79 --- /dev/null +++ b/manifests/global.pp @@ -0,0 +1,33 @@ +# Install and configure mod_php for fpm +# +# === Parameters +# +# [*inifile*] +# Absolute path to the global php.ini file. Defaults +# to the OS specific default location as defined in params. +# [*settings*] +# Hash of settings to apply to the global php.ini file. +# Defaults to OS specific defaults (i.e. add nothing) +# + +# +class php::global( + $inifile = $::php::params::config_root_inifile, + $settings = {} +) inherits ::php::params { + + if $caller_module_name != $module_name { + warning('php::global is private') + } + + validate_absolute_path($inifile) + validate_hash($settings) + + # No deep merging required since the settings we have are the global settings. + $real_settings = $settings + + ::php::config { 'global': + file => $inifile, + config => $real_settings, + } +} diff --git a/manifests/init.pp b/manifests/init.pp index 8eff5118..4aa34395 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -128,6 +128,13 @@ } -> anchor { 'php::end': } + # Configure global PHP settings in php.ini + Anchor['php::begin'] -> + class {'::php::global': + settings => $real_settings, + } -> + Anchor['php::end'] + if $fpm { Anchor['php::begin'] -> class { '::php::fpm': diff --git a/manifests/params.pp b/manifests/params.pp index 6dc60128..f26ffbc3 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -24,6 +24,7 @@ 'Debian': { $config_root = pick($cfg_root, '/etc/php5') $config_root_ini = "${config_root}/mods-available" + $config_root_inifile = "${config_root}/php.ini" $common_package_names = [] $common_package_suffixes = ['cli', 'common'] $cli_inifile = "${config_root}/cli/php.ini" @@ -63,6 +64,7 @@ 'Suse': { $config_root = pick($cfg_root, '/etc/php5') $config_root_ini = "${config_root}/conf.d" + $config_root_inifile = "${config_root}/php.ini" $common_package_names = ['php5'] $common_package_suffixes = [] $cli_inifile = "${config_root}/cli/php.ini" @@ -95,6 +97,7 @@ } 'RedHat': { $config_root_ini = '/etc/php.d' + $config_root_inifile = '/etc/php.ini' $common_package_names = [] $common_package_suffixes = ['cli', 'common'] $cli_inifile = '/etc/php-cli.ini' @@ -102,7 +105,7 @@ $fpm_pid_file = '/var/run/php-fpm/php-fpm.pid' $fpm_config_file = '/etc/php-fpm.conf' $fpm_error_log = '/var/log/php-fpm/error.log' - $fpm_inifile = '/etc/php.ini' + $fpm_inifile = '/etc/php-fpm.ini' $fpm_package_suffix = 'fpm' $fpm_pool_dir = '/etc/php-fpm.d' $fpm_service_name = 'php-fpm' @@ -118,6 +121,7 @@ 'FreeBSD': { $config_root = pick($cfg_root, '/usr/local/etc') $config_root_ini = "${config_root}/php" + $config_root_inifile = "${config_root}/php.ini" # No common packages, because the required PHP base package will be # pulled in as a dependency. This preserves the ability to choose # any available PHP version by setting the 'package_prefix' parameter. @@ -128,7 +132,7 @@ $fpm_pid_file = '/var/run/php-fpm.pid' $fpm_config_file = "${config_root}/php-fpm.conf" $fpm_error_log = '/var/log/php-fpm.log' - $fpm_inifile = "${config_root}/php.ini" + $fpm_inifile = "${config_root}/php-fpm.ini" $fpm_package_suffix = undef $fpm_pool_dir = "${config_root}/php-fpm.d" $fpm_service_name = 'php-fpm' From c5ce1a5ad50608d55b3b50ad1ac1072bd976b00c Mon Sep 17 00:00:00 2001 From: codec Date: Thu, 24 Mar 2016 00:39:44 +0100 Subject: [PATCH 027/221] add version handling to php::repo::ubuntu choose which PHP version to run (needs different PPAs), also adds PHP7 support --- manifests/repo/ubuntu.pp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 6d0687d0..a726c300 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -9,14 +9,21 @@ # Use a specific PPA, e.g "ondrej/php5-5.6" (without the "ppa:") # class php::repo::ubuntu ( - $oldstable = false, + $version = '5.5', $ppa = undef, ) { include '::apt' - validate_bool($oldstable) + validate_re($version, '^\d\.\d') - if ($ppa and $oldstable == true) { + $version_repo = $version ? { + '5.4' => 'ondrej/php5-oldstable' + '5.5' => 'ondrej/php5' + '5.6' => 'ondrej/php5-5.6' + '7.0' => 'ondrej/php-7.0' + } + + if ($ppa and $version == true) { fail('Only one of $oldstable and $ppa can be specified.') } From 699afef6a2cd5681b7dde2ba3fe77c6af8f24b35 Mon Sep 17 00:00:00 2001 From: Sander Visser Date: Wed, 30 Mar 2016 01:24:54 +0200 Subject: [PATCH 028/221] Make it possible to disable the php5 tools because they are not used in php7 --- manifests/extension.pp | 8 +++++--- manifests/init.pp | 6 ++++++ manifests/params.pp | 4 ++++ manifests/repo/ubuntu.pp | 8 ++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index d32fcf00..ef84e3cb 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -176,9 +176,11 @@ # Ubuntu/Debian systems use the mods-available folder. We need to enable # settings files ourselves with php5enmod command. - $ext_tool_enable = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable) - $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) - if $::osfamily == 'Debian' { + $ext_tool_enable = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable) + $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) + $ext_tool_enabled = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled) + + if $::osfamily == 'Debian' and $ext_tool_enabled { $cmd = "${ext_tool_enable} ${lowercase_title}" exec { $cmd: diff --git a/manifests/init.pp b/manifests/init.pp index 4aa34395..8637ffce 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -56,6 +56,10 @@ # Absolute path to php tool for querying information about extensions in # debian/ubuntu systems. This defaults to '/usr/sbin/php5query'. # +# [*$ext_tool_enabled*] +# Enable or disable the use of php tools on debian based systems +# debian/ubuntu systems. This defaults to 'true'. +# # [*log_owner*] # The php-fpm log owner # @@ -82,6 +86,7 @@ $config_root_ini = $::php::params::config_root_ini, $ext_tool_enable = $::php::params::ext_tool_enable, $ext_tool_query = $::php::params::ext_tool_query, + $ext_tool_enabled = $::php::params::ext_tool_enabled, $log_owner = $::php::params::fpm_user, $log_group = $::php::params::fpm_group, ) inherits ::php::params { @@ -93,6 +98,7 @@ validate_bool($dev) validate_bool($composer) validate_bool($pear) + validate_bool($ext_tool_enabled) validate_string($pear_ensure) validate_bool($phpunit) validate_hash($extensions) diff --git a/manifests/params.pp b/manifests/params.pp index f26ffbc3..590a5542 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -45,6 +45,7 @@ $root_group = 'root' $ext_tool_enable = '/usr/sbin/php5enmod' $ext_tool_query = '/usr/sbin/php5query' + $ext_tool_enabled = true case $::operatingsystem { 'Debian': { @@ -83,6 +84,7 @@ $package_prefix = 'php5-' $manage_repos = true $root_group = 'root' + $ext_tool_enabled = false case $::operatingsystem { 'SLES': { $compiler_packages = [] @@ -117,6 +119,7 @@ $compiler_packages = ['gcc', 'gcc-c++', 'make'] $manage_repos = false $root_group = 'root' + $ext_tool_enabled = false } 'FreeBSD': { $config_root = pick($cfg_root, '/usr/local/etc') @@ -144,6 +147,7 @@ $compiler_packages = ['gcc'] $manage_repos = false $root_group = 'wheel' + $ext_tool_enabled = false } default: { fail("Unsupported osfamily: ${::osfamily}") diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index a726c300..4d713e81 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -17,10 +17,10 @@ validate_re($version, '^\d\.\d') $version_repo = $version ? { - '5.4' => 'ondrej/php5-oldstable' - '5.5' => 'ondrej/php5' - '5.6' => 'ondrej/php5-5.6' - '7.0' => 'ondrej/php-7.0' + '5.4' => 'ondrej/php5-oldstable', + '5.5' => 'ondrej/php5', + '5.6' => 'ondrej/php5-5.6', + '7.0' => 'ondrej/php' } if ($ppa and $version == true) { From 1cc1d84a52bbe408be525a085b21dc37ed43e001 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Thu, 31 Mar 2016 11:13:19 +0200 Subject: [PATCH 029/221] Gemfile: beaker fork depends on missing ruby gem --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index bc25ba1b..160193fc 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :development, :test do gem 'rspec-puppet-facts' gem 'puppetlabs_spec_helper' gem 'puppet-module' - gem 'beaker', :github => 'Mayflower/beaker', :branch => 'master' + #gem 'beaker', :github => 'Mayflower/beaker', :branch => 'master' gem 'beaker-rspec' gem 'pry' gem 'yard' From 5bc815277194ccb57245f72eab1fa17d842e6a0f Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Thu, 31 Mar 2016 11:13:57 +0200 Subject: [PATCH 030/221] Fix ubuntu ppa handling & tests --- manifests/repo/ubuntu.pp | 20 ++++++++++++-------- spec/classes/php_repo_ubuntu_spec.rb | 18 ++++++------------ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 4d713e81..31f4829c 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -9,29 +9,33 @@ # Use a specific PPA, e.g "ondrej/php5-5.6" (without the "ppa:") # class php::repo::ubuntu ( - $version = '5.5', + $version = undef, $ppa = undef, ) { include '::apt' - validate_re($version, '^\d\.\d') + if($version == undef) { + $version_real = '5.5' + } else { + $version_real = $version + } + + validate_re($version_real, '^\d\.\d') - $version_repo = $version ? { + $version_repo = $version_real ? { '5.4' => 'ondrej/php5-oldstable', '5.5' => 'ondrej/php5', '5.6' => 'ondrej/php5-5.6', '7.0' => 'ondrej/php' } - if ($ppa and $version == true) { - fail('Only one of $oldstable and $ppa can be specified.') + if ($version != undef and $version != undef) { + fail('Only one of $version and $ppa can be specified.') } if ($ppa) { ::apt::ppa { "ppa:${ppa}": } - } elsif ($::lsbdistcodename == 'precise' or $oldstable == true) { - ::apt::ppa { 'ppa:ondrej/php5-oldstable': } } else { - ::apt::ppa { 'ppa:ondrej/php5': } + ::apt::ppa { "ppa:${version_repo}": } } } diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index b2120c23..7f9ea82f 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -17,10 +17,10 @@ describe 'when called with parameter oldstable on Ubuntu trusty' do let(:params) {{ - :oldstable => true + :version => '7.0' }} it { - should contain_exec('add-apt-repository-ppa:ondrej/php5-oldstable') + should contain_exec('add-apt-repository-ppa:ondrej/php') } end @@ -33,21 +33,15 @@ } end - describe 'when call with parameter ppa and oldstable on Ubuntu trusty' do + describe 'when call with parameter ppa and version on Ubuntu trusty' do let(:params) {{ - :oldstable => true, - :ppa => 'ondrej/php5-5.6' + :version => '5.4', + :ppa => 'ondrej/php5-5.6' }} it { expect { should raise_error(Puppet::Error) }} end - when 'precise' - describe 'when called with no parameters on Ubuntu precise' do - it { - should contain_exec('add-apt-repository-ppa:ondrej/php5-oldstable') - } - end end end end -end \ No newline at end of file +end From 20a94d206ba0237122dab762f994c8bb4ea67878 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Sun, 3 Apr 2016 00:52:52 +0200 Subject: [PATCH 031/221] add puppet-lint-param-docs and fixes --- Gemfile | 1 + manifests/composer.pp | 3 +++ manifests/embedded.pp | 8 +++++++- manifests/extension.pp | 6 +++++- manifests/fpm.pp | 12 +++++++++++- manifests/fpm/config.pp | 6 ++++++ manifests/fpm/pool.pp | 7 +++++-- manifests/init.pp | 13 ++++++++++--- manifests/packages.pp | 2 +- manifests/params.pp | 2 +- manifests/pear.pp | 2 +- manifests/repo/ubuntu.pp | 4 ++-- 12 files changed, 53 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 160193fc..6bc77111 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ group :development, :test do gem 'puppet-lint-leading_zero-check' gem 'puppet-lint-trailing_comma-check' gem 'puppet-lint-file_ensure-check' + gem 'puppet-lint-param-docs' gem 'metadata-json-lint' end diff --git a/manifests/composer.pp b/manifests/composer.pp index 945e7ccc..5b960638 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -14,6 +14,9 @@ # [*max_age*] # Defines the time in days after which an auto-update gets executed # +# [*root_group*] +# UNIX group of the root user +# class php::composer ( $source = $::php::params::composer_source, $path = $::php::params::composer_path, diff --git a/manifests/embedded.pp b/manifests/embedded.pp index c03ea9be..6837c22f 100644 --- a/manifests/embedded.pp +++ b/manifests/embedded.pp @@ -8,6 +8,12 @@ # [*settings*] # Hash with nested hash of key => value to set in inifile # +# [*package*] +# Specify which package to install +# +# [*ensure*] +# Specify which version of the package to install +# class php::embedded( $ensure = $::php::ensure, $package = @@ -41,5 +47,5 @@ file => $inifile, config => $real_settings, } - + } diff --git a/manifests/extension.pp b/manifests/extension.pp index ef84e3cb..1f07bbe5 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -31,7 +31,11 @@ # # [*header_packages*] # System packages dependencies to install for extensions (e.g. for -# memcached libmemcached-dev on debian) +# memcached libmemcached-dev on Debian) +# +# [*compiler_packages*] +# System packages dependencies to install for compiling extensions +# (e.g. build-essential on Debian) # # [*zend*] # Boolean parameter, whether to load extension as zend_extension. diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 243f66f5..a12c5f90 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -22,7 +22,17 @@ # [*log_group*] # The group owning php-fpm logs # -# FIXME +# [*package*] +# Specify which package to install +# +# [*ensure*] +# Specify which version of the package to install +# +# [*inifile*] +# Path to php.ini for fpm +# +# [*settings*] +# fpm settings hash # class php::fpm ( $ensure = $::php::ensure, diff --git a/manifests/fpm/config.pp b/manifests/fpm/config.pp index 06be6696..0b226869 100644 --- a/manifests/fpm/config.pp +++ b/manifests/fpm/config.pp @@ -64,6 +64,12 @@ # [*syslog_ident*] # Prepended to every message # +# [*root_group*] +# UNIX group of the root user +# +# [*pid_file*] +# Path to fpm pid file +# class php::fpm::config( $config_file = $::php::params::fpm_config_file, $user = $::php::params::fpm_user, diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index 315b1309..83bc3aa1 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -46,7 +46,7 @@ # # [*ping_path*] # -# [*ping_reponse*] +# [*ping_response*] # # [*access_log*] # The path to the file to write access log requests to @@ -99,10 +99,13 @@ # List of custom directives that are appended to the pool config # # [*base_dir*] -# The folder that contains the php-fpm pool configs. This defaults to a +# The folder that contains the php-fpm pool configs. This defaults to a # sensible default depending on your operating system, like # '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d' # +# [*root_group*] +# UNIX group of the root user +# define php::fpm::pool ( $ensure = 'present', $listen = '127.0.0.1:9000', diff --git a/manifests/init.pp b/manifests/init.pp index 8637ffce..68d086de 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -48,15 +48,15 @@ # to a sensible default depending on your operating system, like # '/etc/php5/mods-available' or '/etc/php5/conf.d'. # -# [*$ext_tool_enable*] +# [*ext_tool_enable*] # Absolute path to php tool for enabling extensions in debian/ubuntu systems. # This defaults to '/usr/sbin/php5enmod'. # -# [*$ext_tool_query*] +# [*ext_tool_query*] # Absolute path to php tool for querying information about extensions in # debian/ubuntu systems. This defaults to '/usr/sbin/php5query'. # -# [*$ext_tool_enabled*] +# [*ext_tool_enabled*] # Enable or disable the use of php tools on debian based systems # debian/ubuntu systems. This defaults to 'true'. # @@ -66,6 +66,13 @@ # [*log_group*] # The group owning php-fpm logs # +# [*embedded*] +# Enable embedded SAPI +# +# [*pear_ensure*] +# The package ensure of PHP pear to install and run pear auto_discover +# +# [*settings*] # class php ( $ensure = $::php::params::ensure, diff --git a/manifests/packages.pp b/manifests/packages.pp index 671e414d..d423eadd 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -15,7 +15,7 @@ class php::packages ( $ensure = $::php::ensure, $names_to_prefix = prefix( - $::php::params::common_package_suffixes, $::php::package_prefix + $::php::params::common_package_suffixes, $::php::package_prefix # lint:ignore:parameter_documentation ), $names = $::php::params::common_package_names, ) inherits ::php::params { diff --git a/manifests/params.pp b/manifests/params.pp index 590a5542..224f6d62 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,7 +1,7 @@ # PHP params class # class php::params( - $cfg_root = undef, + $cfg_root = undef, # lint:ignore:parameter_documentation ) { if $cfg_root != undef { diff --git a/manifests/pear.pp b/manifests/pear.pp index f84819f3..84c97601 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -3,7 +3,7 @@ # === Parameters # # [*ensure*] -# The PHP ensure of PHP pear to install and run pear auto_discover +# The package ensure of PHP pear to install and run pear auto_discover # # [*package*] # The package name for PHP pear diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 31f4829c..583f6b28 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -2,8 +2,8 @@ # # === Parameters # -# [*oldstable*] -# Install 5.4 (ondrej/php5-oldstable PPA) +# [*version*] +# PHP version to manage (e.g. 5.6) # # [*ppa*] # Use a specific PPA, e.g "ondrej/php5-5.6" (without the "ppa:") From 614e24d33ff21af89c171a5a7f9c0c9b04c10f07 Mon Sep 17 00:00:00 2001 From: Dennis de Greef Date: Sun, 3 Apr 2016 00:59:33 +0200 Subject: [PATCH 032/221] Add '/usr/local' paths to support FreeBSD --- manifests/composer/auto_update.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index 4b4e3dfb..5bb19e41 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -31,7 +31,7 @@ exec { 'update composer': command => "wget ${source} -O ${path}", onlyif => "test `find '${path}' -mtime +${max_age}`", - path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ], + path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ], require => File[$path], } } From e396f3113b30e4a94245ff905ecf9a02fc4fa578 Mon Sep 17 00:00:00 2001 From: Mikhail Konyakhin Date: Mon, 4 Apr 2016 16:36:35 +0300 Subject: [PATCH 033/221] Add third argument 'global_pool_settings' for resource ::php::fpm::pool. --- manifests/fpm.pp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index a12c5f90..e81306c6 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -34,17 +34,22 @@ # [*settings*] # fpm settings hash # +# [*global_pool_settings*] +# Hash of defaults params php::fpm::pool resources that will be created. +# Defaults is empty hash. +# class php::fpm ( - $ensure = $::php::ensure, - $service_ensure = $::php::params::fpm_service_ensure, - $service_enable = $::php::params::fpm_service_enable, - $service_name = $::php::params::fpm_service_name, - $package = "${::php::package_prefix}${::php::params::fpm_package_suffix}", - $inifile = $::php::params::fpm_inifile, - $settings = {}, - $pools = { 'www' => {} }, - $log_owner = $::php::params::fpm_user, - $log_group = $::php::params::fpm_group + $ensure = $::php::ensure, + $service_ensure = $::php::params::fpm_service_ensure, + $service_enable = $::php::params::fpm_service_enable, + $service_name = $::php::params::fpm_service_name, + $package = "${::php::package_prefix}${::php::params::fpm_package_suffix}", + $inifile = $::php::params::fpm_inifile, + $settings = {}, + $global_pool_settings = {}, + $pools = { 'www' => {} }, + $log_owner = $::php::params::fpm_user, + $log_group = $::php::params::fpm_group ) inherits ::php::params { if $caller_module_name != $module_name { @@ -84,8 +89,9 @@ } -> anchor { '::php::fpm::end': } + $real_global_pool_settings = hiera_hash('php::fpm::global_pool_settings', $global_pool_settings) $real_pools = hiera_hash('php::fpm::pools', $pools) - create_resources(::php::fpm::pool, $real_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 From c9ab220f759c695de0c7344f840fea2284b7362e Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Fri, 8 Apr 2016 12:40:25 +0200 Subject: [PATCH 034/221] correct check for Ubuntu repo parameters --- manifests/repo/ubuntu.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 583f6b28..2b194867 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -29,7 +29,7 @@ '7.0' => 'ondrej/php' } - if ($version != undef and $version != undef) { + if ($version != undef and $ppa != undef) { fail('Only one of $version and $ppa can be specified.') } From 5dc0ffb9706fcbaed91ac9effcde7626af6bd190 Mon Sep 17 00:00:00 2001 From: Max Williams Date: Wed, 13 Apr 2016 17:54:56 +0200 Subject: [PATCH 035/221] Fixing some formatting, adding custom template option and options hash --- manifests/fpm/pool.pp | 96 ++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 43 deletions(-) diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index 83bc3aa1..39665ef6 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -62,6 +62,9 @@ # # [*slowlog*] # +# [*template*] +# The template to use for the pool +# # [*rlimit_files*] # # [*rlimit_core*] @@ -83,6 +86,9 @@ # Hash of environment variables and values as strings to use in php # scripts in this pool # +# [*options*] +# An optional hash for any other data. +# # [*php_value*] # Hash of php_value directives # @@ -98,55 +104,56 @@ # [*php_directives*] # List of custom directives that are appended to the pool config # +# [*root_group*] +# UNIX group of the root user +# # [*base_dir*] # The folder that contains the php-fpm pool configs. This defaults to a # sensible default depending on your operating system, like # '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d' # -# [*root_group*] -# UNIX group of the root user -# define php::fpm::pool ( - $ensure = 'present', - $listen = '127.0.0.1:9000', - # Puppet does not allow dots in variable names - $listen_backlog = '-1', - $listen_allowed_clients = undef, - $listen_owner = undef, - $listen_group = undef, - $listen_mode = undef, - $user = $::php::fpm::config::user, - $group = $::php::fpm::config::group, - $pm = 'dynamic', - $pm_max_children = '50', - $pm_start_servers = '5', - $pm_min_spare_servers = '5', - $pm_max_spare_servers = '35', - $pm_max_requests = '0', - $pm_status_path = undef, - $ping_path = undef, - $ping_response = 'pong', - $access_log = undef, - $access_log_format = "%R - %u %t \"%m %r\" %s", + $ensure = 'present', + $listen = '127.0.0.1:9000', + $listen_backlog = '-1', + $listen_allowed_clients = undef, + $listen_owner = undef, + $listen_group = undef, + $listen_mode = undef, + $user = $::php::fpm::config::user, + $group = $::php::fpm::config::group, + $pm = 'dynamic', + $pm_max_children = '50', + $pm_start_servers = '5', + $pm_min_spare_servers = '5', + $pm_max_spare_servers = '35', + $pm_max_requests = '0', + $pm_status_path = undef, + $ping_path = undef, + $ping_response = 'pong', + $access_log = undef, + $access_log_format = "%R - %u %t \"%m %r\" %s", $request_terminate_timeout = '0', - $request_slowlog_timeout = '0', + $request_slowlog_timeout = '0', $security_limit_extensions = undef, - $slowlog = "/var/log/php-fpm/${name}-slow.log", - $rlimit_files = undef, - $rlimit_core = undef, - $chroot = undef, - $chdir = undef, - $catch_workers_output = 'no', - $include = undef, - $env = [], - $env_value = {}, - $php_value = {}, - $php_flag = {}, - $php_admin_value = {}, - $php_admin_flag = {}, - $php_directives = [], - $root_group = $::php::params::root_group, - $base_dir = undef, + $slowlog = "/var/log/php-fpm/${name}-slow.log", + $template = 'php/fpm/pool.conf.erb', + $rlimit_files = undef, + $rlimit_core = undef, + $chroot = undef, + $chdir = undef, + $catch_workers_output = 'no', + $include = undef, + $env = [], + $env_value = {}, + $options = {}, + $php_value = {}, + $php_flag = {}, + $php_admin_value = {}, + $php_admin_flag = {}, + $php_directives = [], + $root_group = $::php::params::root_group, + $base_dir = undef, ) { include ::php::params @@ -158,7 +165,10 @@ $pool = $title # Hack-ish to default to user for group too - $group_final = $group ? { undef => $user, default => $group } + $group_final = $group ? { + undef => $user, + default => $group + } # On FreeBSD fpm is not a separate package, but included in the 'php' package. # Implies that the option SET+=FPM was set when building the port. @@ -178,7 +188,7 @@ ensure => file, notify => Class['::php::fpm::service'], require => Package[$real_package], - content => template('php/fpm/pool.conf.erb'), + content => template($template), owner => root, group => $root_group, mode => '0644', From b85a2603096b1f29cd53102a555f6cfb794b14c6 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Tue, 3 May 2016 14:29:58 +0200 Subject: [PATCH 036/221] README.md: Add note about finding new maintainers --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 1b77b5b0..d974d5fa 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ with `mod_php` is not supported. This originally was a fork of [jippi/puppet-php](https://github.com/jippi/puppet-php) (nodes-php on Puppet Forge) but has since been rewritten in large parts. +**Current Status:** The original maintainers of `puppet-php` are not developing +it actively anymore because they have moved on from Puppet. If you want to help +maintain this module please see [#183](https://github.com/mayflower/puppet-php/issues/183). + ## Usage Quickest way to get started is simply `include`'ing the _`php` class_. From 50fd1c7a9ef1663f3e41bd29c43841355de37e5f Mon Sep 17 00:00:00 2001 From: Rudy Grigar Date: Tue, 3 May 2016 07:01:37 -0700 Subject: [PATCH 037/221] Allow specifying the sapi for debian/ubuntu systems (#182) * Add an SAPI flag for debian/ubuntu php5enmod * sapi sapi everywhere * A little more complex, but sort of matches the other if statements in this class * Add some documentation / examples --- README.md | 2 ++ manifests/extension.pp | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d974d5fa..f40b6533 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ activated for all activated SAPIs. 'apc/stat' => '1', 'apc/stat_ctime' => '1', }, + sapi => 'fpm', }, }, @@ -152,6 +153,7 @@ php::extensions: settings: 'apc/stat': 1 'apc/stat_ctime': 1 + sapi: 'fpm' php::fpm::pools: www2: listen: '127.0.1.1:9000' diff --git a/manifests/extension.pp b/manifests/extension.pp index 1f07bbe5..82754b45 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -48,6 +48,10 @@ # Boolean/String parameter, whether to prefix all setting keys with # the extension name or specified name. Defaults to false. # +# [*sapi*] +# String parameter, whether to specify ALL sapi or a specific sapi. +# Defaults to ALL. +# define php::extension( $ensure = 'installed', $provider = undef, @@ -61,12 +65,14 @@ $zend = false, $settings = {}, $settings_prefix = false, + $sapi = 'ALL', ) { validate_string($ensure) validate_string($package_prefix) validate_string($so_name) validate_string($php_api_version) + validate_string($sapi) validate_array($header_packages) validate_bool($zend) @@ -185,11 +191,18 @@ $ext_tool_enabled = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled) if $::osfamily == 'Debian' and $ext_tool_enabled { - $cmd = "${ext_tool_enable} ${lowercase_title}" + $cmd = "${ext_tool_enable} -s ${sapi} ${lowercase_title}" - exec { $cmd: - unless => "${ext_tool_query} -s cli -m ${lowercase_title}", - require =>::Php::Config[$title], + if $sapi == 'ALL' { + exec { $cmd: + unless => "${ext_tool_query} -s cli -m ${lowercase_title}", + require =>::Php::Config[$title], + } + } else { + exec { $cmd: + unless => "${ext_tool_query} -s ${sapi} -m ${lowercase_title}", + require =>::Php::Config[$title], + } } if $::php::fpm { From 98967a4d5e8bddb38e07b34d43f76ccbe10b3779 Mon Sep 17 00:00:00 2001 From: Max Williams Date: Wed, 25 May 2016 10:17:01 +0200 Subject: [PATCH 038/221] Adding params logic for php7 on Ubuntu/Debian (#180) * Adding params logic for php7 on Ubuntu/Debian * Moving params to init.pp * Renaming param documentation to override_php_version and override_config_root * Moving validation to init.pp too * Adding globals class * Fixing param alignment * Fixing phpenmod/phpquery * Fixing config_root/config_root_ini for RedHat --- README.md | 20 +++++++++--- manifests/globals.pp | 73 ++++++++++++++++++++++++++++++++++++++++++++ manifests/params.pp | 32 ++++++++----------- 3 files changed, 102 insertions(+), 23 deletions(-) create mode 100644 manifests/globals.pp diff --git a/README.md b/README.md index f40b6533..ee25beb5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ mayflower/php is a Puppet module for managing PHP with a strong focus on php-fpm. The module aims to use sane defaults for the supported architectures. We strive to support all recent versions of Debian, Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache -with `mod_php` is not supported. +with `mod_php` is not supported. This originally was a fork of [jippi/puppet-php](https://github.com/jippi/puppet-php) (nodes-php on Puppet Forge) but has since been rewritten in large parts. @@ -39,8 +39,20 @@ class { '::php': } ``` +Optionally the PHP version or configuration root directory can be changed also: + +```puppet +class { '::php::globals': + php_version => '7.0', + config_root => '/etc/php/7.0', +}-> +class { '::php': + manage_repos => true +} +``` + There are more configuration options available. Please refer to the -auto-generated documention at http://php.puppet.mayflower.de/. +auto-generated documentation at http://php.puppet.mayflower.de/. ### Defining `php.ini` settings @@ -94,7 +106,7 @@ activated for all activated SAPIs. }, sapi => 'fpm', }, - + }, } ``` @@ -192,7 +204,7 @@ We prefer using php-fpm. You can find an example Apache vhost in connect to php-fpm. ### Facts -We deliver a `phpversion` fact with this module. This is explicitly **NOT** intended +We deliver a `phpversion` fact with this module. This is explicitly **NOT** intended to be used within your puppet manifests as it will only work on your second puppet run. Its intention is to make querying PHP versions per server easy via PuppetDB. diff --git a/manifests/globals.pp b/manifests/globals.pp new file mode 100644 index 00000000..e39d12a3 --- /dev/null +++ b/manifests/globals.pp @@ -0,0 +1,73 @@ +# PHP globals class +# +# === Parameters +# +# [*php_version*] +# The version of php. +# +# [*config_root*] +# The configuration root directory. +# +class php::globals ( + $php_version = undef, + $config_root = undef, +) { + if $php_version != undef { + validate_re($php_version, '^[57].[0-9]') + } + if $config_root != undef { + validate_absolute_path($config_root) + } + + $default_php_version = $::osfamily ? { + 'Debian' => $::operatingsystem ? { + 'Ubuntu' => $::operatingsystemrelease ? { + /^(16.04)$/ => '7.0', + default => '5.x', + }, + default => '5.x', + }, + default => '5.x', + } + + $globals_php_version = pick($php_version, $default_php_version) + + case $::osfamily { + 'Debian': { + case $globals_php_version { + /^7/: { + $default_config_root = "/etc/php/${globals_php_version}" + $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php-' + } + default: { + $default_config_root = '/etc/php5' + $fpm_pid_file = '/var/run/php5-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-' + } + } + } + 'Suse': { + $default_config_root = '/etc/php5' + } + 'RedHat': { + $default_config_root = '/etc/php.d' + } + 'FreeBSD': { + $default_config_root = '/usr/local/etc' + } + default: { + fail("Unsupported osfamily: ${::osfamily}") + } + } + + $globals_config_root = pick($config_root, $default_config_root) +} diff --git a/manifests/params.pp b/manifests/params.pp index 224f6d62..683f7d47 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,12 +1,6 @@ # PHP params class # -class php::params( - $cfg_root = undef, # lint:ignore:parameter_documentation -) { - - if $cfg_root != undef { - validate_absolute_path($cfg_root) - } +class php::params inherits php::globals { $ensure = 'present' $fpm_service_enable = true @@ -16,35 +10,35 @@ $composer_max_age = 30 $pear_ensure = 'present' $pear_package_suffix = 'pear' - $phpunit_source = 'https://phar.phpunit.de/phpunit.phar' - $phpunit_path = '/usr/local/bin/phpunit' - $phpunit_max_age = 30 + $phpunit_source = 'https://phar.phpunit.de/phpunit.phar' + $phpunit_path = '/usr/local/bin/phpunit' + $phpunit_max_age = 30 case $::osfamily { 'Debian': { - $config_root = pick($cfg_root, '/etc/php5') + $config_root = $php::globals::globals_config_root $config_root_ini = "${config_root}/mods-available" $config_root_inifile = "${config_root}/php.ini" $common_package_names = [] $common_package_suffixes = ['cli', 'common'] $cli_inifile = "${config_root}/cli/php.ini" $dev_package_suffix = 'dev' - $fpm_pid_file = '/var/run/php5-fpm.pid' + $fpm_pid_file = $php::globals::fpm_pid_file $fpm_config_file = "${config_root}/fpm/php-fpm.conf" - $fpm_error_log = '/var/log/php5-fpm.log' + $fpm_error_log = $php::globals::fpm_error_log $fpm_inifile = "${config_root}/fpm/php.ini" $fpm_package_suffix = 'fpm' $fpm_pool_dir = "${config_root}/fpm/pool.d" - $fpm_service_name = 'php5-fpm' + $fpm_service_name = $php::globals::fpm_service_name $fpm_user = 'www-data' $fpm_group = 'www-data' $embedded_package_suffix = 'embed' $embedded_inifile = "${config_root}/embed/php.ini" - $package_prefix = 'php5-' + $package_prefix = $php::globals::package_prefix $compiler_packages = 'build-essential' $root_group = 'root' - $ext_tool_enable = '/usr/sbin/php5enmod' - $ext_tool_query = '/usr/sbin/php5query' + $ext_tool_enable = $php::globals::ext_tool_enable + $ext_tool_query = $php::globals::ext_tool_query $ext_tool_enabled = true case $::operatingsystem { @@ -63,7 +57,7 @@ } 'Suse': { - $config_root = pick($cfg_root, '/etc/php5') + $config_root = $php::globals::globals_config_root $config_root_ini = "${config_root}/conf.d" $config_root_inifile = "${config_root}/php.ini" $common_package_names = ['php5'] @@ -122,7 +116,7 @@ $ext_tool_enabled = false } 'FreeBSD': { - $config_root = pick($cfg_root, '/usr/local/etc') + $config_root = $php::globals::globals_config_root $config_root_ini = "${config_root}/php" $config_root_inifile = "${config_root}/php.ini" # No common packages, because the required PHP base package will be From 223ce20d339b14892ee8478adf358506b4bbe53e Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Thu, 2 Jun 2016 00:35:26 +0200 Subject: [PATCH 039/221] Fix typos (#188) --- templates/fpm/php-fpm.conf.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/fpm/php-fpm.conf.erb b/templates/fpm/php-fpm.conf.erb index e7a3fd73..91ac1bea 100644 --- a/templates/fpm/php-fpm.conf.erb +++ b/templates/fpm/php-fpm.conf.erb @@ -3,14 +3,14 @@ ;;;;;;;;;;;;;;;;;;;;; ; All relative paths in this configuration file are relative to PHP's install -; prefix (/usr). This prefix can be dynamicaly changed by using the +; prefix (/usr). This prefix can be dynamically changed by using the ; '-p' argument from the command line. ; Include one or more files. If glob(3) exists, it is used to include a bunch of ; files from a glob(3) pattern. This directive can be used everywhere in the ; file. ; Relative path can also be used. They will be prefixed by: -; - the global prefix if it's been set (-p arguement) +; - the global prefix if it's been set (-p argument) ; - /usr otherwise ;include=/etc/php5/fpm/*.conf @@ -109,7 +109,7 @@ rlimit_files = <%= @rlimit_files %> ; - /dev/poll (Solaris >= 7) ; - port (Solaris >= 10) ; Default Value: not set (auto detection) -; events.mechanism = epoll +;events.mechanism = epoll ; When FPM is build with systemd integration, specify the interval, ; in second, between health report notification to systemd. From 778969f5fe5095c2abb485658d8dc7bbf6760486 Mon Sep 17 00:00:00 2001 From: Chris Boulton Date: Wed, 8 Jun 2016 23:07:56 -0700 Subject: [PATCH 040/221] allow packaged extensions to be loaded as zend extensions --- manifests/extension.pp | 29 +++++------------------------ spec/defines/extension_spec.rb | 21 +++++++-------------- 2 files changed, 12 insertions(+), 38 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index 82754b45..bd6f2a00 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -39,7 +39,7 @@ # # [*zend*] # Boolean parameter, whether to load extension as zend_extension. -# This can only be set for pecl modules. Defaults to false. +# Defaults to false. # # [*settings*] # Nested hash of global config parameters for php.ini @@ -121,10 +121,6 @@ } } - if $provider != 'pecl' and $zend { - fail('You can only use the zend parameter for pecl PHP extensions!') - } - if $zend == true { $extension_key = 'zend_extension' if $php_api_version != undef { @@ -158,25 +154,10 @@ $full_settings = $settings } - if $provider == 'pecl' { - $final_settings = deep_merge( - {"${extension_key}" => "${module_path}${so_name}.so"}, - $full_settings - ) - } - else { - # On FreeBSD systems the settings file is required for every module - # (regardless of provider) to allow for proper module management. - if $::osfamily == 'FreeBSD' { - $final_settings = deep_merge( - {"${extension_key}" => "${name}.so"}, - $full_settings - ) - } - else { - $final_settings = $full_settings - } - } + $final_settings = deep_merge( + {"${extension_key}" => "${module_path}${so_name}.so"}, + $full_settings + ) $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) ::php::config { $title: diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 27d4de11..fa818080 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -30,7 +30,8 @@ should contain_php__config('json').with({ :file => "#{etcdir}/json.ini", :config => { - 'test' => 'foo' + 'extension' => 'json.so', + 'test' => 'foo' }, }) } @@ -49,6 +50,7 @@ it { should contain_php__config('json').with({ :config => { + 'extension' => 'json.so', 'json.test' => 'foo' } }) @@ -68,28 +70,19 @@ it { should contain_php__config('json').with({ :config => { - 'bar.test' => 'foo' + 'extension' => 'json.so', + 'bar.test' => 'foo' } }) } end - context 'non-pecl extensions cannot be configured as zend' do + context 'extensions can be configured as zend' do let(:title) { 'xdebug' } let(:params) {{ :zend => true, }} - it { expect { should raise_error(Puppet::Error) }} - end - - context 'pecl extensions can be configured as zend' do - let(:title) { 'xdebug' } - let(:params) {{ - :provider => 'pecl', - :zend => true - }} - it { should contain_php__config('xdebug').with({ :config => { @@ -173,4 +166,4 @@ end end end -end \ No newline at end of file +end From ecd4aa68ec95b54883afe82ca53052659f53f9b8 Mon Sep 17 00:00:00 2001 From: Chris Boulton Date: Sat, 11 Jun 2016 14:15:22 -0700 Subject: [PATCH 041/221] Don't manage global php.ini settings on Debian based systems (#192) * do not manage a global php.ini on debian systems (there isn't one) * update tests --- manifests/init.pp | 12 +++++++----- spec/classes/php_spec.rb | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 68d086de..afd505f2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -142,11 +142,13 @@ anchor { 'php::end': } # Configure global PHP settings in php.ini - Anchor['php::begin'] -> - class {'::php::global': - settings => $real_settings, - } -> - Anchor['php::end'] + if $::osfamily != 'Debian' { + Anchor['php::begin'] -> + class {'::php::global': + settings => $real_settings, + } -> + Anchor['php::end'] + } if $fpm { Anchor['php::begin'] -> diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index 2b339965..e2ea9305 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -11,6 +11,7 @@ case facts[:osfamily] when 'Debian' it { + should_not contain_class('php::global') should contain_class('php::fpm') should contain_package('php5-cli').with({ 'ensure' => 'present', @@ -28,6 +29,7 @@ } when 'Suse' it { + should contain_class('php::global') should contain_package('php5').with({ 'ensure' => 'present', }) From 291c6f9df807adfb524a7b70105a0873c41ca894 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Sat, 11 Jun 2016 23:36:26 +0200 Subject: [PATCH 042/221] slighty refactor test execution --- .travis.yml | 10 ++++++---- Rakefile | 6 +----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f9c79a3..e505738f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,19 +7,21 @@ rvm: env: matrix: - PUPPET_VERSION=4.3.1 - - PUPPET_VERSION=3.8.4 - - PUPPET_VERSION=3.8.4 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes + - PUPPET_VERSION=3.8.7 + - PUPPET_VERSION=3.8.7 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes global: - secure: Zc0V6JqwpFTTtVE7jVFg5R6UgXZrzsBGa6ckbOnIHPCOyJsV4oWO6RxKsYI+ozzD9nrEdrT/DTcHKRz84YqrMXxvBU9HA4S/ZrNQoRiH3bEnI3UHC6jQJRX0c71gaJEMQ3S33my39vLD7EsealX3p+j8asL8e8glYR1am9ekUB8= matrix: exclude: - rvm: 2.1.6 - env: PUPPET_VERSION=3.8.4 + env: PUPPET_VERSION=3.8.7 include: - rvm: 2.1.6 - env: PUPPET_VERSION=3.8.4 DOCS=true + env: PUPPET_VERSION=3.8.7 DOCS=true - rvm: 2.2.3 env: PUPPET_VERSION=4.3.1 + - rvm: 2.3.0 + env: PUPPET_VERSION=4.5.1 after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && diff --git a/Rakefile b/Rakefile index 30c6bcd9..4c251989 100644 --- a/Rakefile +++ b/Rakefile @@ -8,11 +8,7 @@ PuppetLint::RakeTask.new :lint do |config| config.fail_on_warnings = true end -task :default => [:metadata, :lint, :spec] - -task :metadata do - sh 'metadata-json-lint metadata.json' -end +task :default => [:validate, :lint, :spec] namespace :spec do task :acceptance do From 871d5c9a10b340ad90d477088c5d7b559139b54f Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Sat, 11 Jun 2016 22:58:56 +0100 Subject: [PATCH 043/221] Correcting dependency for globals class (#194) --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index afd505f2..2d5010ce 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -143,7 +143,7 @@ # Configure global PHP settings in php.ini if $::osfamily != 'Debian' { - Anchor['php::begin'] -> + Class['php::packages'] -> class {'::php::global': settings => $real_settings, } -> From 88d08bf72408573f0b920acfe699474c3407776d Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Sun, 12 Jun 2016 14:17:12 +0200 Subject: [PATCH 044/221] advertise current status more prominently --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ee25beb5..c3cf003d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ -# mayflower/php Puppet Module - [![GitHub version](https://badge.fury.io/gh/mayflower%2Fpuppet-php.svg)](https://github.com/mayflower/puppet-php) [![Build Status](https://travis-ci.org/mayflower/puppet-php.svg?branch=master)](https://travis-ci.org/mayflower/puppet-php) +## Current Status + +The original maintainers of `puppet-php` are not developing it actively anymore, because they moved away from Puppet. +**If you want to help** maintaining this module please see [#183](https://github.com/mayflower/puppet-php/issues/183). + +# mayflower/php Puppet Module + mayflower/php is a Puppet module for managing PHP with a strong focus on php-fpm. The module aims to use sane defaults for the supported architectures. We strive to support all recent versions of Debian, @@ -12,10 +17,6 @@ with `mod_php` is not supported. This originally was a fork of [jippi/puppet-php](https://github.com/jippi/puppet-php) (nodes-php on Puppet Forge) but has since been rewritten in large parts. -**Current Status:** The original maintainers of `puppet-php` are not developing -it actively anymore because they have moved on from Puppet. If you want to help -maintain this module please see [#183](https://github.com/mayflower/puppet-php/issues/183). - ## Usage Quickest way to get started is simply `include`'ing the _`php` class_. @@ -106,7 +107,6 @@ activated for all activated SAPIs. }, sapi => 'fpm', }, - }, } ``` @@ -171,7 +171,6 @@ php::fpm::pools: listen: '127.0.1.1:9000' ``` - ## Notes ### Debian squeeze & Ubuntu precise come with PHP 5.3 @@ -204,9 +203,10 @@ We prefer using php-fpm. You can find an example Apache vhost in connect to php-fpm. ### Facts + We deliver a `phpversion` fact with this module. This is explicitly **NOT** intended to be used within your puppet manifests as it will only work on your second puppet -run. Its intention is to make querying PHP versions per server easy via PuppetDB. +run. Its intention is to make querying PHP versions per server easy via PuppetDB or Foreman. ### FreeBSD support From 5722256d4d2ea35d866d2a1a74e069f97ebcae06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 12 Jun 2016 15:26:36 +0200 Subject: [PATCH 045/221] Avoid puppets warning in puppetserver.log (#195) * Avoid puppets warning in puppetserver.log --- manifests/extension.pp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index 82754b45..4b8823fb 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -95,9 +95,11 @@ $real_package = "${package_prefix}${title}" } - ensure_resource('package', $header_packages) - Package[$header_packages] -> Package[$real_package] -> ::Php::Config[$title] - + unless empty($header_packages) { + ensure_resource('package', $header_packages) + Package[$header_packages] -> Package[$real_package] + } + if $provider == 'pecl' { package { $real_package: ensure => $ensure, @@ -109,8 +111,10 @@ ], } - ensure_resource('package', $compiler_packages) - Package[$compiler_packages] -> Package[$real_package] + unless empty($compiler_packages) { + ensure_resource('package', $compiler_packages) + Package[$compiler_packages] -> Package[$real_package] + } } else { package { $real_package: @@ -180,8 +184,9 @@ $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) ::php::config { $title: - file => "${config_root_ini}/${lowercase_title}.ini", - config => $final_settings, + file => "${config_root_ini}/${lowercase_title}.ini", + config => $final_settings, + require => Package[$real_package], } # Ubuntu/Debian systems use the mods-available folder. We need to enable From 56bad262492d507a9ce1ce0879fc5ffa6a0a0c6c Mon Sep 17 00:00:00 2001 From: tdm4 Date: Mon, 13 Jun 2016 14:26:08 +0100 Subject: [PATCH 046/221] Ondrej-php PPA fixes/enhancements for Ubuntu (#190) * Add support for ondrej/php PPA for PHP 5.5, 5.6, and 7.0 for Ubuntu systems (ondrej/php5, ondrej/php5-5.6, and others are now deprecated) --- README.md | 22 +++++- manifests/dev.pp | 15 +++- manifests/globals.pp | 86 ++++++++++++++++----- manifests/packages.pp | 11 ++- manifests/pear.pp | 17 ++++- manifests/repo/ubuntu.pp | 14 ++-- spec/classes/php_fpm_config_spec.rb | 66 +++++++++++----- spec/classes/php_fpm_spec.rb | 31 +++++--- spec/classes/php_repo_ubuntu_spec.rb | 8 +- spec/classes/php_spec.rb | 54 ++++++++----- spec/defines/config_spec.rb | 110 +++++++++++++++++++-------- spec/defines/extension_spec.rb | 9 ++- spec/defines/fpm_pool_spec.rb | 20 +++-- 13 files changed, 339 insertions(+), 124 deletions(-) diff --git a/README.md b/README.md index c3cf003d..16370f2f 100644 --- a/README.md +++ b/README.md @@ -187,12 +187,30 @@ older though still supported distribution release. Our default is to have Ubuntu with packages for the current stable PHP version closely tracking upstream. -To use an alternate PPA, Ondrej's PHP 5.6 for example, use the below hiera snippet +To use an alternate PPA, Ondřej's PHP 5.6 for example, use the below hiera snippet ```yaml -php::repo::ubuntu::ppa: 'ondrej/php5-5.6' +php::repo::ubuntu::ppa: 'ondrej/php' php::manage_repos: true ``` +### Ubuntu systems and Ondřej's PPA + +The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6) +in favor of a new PPA: ondrej/php which contains all 3 versions of PHP: 5.5, 5.6, and 7.0 +Here's an example in hiera of getting PHP 5.6 installed with php-fpm, pear/pecl, and composer: + +``` +php::globals::php_version: '5.6' +php::fpm: true +php::dev: true +php::composer: true +php::pear: true +php::phpunit: false +``` + +If you do not specify a php version, in Ubuntu the default will be 7.0 if you are +running Xenial (16.04), otherwise PHP 5.6 will be installed (for other versions) + ### Apache support Apache with `mod_php` is not supported by this module. Please use diff --git a/manifests/dev.pp b/manifests/dev.pp index 91ee13da..ce6d2f60 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -26,8 +26,17 @@ default => $package, } - package { $real_package: - ensure => $ensure, - require => Class['::php::packages'], + if $::operatingsystem == 'Ubuntu' { + ensure_packages(["${php::globals::package_prefix}xml"]) + + package { $real_package: + ensure => $ensure, + require => Class['::php::packages'], + } + } else { + package { $real_package: + ensure => $ensure, + require => Class['::php::packages'], + } } } diff --git a/manifests/globals.pp b/manifests/globals.pp index e39d12a3..030103b9 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -23,7 +23,7 @@ 'Debian' => $::operatingsystem ? { 'Ubuntu' => $::operatingsystemrelease ? { /^(16.04)$/ => '7.0', - default => '5.x', + default => '5.6', }, default => '5.x', }, @@ -34,24 +34,74 @@ case $::osfamily { 'Debian': { - case $globals_php_version { - /^7/: { - $default_config_root = "/etc/php/${globals_php_version}" - $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php-' + if $::operatingsystem == 'Ubuntu' { + case $globals_php_version { + /^5\.4/: { + $default_config_root = '/etc/php5' + $fpm_pid_file = '/var/run/php5-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-' + } + /^5\.5/: { + $default_config_root = "/etc/php/${globals_php_version}" + $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php5.5-' + } + /^5\.6/: { + $default_config_root = "/etc/php/${globals_php_version}" + $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php5.6-' + } + /^7/: { + $default_config_root = "/etc/php/${globals_php_version}" + $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php7.0-' + } + default: { + $default_config_root = "/etc/php/${globals_php_version}" + $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php-' + } } - default: { - $default_config_root = '/etc/php5' - $fpm_pid_file = '/var/run/php5-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-' + } else { + case $globals_php_version { + /^7/: { + $default_config_root = "/etc/php/${globals_php_version}" + $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php-' + } + default: { + $default_config_root = '/etc/php5' + $fpm_pid_file = '/var/run/php5-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-' + } } } } diff --git a/manifests/packages.pp b/manifests/packages.pp index d423eadd..7e83a3ad 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -29,7 +29,14 @@ validate_array($names_to_prefix) $real_names = union($names, $names_to_prefix) - package { $real_names: - ensure => $ensure, + if $::operatingsystem == 'Ubuntu' { + package { $real_names: + ensure => $ensure, + require => Class['::php::repo'], + } + } else { + package { $real_names: + ensure => $ensure, + } } } diff --git a/manifests/pear.pp b/manifests/pear.pp index 84c97601..de8ae2ee 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -43,9 +43,18 @@ validate_string($ensure) validate_string($package_name) - package { $package_name: - ensure => $ensure, - require => Class['::php::cli'], - } + if $::operatingsystem == 'Ubuntu' { + + ensure_packages(["${php::globals::package_prefix}xml"]) + package { $package_name: + ensure => $ensure, + require => [Class['::php::repo'],Class['::php::cli'],Package["${php::globals::package_prefix}xml"]], + } + } else { + package { $package_name: + ensure => $ensure, + require => Class['::php::cli'], + } + } } diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 2b194867..3b8afd84 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -6,7 +6,7 @@ # PHP version to manage (e.g. 5.6) # # [*ppa*] -# Use a specific PPA, e.g "ondrej/php5-5.6" (without the "ppa:") +# Use a specific PPA, e.g "ondrej/php" (without the "ppa:") # class php::repo::ubuntu ( $version = undef, @@ -24,8 +24,8 @@ $version_repo = $version_real ? { '5.4' => 'ondrej/php5-oldstable', - '5.5' => 'ondrej/php5', - '5.6' => 'ondrej/php5-5.6', + '5.5' => 'ondrej/php', + '5.6' => 'ondrej/php', '7.0' => 'ondrej/php' } @@ -34,8 +34,12 @@ } if ($ppa) { - ::apt::ppa { "ppa:${ppa}": } + ::apt::ppa { "ppa:${ppa}": + before => [Class['::php::packages'],Class['::php::pear'],Class['::php::dev']], + } } else { - ::apt::ppa { "ppa:${version_repo}": } + ::apt::ppa { "ppa:${version_repo}": + before => [Class['::php::packages'],Class['::php::pear'],Class['::php::dev']], + } } } diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index b31fd4fa..f17f9042 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -7,28 +7,54 @@ facts end - describe 'creates config file' do - let(:params) {{ - :inifile => '/etc/php5/conf.d/unique-name.ini', - :settings => { - 'apc.enabled' => 1, - }, - }} + case facts[:operatingsystem] + when 'Ubuntu' + describe 'creates config file' do + let(:params) {{ + :inifile => '/etc/php/5.6/conf.d/unique-name.ini', + :settings => { + 'apc.enabled' => 1, + }, + }} - it { should contain_class('php::fpm::config').with({ - :inifile => '/etc/php5/conf.d/unique-name.ini', - :settings => { - 'apc.enabled' => 1, - }, - })} + it { should contain_class('php::fpm::config').with({ + :inifile => '/etc/php/5.6/conf.d/unique-name.ini', + :settings => { + 'apc.enabled' => 1, + }, + })} - it { should contain_php__config('fpm').with({ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => { - 'apc.enabled' => 1, - }, - })} - end + it { should contain_php__config('fpm').with({ + :file => '/etc/php/5.6/conf.d/unique-name.ini', + :config => { + 'apc.enabled' => 1, + }, + })} + end + else + describe 'creates config file' do + let(:params) {{ + :inifile => '/etc/php5/conf.d/unique-name.ini', + :settings => { + 'apc.enabled' => 1, + }, + }} + + it { should contain_class('php::fpm::config').with({ + :inifile => '/etc/php5/conf.d/unique-name.ini', + :settings => { + 'apc.enabled' => 1, + }, + })} + + it { should contain_php__config('fpm').with({ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => { + 'apc.enabled' => 1, + }, + })} + end + end end end end diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index e45ee4ce..5a39bfa9 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -10,15 +10,28 @@ describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' - let(:params) { { :package => 'php5-fpm', :ensure => 'latest' } } - it { - should contain_package('php5-fpm').with({ - 'ensure' => 'latest', - }) - should contain_service('php5-fpm').with({ - 'ensure' => 'running', - }) - } + case facts[:operatingsystem] + when 'Ubuntu' + let(:params) { { :package => 'php5.6-fpm', :ensure => 'latest' } } + it { + should contain_package('php5.6-fpm').with({ + 'ensure' => 'latest', + }) + should contain_service('php5.6-fpm').with({ + 'ensure' => 'running', + }) + } + when 'Debian' + let(:params) { { :package => 'php5-fpm', :ensure => 'latest' } } + it { + should contain_package('php5-fpm').with({ + 'ensure' => 'latest', + }) + should contain_service('php5-fpm').with({ + 'ensure' => 'running', + }) + } + end else it { should contain_service('php-fpm').with({ diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index 7f9ea82f..923ddfa2 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -11,7 +11,7 @@ when 'trusty' describe 'when called with no parameters on Ubuntu trusty' do it { - should contain_exec('add-apt-repository-ppa:ondrej/php5') + should contain_exec('add-apt-repository-ppa:ondrej/php') } end @@ -26,17 +26,17 @@ describe 'when call with parameter ppa without prefix "ppa:" on Ubuntu trusty' do let(:params) {{ - :ppa => 'ondrej/php5-5.6' + :ppa => 'ondrej/php' }} it { - should contain_exec('add-apt-repository-ppa:ondrej/php5-5.6') + should contain_exec('add-apt-repository-ppa:ondrej/php') } end describe 'when call with parameter ppa and version on Ubuntu trusty' do let(:params) {{ :version => '5.4', - :ppa => 'ondrej/php5-5.6' + :ppa => 'ondrej/php5-oldstable' }} it { expect { should raise_error(Puppet::Error) }} end diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index e2ea9305..e3ff8ec6 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -10,23 +10,43 @@ describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' - it { - should_not contain_class('php::global') - should contain_class('php::fpm') - should contain_package('php5-cli').with({ - 'ensure' => 'present', - }) - should contain_package('php5-fpm').with({ - 'ensure' => 'present', - }) - should contain_package('php5-dev').with({ - 'ensure' => 'present', - }) - should contain_package('php-pear').with({ - 'ensure' => 'present', - }) - should contain_class('php::composer') - } + case facts[:operatingsystem] + when 'Ubuntu' + it { + should contain_class('php::fpm') + should contain_package('php5.6-cli').with({ + 'ensure' => 'present', + }) + should contain_package('php5.6-fpm').with({ + 'ensure' => 'present', + }) + should contain_package('php5.6-dev').with({ + 'ensure' => 'present', + }) + should contain_package('php-pear').with({ + 'ensure' => 'present', + }) + should contain_class('php::composer') + } + when 'Debian' + it { + should_not contain_class('php::global') + should contain_class('php::fpm') + should contain_package('php5-cli').with({ + 'ensure' => 'present', + }) + should contain_package('php5-fpm').with({ + 'ensure' => 'present', + }) + should contain_package('php5-dev').with({ + 'ensure' => 'present', + }) + should contain_package('php-pear').with({ + 'ensure' => 'present', + }) + should contain_class('php::composer') + } + end when 'Suse' it { should contain_class('php::global') diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index 1e8536a7..b40d9e4d 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -6,45 +6,89 @@ let :facts do facts end - context 'default config' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => {} - }} - end - context 'simple example' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => { - 'apc.enabled' => 1 - } - }} + case facts[:operatingsystem] + when 'Ubuntu' + context 'default config' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php/5.6/conf.d/unique-name.ini', + :config => {} + }} + end - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} - end + context 'simple example' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php/5.6/conf.d/unique-name.ini', + :config => { + 'apc.enabled' => 1 + } + }} - context 'empty array' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => {} - }} + it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'})} + end - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} - end + context 'empty array' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php/5.6/conf.d/unique-name.ini', + :config => {} + }} + + it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'})} + end + + context 'invalid config (string)' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php/5.6/conf.d/unique-name.ini', + :config => 'hello world' + }} + + it { expect { should raise_error(Puppet::Error) }} + end + else + context 'default config' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => {} + }} + end + + context 'simple example' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => { + 'apc.enabled' => 1 + } + }} + + it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} + end + + context 'empty array' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => {} + }} + + it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} + end - context 'invalid config (string)' do - let(:title) { 'unique-name' } - let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => 'hello world' - }} + context 'invalid config (string)' do + let(:title) { 'unique-name' } + let(:params) {{ + :file => '/etc/php5/conf.d/unique-name.ini', + :config => 'hello world' + }} - it { expect { should raise_error(Puppet::Error) }} + it { expect { should raise_error(Puppet::Error) }} + end end end end -end \ No newline at end of file +end diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 27d4de11..870e4866 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -11,7 +11,12 @@ unless (facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD') # FIXME - something is wrong on these case facts[:osfamily] when 'Debian' - etcdir = '/etc/php5/mods-available' + case facts[:operatingsystem] + when 'Ubuntu' + etcdir = '/etc/php/5.6/mods-available' + else + etcdir = '/etc/php5/mods-available' + end else etcdir = '/etc/php.d' end @@ -173,4 +178,4 @@ end end end -end \ No newline at end of file +end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index 750525c6..c0ae9f19 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -8,13 +8,23 @@ end case facts[:osfamily] when 'Debian' - context 'plain config' do - let(:title) { 'unique-name' } - let(:params) {{ }} + case facts[:operatingsystem] + when 'Ubuntu' + context 'plain config' do + let(:title) { 'unique-name' } + let(:params) {{ }} - it { should contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } + it { should contain_file('/etc/php/5.6/fpm/pool.d/unique-name.conf') } + end + when 'Debian' + context 'plain config' do + let(:title) { 'unique-name' } + let(:params) {{ }} + + it { should contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } + end end end end end -end \ No newline at end of file +end From ffc3f2c8d796a0cb98ac7917d69b2ab3be4fe566 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Mon, 13 Jun 2016 15:26:28 +0200 Subject: [PATCH 047/221] stop using LSB facts (#198) closes GH-184 --- manifests/fpm.pp | 3 +-- manifests/fpm/service.pp | 7 ++----- manifests/params.pp | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index e81306c6..6f224268 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -95,8 +95,7 @@ # Create an override to use a reload signal as trusty and utopic's # upstart version supports this - if $::osfamily == 'Debian' and - ($::lsbdistcodename == 'trusty' or $::lsbdistcodename == 'utopic') { + if $::operatingsystem == 'Ubuntu' and ($::operatingsystemmajrelease == '14.04' or $::operatingsystemmajrelease == '14.10') { if ($service_enable) { $fpm_override = 'reload signal USR2' } diff --git a/manifests/fpm/service.pp b/manifests/fpm/service.pp index 62aac44b..0026f57d 100644 --- a/manifests/fpm/service.pp +++ b/manifests/fpm/service.pp @@ -23,13 +23,10 @@ $reload = "service ${service_name} reload" - if $::osfamily == 'Debian' { + if $::operatingsystem == 'Ubuntu' and $::operatingsystemmajrelease == '12.04' { # Precise upstart doesn't support reload signals, so use # regular service restart instead - $restart = $::lsbdistcodename ? { - 'precise' => undef, - default => $reload - } + $restart = undef } else { $restart = $reload } diff --git a/manifests/params.pp b/manifests/params.pp index 683f7d47..3d58ccf6 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -43,7 +43,7 @@ case $::operatingsystem { 'Debian': { - $manage_repos = $::lsbdistcodename == 'wheezy' + $manage_repos = (versioncmp($::operatingsystemrelease, '8') < 0) } 'Ubuntu': { From 7967a6490d95b4638f46e7731fdbd0be3e717484 Mon Sep 17 00:00:00 2001 From: tdm4 Date: Tue, 14 Jun 2016 13:54:33 +0100 Subject: [PATCH 048/221] Fix repo refresh (#199) * Ensure that the PPA repo has been added and refreshed before installing any packages * Fix ::apt::update dependency for xml package in pear.pp --- manifests/dev.pp | 5 ++++- manifests/packages.pp | 2 +- manifests/pear.pp | 8 +++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/manifests/dev.pp b/manifests/dev.pp index ce6d2f60..8d9d5e45 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -27,7 +27,10 @@ } if $::operatingsystem == 'Ubuntu' { - ensure_packages(["${php::globals::package_prefix}xml"]) + ensure_packages(["${php::globals::package_prefix}xml"], { + ensure => present, + require => Class['::apt::update'], + }) package { $real_package: ensure => $ensure, diff --git a/manifests/packages.pp b/manifests/packages.pp index 7e83a3ad..58dec754 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -32,7 +32,7 @@ if $::operatingsystem == 'Ubuntu' { package { $real_names: ensure => $ensure, - require => Class['::php::repo'], + require => Class['::apt::update'], } } else { package { $real_names: diff --git a/manifests/pear.pp b/manifests/pear.pp index de8ae2ee..526797b9 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -44,12 +44,14 @@ validate_string($package_name) if $::operatingsystem == 'Ubuntu' { - - ensure_packages(["${php::globals::package_prefix}xml"]) + ensure_packages(["${php::globals::package_prefix}xml"], { + ensure => present, + require => Class['::apt::update'], + }) package { $package_name: ensure => $ensure, - require => [Class['::php::repo'],Class['::php::cli'],Package["${php::globals::package_prefix}xml"]], + require => [Class['::apt::update'],Class['::php::cli'],Package["${php::globals::package_prefix}xml"]], } } else { package { $package_name: From 1687647097725008f0325a244ca0baa225afa634 Mon Sep 17 00:00:00 2001 From: Sebastian Reitenbach Date: Tue, 14 Jun 2016 16:24:06 +0200 Subject: [PATCH 049/221] Fixup naming of xml package for Ubuntu, when the package_prefix is (#200) set as parameter to init.pp to some non-default Also spec for xml package add spec test for package_prefix --- manifests/dev.pp | 2 +- manifests/pear.pp | 4 +-- spec/classes/php_spec.rb | 70 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 3 deletions(-) diff --git a/manifests/dev.pp b/manifests/dev.pp index 8d9d5e45..212768f7 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -27,7 +27,7 @@ } if $::operatingsystem == 'Ubuntu' { - ensure_packages(["${php::globals::package_prefix}xml"], { + ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], }) diff --git a/manifests/pear.pp b/manifests/pear.pp index 526797b9..8c507201 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -44,14 +44,14 @@ validate_string($package_name) if $::operatingsystem == 'Ubuntu' { - ensure_packages(["${php::globals::package_prefix}xml"], { + ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], }) package { $package_name: ensure => $ensure, - require => [Class['::apt::update'],Class['::php::cli'],Package["${php::globals::package_prefix}xml"]], + require => [Class['::apt::update'],Class['::php::cli'],Package["${php::package_prefix}xml"]], } } else { package { $package_name: diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index e3ff8ec6..b8b4a83b 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -20,9 +20,14 @@ should contain_package('php5.6-fpm').with({ 'ensure' => 'present', }) + should contain_class('php::dev') should contain_package('php5.6-dev').with({ 'ensure' => 'present', }) + # The -xml package is enforced via the dev class + should contain_package('php5.6-xml').with({ + 'ensure' => 'present', + }) should contain_package('php-pear').with({ 'ensure' => 'present', }) @@ -66,6 +71,71 @@ end end + describe 'when called with package_prefix parameter' do + let(:params) { { :package_prefix => 'myphp-', } } + case facts[:osfamily] + when 'Debian' + case facts[:operatingsystem] + when 'Ubuntu' + it { + should contain_class('php::fpm') + should contain_package('myphp-cli').with({ + 'ensure' => 'present', + }) + should contain_package('myphp-fpm').with({ + 'ensure' => 'present', + }) + should contain_class('php::dev') + should contain_package('myphp-dev').with({ + 'ensure' => 'present', + }) + # The -xml package is enforced via the dev class + should contain_package('myphp-xml').with({ + 'ensure' => 'present', + }) + should contain_package('php-pear').with({ + 'ensure' => 'present', + }) + should contain_class('php::composer') + } + when 'Debian' + it { + should_not contain_class('php::global') + should contain_class('php::fpm') + should contain_package('myphp-cli').with({ + 'ensure' => 'present', + }) + should contain_package('myphp-fpm').with({ + 'ensure' => 'present', + }) + should contain_package('myphp-dev').with({ + 'ensure' => 'present', + }) + should contain_package('php-pear').with({ + 'ensure' => 'present', + }) + should contain_class('php::composer') + } + end + when 'Suse' + it { + should contain_class('php::global') + should contain_package('php5').with({ + 'ensure' => 'present', + }) + should contain_package('myphp-devel').with({ + 'ensure' => 'present', + }) + should contain_package('myphp-pear').with({ + 'ensure' => 'present', + }) + should_not contain_package('myphp-cli') + should_not contain_package('myphp-dev') + should_not contain_package('php-pear') + } + end + end + describe 'when fpm is disabled' do let(:params) { { :fpm => false, } } it { From ab8089269dadc721387e0dfe73a87442e2d1a687 Mon Sep 17 00:00:00 2001 From: Sebastian Reitenbach Date: Thu, 16 Jun 2016 11:35:25 +0200 Subject: [PATCH 050/221] Allow to specify a fpm_service_provider, to allow using non-default (#204) service provider for fpm. --- manifests/fpm.pp | 7 +++++ manifests/fpm/service.pp | 5 ++++ manifests/init.pp | 61 ++++++++++++++++++++++------------------ 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 6f224268..825453f7 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -12,6 +12,11 @@ # This is the name of the php-fpm service. It defaults to reasonable OS # defaults but can be different in case of using php7.0/other OS/custom fpm service # +# [*service_provider*] +# This is the name of the service provider, in case there is a non +# OS default service provider used to start FPM. +# Defaults to 'undef', pick system defaults. +# # [*pools*] # Hash of php::fpm::pool resources that will be created. Defaults # to a single php::fpm::pool named www with default parameters. @@ -43,6 +48,7 @@ $service_ensure = $::php::params::fpm_service_ensure, $service_enable = $::php::params::fpm_service_enable, $service_name = $::php::params::fpm_service_name, + $service_provider = undef, $package = "${::php::package_prefix}${::php::params::fpm_package_suffix}", $inifile = $::php::params::fpm_inifile, $settings = {}, @@ -86,6 +92,7 @@ ensure => $service_ensure, enable => $service_enable, service_name => $service_name, + provider => $service_provider, } -> anchor { '::php::fpm::end': } diff --git a/manifests/fpm/service.pp b/manifests/fpm/service.pp index 0026f57d..d8bcecd7 100644 --- a/manifests/fpm/service.pp +++ b/manifests/fpm/service.pp @@ -11,10 +11,14 @@ # [*enable*] # Defines if the service is enabled # +# [*provider*] +# Defines if the service provider to use +# class php::fpm::service( $service_name = $::php::params::fpm_service_name, $ensure = $::php::params::fpm_service_ensure, $enable = $::php::params::fpm_service_enable, + $provider = undef, ) inherits ::php::params { if $caller_module_name != $module_name { @@ -34,6 +38,7 @@ service { $service_name: ensure => $ensure, enable => $enable, + provider => $provider, hasrestart => true, restart => $restart, hasstatus => true, diff --git a/manifests/init.pp b/manifests/init.pp index 2d5010ce..8392a21d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,6 +23,11 @@ # This is the name of the php-fpm service. It defaults to reasonable OS # defaults but can be different in case of using php7.0/other OS/custom fpm service # +# [*fpm_service_provider*] +# This is the name of the service provider, in case there is a non +# OS default service provider used to start FPM. +# Defaults to 'undef', pick system defaults. +# # [*dev*] # Install php header files, needed to install pecl modules # @@ -75,27 +80,28 @@ # [*settings*] # class php ( - $ensure = $::php::params::ensure, - $manage_repos = $::php::params::manage_repos, - $fpm = true, - $fpm_service_enable = $::php::params::fpm_service_enable, - $fpm_service_ensure = $::php::params::fpm_service_ensure, - $fpm_service_name = $::php::params::fpm_service_name, - $embedded = false, - $dev = true, - $composer = true, - $pear = true, - $pear_ensure = $::php::params::pear_ensure, - $phpunit = false, - $extensions = {}, - $settings = {}, - $package_prefix = $::php::params::package_prefix, - $config_root_ini = $::php::params::config_root_ini, - $ext_tool_enable = $::php::params::ext_tool_enable, - $ext_tool_query = $::php::params::ext_tool_query, - $ext_tool_enabled = $::php::params::ext_tool_enabled, - $log_owner = $::php::params::fpm_user, - $log_group = $::php::params::fpm_group, + $ensure = $::php::params::ensure, + $manage_repos = $::php::params::manage_repos, + $fpm = true, + $fpm_service_enable = $::php::params::fpm_service_enable, + $fpm_service_ensure = $::php::params::fpm_service_ensure, + $fpm_service_name = $::php::params::fpm_service_name, + $fpm_service_provider = undef, + $embedded = false, + $dev = true, + $composer = true, + $pear = true, + $pear_ensure = $::php::params::pear_ensure, + $phpunit = false, + $extensions = {}, + $settings = {}, + $package_prefix = $::php::params::package_prefix, + $config_root_ini = $::php::params::config_root_ini, + $ext_tool_enable = $::php::params::ext_tool_enable, + $ext_tool_query = $::php::params::ext_tool_query, + $ext_tool_enabled = $::php::params::ext_tool_enabled, + $log_owner = $::php::params::fpm_user, + $log_group = $::php::params::fpm_group, ) inherits ::php::params { validate_string($ensure) @@ -153,12 +159,13 @@ if $fpm { Anchor['php::begin'] -> class { '::php::fpm': - service_enable => $fpm_service_enable, - service_ensure => $fpm_service_ensure, - service_name => $fpm_service_name, - settings => $real_settings, - log_owner => $log_owner, - log_group => $log_group, + service_enable => $fpm_service_enable, + service_ensure => $fpm_service_ensure, + service_name => $fpm_service_name, + service_provider => $fpm_service_provider, + settings => $real_settings, + log_owner => $log_owner, + log_group => $log_group, } -> Anchor['php::end'] } From b3421bee9bcfc0995cf2eb3dbb253f7d4ef0ef74 Mon Sep 17 00:00:00 2001 From: Will Dowling Date: Thu, 16 Jun 2016 17:36:03 +0800 Subject: [PATCH 051/221] #202 - Replace resources with function call to (#203) --- manifests/extension.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index 4b8823fb..9c94a2e4 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -101,7 +101,7 @@ } if $provider == 'pecl' { - package { $real_package: + ensure_packages( [ $real_package ], { ensure => $ensure, provider => $provider, source => $real_source, @@ -109,7 +109,7 @@ Class['::php::pear'], Class['::php::dev'], ], - } + }) unless empty($compiler_packages) { ensure_resource('package', $compiler_packages) @@ -117,11 +117,11 @@ } } else { - package { $real_package: + ensure_packages( [ $real_package ], { ensure => $ensure, provider => $provider, source => $real_source, - } + }) } } From 3901467312500414616dcfc86c8d0f2bfc3ec0f8 Mon Sep 17 00:00:00 2001 From: aschrapel Date: Tue, 7 Jun 2016 10:48:21 +0200 Subject: [PATCH 052/221] correct php7 package prefix on Debian --- manifests/globals.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index 030103b9..e7d6d817 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -91,7 +91,7 @@ $fpm_service_name = "php${globals_php_version}-fpm" $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php-' + $package_prefix = 'php7.0-' } default: { $default_config_root = '/etc/php5' From 7d32449ba9c1005c64390d0be5f32d752057beaa Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Mon, 20 Jun 2016 09:52:51 +0200 Subject: [PATCH 053/221] remove superfluous requires (#206) fixes GH-205 --- manifests/repo/ubuntu.pp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 3b8afd84..4bcabbe3 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -34,12 +34,8 @@ } if ($ppa) { - ::apt::ppa { "ppa:${ppa}": - before => [Class['::php::packages'],Class['::php::pear'],Class['::php::dev']], - } + ::apt::ppa { "ppa:${ppa}": } } else { - ::apt::ppa { "ppa:${version_repo}": - before => [Class['::php::packages'],Class['::php::pear'],Class['::php::dev']], - } + ::apt::ppa { "ppa:${version_repo}": } } } From 036c2c38eb3fafd33005c8f45c84694e3a4cf829 Mon Sep 17 00:00:00 2001 From: adamcousins Date: Mon, 20 Jun 2016 20:55:58 +1000 Subject: [PATCH 054/221] allow to pass a pid file path (#189) --- manifests/fpm.pp | 4 +- manifests/globals.pp | 121 ++++++++++++++++++++++++------------------- manifests/params.pp | 8 +-- 3 files changed, 73 insertions(+), 60 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 825453f7..84bcc0df 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -12,7 +12,7 @@ # This is the name of the php-fpm service. It defaults to reasonable OS # defaults but can be different in case of using php7.0/other OS/custom fpm service # -# [*service_provider*] +# [*service_provider*] # This is the name of the service provider, in case there is a non # OS default service provider used to start FPM. # Defaults to 'undef', pick system defaults. @@ -55,7 +55,7 @@ $global_pool_settings = {}, $pools = { 'www' => {} }, $log_owner = $::php::params::fpm_user, - $log_group = $::php::params::fpm_group + $log_group = $::php::params::fpm_group, ) inherits ::php::params { if $caller_module_name != $module_name { diff --git a/manifests/globals.pp b/manifests/globals.pp index e7d6d817..ed979ce4 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -8,9 +8,13 @@ # [*config_root*] # The configuration root directory. # +# [*fpm_pid_file*] +# Path to pid file for fpm + class php::globals ( - $php_version = undef, - $config_root = undef, + $php_version = undef, + $config_root = undef, + $fpm_pid_file = undef, ) { if $php_version != undef { validate_re($php_version, '^[57].[0-9]') @@ -19,6 +23,10 @@ validate_absolute_path($config_root) } + if $fpm_pid_file != undef { + validate_absolute_path($fpm_pid_file) + } + $default_php_version = $::osfamily ? { 'Debian' => $::operatingsystem ? { 'Ubuntu' => $::operatingsystemrelease ? { @@ -37,82 +45,85 @@ if $::operatingsystem == 'Ubuntu' { case $globals_php_version { /^5\.4/: { - $default_config_root = '/etc/php5' - $fpm_pid_file = '/var/run/php5-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-' + $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-' } /^5\.5/: { - $default_config_root = "/etc/php/${globals_php_version}" - $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php5.5-' + $default_config_root = "/etc/php/${globals_php_version}" + $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php5.5-' } /^5\.6/: { - $default_config_root = "/etc/php/${globals_php_version}" - $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php5.6-' + $default_config_root = "/etc/php/${globals_php_version}" + $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php5.6-' } /^7/: { - $default_config_root = "/etc/php/${globals_php_version}" - $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php7.0-' + $default_config_root = "/etc/php/${globals_php_version}" + $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php7.0-' } default: { - $default_config_root = "/etc/php/${globals_php_version}" - $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php-' + $default_config_root = "/etc/php/${globals_php_version}" + $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php-' } } } else { case $globals_php_version { /^7/: { - $default_config_root = "/etc/php/${globals_php_version}" - $fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php7.0-' + $default_config_root = "/etc/php/${globals_php_version}" + $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" + $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" + $fpm_service_name = "php${globals_php_version}-fpm" + $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" + $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" + $package_prefix = 'php7.0-' } default: { - $default_config_root = '/etc/php5' - $fpm_pid_file = '/var/run/php5-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-' + $default_config_root = '/etc/php5' + $default_fpm_pid_file = '/var/run/php5-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-' } } } } 'Suse': { - $default_config_root = '/etc/php5' + $default_config_root = '/etc/php5' + $default_fpm_pid_file = '/var/run/php5-fpm.pid' } 'RedHat': { - $default_config_root = '/etc/php.d' + $default_config_root = '/etc/php.d' + $default_fpm_pid_file = '/var/run/php-fpm/php-fpm.pid' } 'FreeBSD': { - $default_config_root = '/usr/local/etc' + $default_config_root = '/usr/local/etc' + $default_fpm_pid_file = '/var/run/php-fpm.pid' } default: { fail("Unsupported osfamily: ${::osfamily}") @@ -120,4 +131,6 @@ } $globals_config_root = pick($config_root, $default_config_root) + + $globals_fpm_pid_file = pick($fpm_pid_file, $default_fpm_pid_file) } diff --git a/manifests/params.pp b/manifests/params.pp index 3d58ccf6..57d4f2ba 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -23,7 +23,7 @@ $common_package_suffixes = ['cli', 'common'] $cli_inifile = "${config_root}/cli/php.ini" $dev_package_suffix = 'dev' - $fpm_pid_file = $php::globals::fpm_pid_file + $fpm_pid_file = $php::globals::globals_fpm_pid_file $fpm_config_file = "${config_root}/fpm/php-fpm.conf" $fpm_error_log = $php::globals::fpm_error_log $fpm_inifile = "${config_root}/fpm/php.ini" @@ -64,7 +64,7 @@ $common_package_suffixes = [] $cli_inifile = "${config_root}/cli/php.ini" $dev_package_suffix = 'devel' - $fpm_pid_file = '/var/run/php5-fpm.pid' + $fpm_pid_file = $php::globals::globals_fpm_pid_file $fpm_config_file = "${config_root}/fpm/php-fpm.conf" $fpm_error_log = '/var/log/php5-fpm.log' $fpm_inifile = "${config_root}/fpm/php.ini" @@ -98,7 +98,7 @@ $common_package_suffixes = ['cli', 'common'] $cli_inifile = '/etc/php-cli.ini' $dev_package_suffix = 'devel' - $fpm_pid_file = '/var/run/php-fpm/php-fpm.pid' + $fpm_pid_file = $php::globals::globals_fpm_pid_file $fpm_config_file = '/etc/php-fpm.conf' $fpm_error_log = '/var/log/php-fpm/error.log' $fpm_inifile = '/etc/php-fpm.ini' @@ -126,7 +126,7 @@ $common_package_suffixes = ['extensions'] $cli_inifile = "${config_root}/php-cli.ini" $dev_package_suffix = undef - $fpm_pid_file = '/var/run/php-fpm.pid' + $fpm_pid_file = $php::globals::globals_fpm_pid_file $fpm_config_file = "${config_root}/php-fpm.conf" $fpm_error_log = '/var/log/php-fpm.log' $fpm_inifile = "${config_root}/php-fpm.ini" From 3533d91e58d6de5b9111b121e733b093df1c8464 Mon Sep 17 00:00:00 2001 From: Oleg Ginzburg Date: Tue, 21 Jun 2016 17:22:09 +0400 Subject: [PATCH 055/221] add FreeBSD case in repo.pp (#216) The correct repository is already present in a stock install. --- manifests/repo.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/repo.pp b/manifests/repo.pp index 7a4f73f8..004a8264 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -19,6 +19,7 @@ } } } + 'FreeBSD': {} 'Suse': { contain ::php::repo::suse } From ace58db43148ccbb0e14be065e3bf793699988c3 Mon Sep 17 00:00:00 2001 From: tdm4 Date: Thu, 23 Jun 2016 09:57:05 +0100 Subject: [PATCH 056/221] Remove php::repo::ubuntu::ppa (#218) fixes GH-214 --- README.md | 6 ------ manifests/repo/ubuntu.pp | 14 +------------- spec/classes/php_repo_ubuntu_spec.rb | 9 ++++----- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 16370f2f..89386c44 100644 --- a/README.md +++ b/README.md @@ -187,12 +187,6 @@ older though still supported distribution release. Our default is to have Ubuntu with packages for the current stable PHP version closely tracking upstream. -To use an alternate PPA, Ondřej's PHP 5.6 for example, use the below hiera snippet -```yaml -php::repo::ubuntu::ppa: 'ondrej/php' -php::manage_repos: true -``` - ### Ubuntu systems and Ondřej's PPA The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6) diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 4bcabbe3..8329aff3 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -5,12 +5,8 @@ # [*version*] # PHP version to manage (e.g. 5.6) # -# [*ppa*] -# Use a specific PPA, e.g "ondrej/php" (without the "ppa:") -# class php::repo::ubuntu ( $version = undef, - $ppa = undef, ) { include '::apt' @@ -29,13 +25,5 @@ '7.0' => 'ondrej/php' } - if ($version != undef and $ppa != undef) { - fail('Only one of $version and $ppa can be specified.') - } - - if ($ppa) { - ::apt::ppa { "ppa:${ppa}": } - } else { - ::apt::ppa { "ppa:${version_repo}": } - } + ::apt::ppa { "ppa:${version_repo}": } } diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index 923ddfa2..0ab5a378 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -15,7 +15,7 @@ } end - describe 'when called with parameter oldstable on Ubuntu trusty' do + describe 'when called with version 7.0 on Ubuntu trusty' do let(:params) {{ :version => '7.0' }} @@ -24,19 +24,18 @@ } end - describe 'when call with parameter ppa without prefix "ppa:" on Ubuntu trusty' do + describe 'when call with version 5.6 on Ubuntu trusty' do let(:params) {{ - :ppa => 'ondrej/php' + :version => '5.6' }} it { should contain_exec('add-apt-repository-ppa:ondrej/php') } end - describe 'when call with parameter ppa and version on Ubuntu trusty' do + describe 'when call with version 5.4 on Ubuntu trusty' do let(:params) {{ :version => '5.4', - :ppa => 'ondrej/php5-oldstable' }} it { expect { should raise_error(Puppet::Error) }} end From f66f8a06effc6f000f0c513a017e78b0066d5813 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Thu, 23 Jun 2016 19:20:20 +0200 Subject: [PATCH 057/221] remove broken beaker tests, update puppet-lint --- .puppet-lint.rc | 1 - .travis.yml | 6 ++-- Gemfile | 17 +++++------ Rakefile | 16 +---------- manifests/extension.pp | 2 +- spec/acceptance/nodesets/centos65.yml | 9 ------ spec/acceptance/nodesets/debian7.yml | 9 ------ spec/acceptance/nodesets/sles11sp3.yml | 9 ------ spec/acceptance/nodesets/ubuntu1404.yml | 9 ------ spec/acceptance/php_install_spec.rb | 27 ------------------ spec/spec_helper_acceptance.rb | 38 ------------------------- 11 files changed, 12 insertions(+), 131 deletions(-) delete mode 100644 spec/acceptance/nodesets/centos65.yml delete mode 100644 spec/acceptance/nodesets/debian7.yml delete mode 100644 spec/acceptance/nodesets/sles11sp3.yml delete mode 100644 spec/acceptance/nodesets/ubuntu1404.yml delete mode 100644 spec/acceptance/php_install_spec.rb delete mode 100644 spec/spec_helper_acceptance.rb diff --git a/.puppet-lint.rc b/.puppet-lint.rc index 50816ba3..33d6a853 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,2 @@ --fail-on-warnings ---no-80chars-check --no-class_inherits_from_params_class-check diff --git a/.travis.yml b/.travis.yml index e505738f..be24d3fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ rvm: - 1.9.3 env: matrix: - - PUPPET_VERSION=4.3.1 + - PUPPET_VERSION=4.3.2 - PUPPET_VERSION=3.8.7 - PUPPET_VERSION=3.8.7 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes global: @@ -19,9 +19,9 @@ matrix: - rvm: 2.1.6 env: PUPPET_VERSION=3.8.7 DOCS=true - rvm: 2.2.3 - env: PUPPET_VERSION=4.3.1 + env: PUPPET_VERSION=4.3.2 - rvm: 2.3.0 - env: PUPPET_VERSION=4.5.1 + env: PUPPET_VERSION=4.5.2 after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && diff --git a/Gemfile b/Gemfile index 6bc77111..d02af4da 100644 --- a/Gemfile +++ b/Gemfile @@ -7,20 +7,17 @@ group :development, :test do gem 'rspec-puppet-facts' gem 'puppetlabs_spec_helper' gem 'puppet-module' - #gem 'beaker', :github => 'Mayflower/beaker', :branch => 'master' - gem 'beaker-rspec' - gem 'pry' gem 'yard' - gem 'puppet-lint' - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-empty_string-check' - gem 'puppet-lint-variable_contains_upcase' + gem 'puppet-lint', '~> 2.0' gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-undef_in_function-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-trailing_comma-check' + gem 'puppet-lint-empty_string-check' gem 'puppet-lint-file_ensure-check' + gem 'puppet-lint-leading_zero-check' gem 'puppet-lint-param-docs' + gem 'puppet-lint-trailing_comma-check' + gem 'puppet-lint-undef_in_function-check' + gem 'puppet-lint-unquoted_string-check' + gem 'puppet-lint-version_comparison-check' gem 'metadata-json-lint' end diff --git a/Rakefile b/Rakefile index 4c251989..f3fb20bf 100644 --- a/Rakefile +++ b/Rakefile @@ -8,18 +8,4 @@ PuppetLint::RakeTask.new :lint do |config| config.fail_on_warnings = true end -task :default => [:validate, :lint, :spec] - -namespace :spec do - task :acceptance do - ['centos65', 'debian7', 'sles11sp3', 'ubuntu1404'].each do |set| - name = 'spec:acceptance:' + set - ENV['BEAKER_set'] = set - ENV['BEAKER_destroy'] = 'onpass' - Spec::Rake::SpecTask.new(name) do |t| - t.pattern = 'spec/acceptance/**/*_spec.rb' - end - Rake::Task[name].invoke - end - end -end +task :default => [:validate, :lint, :spec] \ No newline at end of file diff --git a/manifests/extension.pp b/manifests/extension.pp index 9c94a2e4..f21063c0 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -99,7 +99,7 @@ ensure_resource('package', $header_packages) Package[$header_packages] -> Package[$real_package] } - + if $provider == 'pecl' { ensure_packages( [ $real_package ], { ensure => $ensure, diff --git a/spec/acceptance/nodesets/centos65.yml b/spec/acceptance/nodesets/centos65.yml deleted file mode 100644 index 9c925d45..00000000 --- a/spec/acceptance/nodesets/centos65.yml +++ /dev/null @@ -1,9 +0,0 @@ -HOSTS: - centos-65-x64: - roles: - - master - platform: centos-6.5-x86_64 - box: puppetlabs/centos-6.5-64-puppet - hypervisor: vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/debian7.yml b/spec/acceptance/nodesets/debian7.yml deleted file mode 100644 index 62f8ed36..00000000 --- a/spec/acceptance/nodesets/debian7.yml +++ /dev/null @@ -1,9 +0,0 @@ -HOSTS: - debian7-x64: - roles: - - master - platform: debian-7-amd64 - box: puppetlabs/debian-7.4-64-puppet - hypervisor: vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/sles11sp3.yml b/spec/acceptance/nodesets/sles11sp3.yml deleted file mode 100644 index 4d3c6060..00000000 --- a/spec/acceptance/nodesets/sles11sp3.yml +++ /dev/null @@ -1,9 +0,0 @@ -HOSTS: - sles-11sp3-x64: - roles: - - master - platform: sles-14.04-amd64 - box: suse/sles11-sp3 - hypervisor: vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/ubuntu1404.yml b/spec/acceptance/nodesets/ubuntu1404.yml deleted file mode 100644 index 84319e1d..00000000 --- a/spec/acceptance/nodesets/ubuntu1404.yml +++ /dev/null @@ -1,9 +0,0 @@ -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - box: mayflower/trusty64-puppet3 - hypervisor: vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/php_install_spec.rb b/spec/acceptance/php_install_spec.rb deleted file mode 100644 index 44476667..00000000 --- a/spec/acceptance/php_install_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'php class' do - describe 'running puppet code' do - it 'should work with no errors' do - pp = <<-EOS - class { 'php': - settings => { - 'PHP/short_open_tag' => 'On' - } - } - EOS - - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) - end - - describe port(9000) do - it { should be_listening } - end - - describe php_config('short_open_tag') do - its(:value) { should eq 1 } - end - end -end - diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb deleted file mode 100644 index b00f1b25..00000000 --- a/spec/spec_helper_acceptance.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'beaker-rspec' -require 'pry' -require 'beaker-rspec/helpers/serverspec' - -hosts.each do |host| - on host, "mkdir -p #{host['distmoduledir']}" -end - -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - - # Readable test descriptions - c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - hosts.each do |host| - on host, 'test -x /usr/bin/zypper', :acceptable_exit_codes => [0,1] do |result| - if result.exit_code == 0 - on host, 'zypper addrepo -f --no-gpgcheck http://demeter.uni-regensburg.de/SLES11SP3-x64/DVD1/ "SLES11SP3-x64 DVD1 Online"' - on host, 'zypper addrepo -f --no-gpgcheck http://demeter.uni-regensburg.de/SLE11SP3-SDK-x64/DVD1/ "SUSE-Linux-Enterprise-Software-Development-Kit-11-SP3"' - on host, 'zypper addrepo -f --no-gpgcheck http://download.opensuse.org/repositories/systemsmanagement:/puppet/SLE_11_SP3/ systemsmanagement-puppet' - on host, 'zypper in -y --force-resolution puppet' - end - end - end - - # Install module - puppet_module_install(:source => proj_root, :module_name => 'php') - hosts.each do |host| - on host, puppet('module', 'install', '-f', 'puppetlabs-stdlib') - on host, puppet('module', 'install', '-f', 'puppetlabs-apt') - on host, puppet('module', 'install', '-f', 'puppetlabs-inifile') - on host, puppet('module', 'install', '-f', 'darin-zypprepo') - end - end -end From 9537d05c8f9581dfe1beff963ccc4caf640f07aa Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Fri, 1 Jul 2016 12:23:17 +0200 Subject: [PATCH 058/221] set PHP 5.6 as default everywhere --- Gemfile | 1 + manifests/repo/debian.pp | 6 +++--- manifests/repo/suse.pp | 4 ++-- manifests/repo/ubuntu.pp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index d02af4da..d7411998 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,7 @@ group :development, :test do gem 'puppetlabs_spec_helper' gem 'puppet-module' gem 'yard' + gem 'json', '< 2' gem 'puppet-lint', '~> 2.0' gem 'puppet-lint-absolute_classname-check' gem 'puppet-lint-empty_string-check' diff --git a/manifests/repo/debian.pp b/manifests/repo/debian.pp index 05c50d80..f8992050 100644 --- a/manifests/repo/debian.pp +++ b/manifests/repo/debian.pp @@ -22,7 +22,7 @@ # class php::repo::debian( $location = 'http://packages.dotdeb.org', - $release = 'wheezy-php55', + $release = 'wheezy-php56', $repos = 'all', $include_src = false, $key = { @@ -51,9 +51,9 @@ } if ($dotdeb) { - # wheezy-php55 requires both repositories to work correctly + # both repositories are required to work correctly # See: http://www.dotdeb.org/instructions/ - if $release == 'wheezy-php55' { + if $release == 'wheezy-php56' { ::apt::source { 'dotdeb-wheezy': location => $location, release => 'wheezy', diff --git a/manifests/repo/suse.pp b/manifests/repo/suse.pp index d3c1ced0..b034901d 100644 --- a/manifests/repo/suse.pp +++ b/manifests/repo/suse.pp @@ -9,8 +9,8 @@ # Base URL of the Zypper repository # class php::repo::suse ( - $reponame = 'mayflower-php55', - $baseurl = 'http://download.opensuse.org/repositories/home:/mayflower:/php5.5_based/SLE_11_SP3/', + $reponame = 'mayflower-php56', + $baseurl = 'http://download.opensuse.org/repositories/home:/mayflower:/php5.6_based/SLE_11_SP3/', ) { zypprepo { $reponame: baseurl => $baseurl, diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index 8329aff3..faa2faed 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -11,7 +11,7 @@ include '::apt' if($version == undef) { - $version_real = '5.5' + $version_real = '5.6' } else { $version_real = $version } From 0180c424c47f35629669f95af3af76e2e84928d9 Mon Sep 17 00:00:00 2001 From: Xaver Loppenstedt Date: Mon, 20 Jun 2016 09:37:48 +0200 Subject: [PATCH 059/221] add SuSE PHP 7.0 Support Closes #212 --- manifests/globals.pp | 16 ++++++++++++++-- manifests/params.pp | 12 +++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index ed979ce4..b457b573 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -114,8 +114,20 @@ } } 'Suse': { - $default_config_root = '/etc/php5' - $default_fpm_pid_file = '/var/run/php5-fpm.pid' + case $globals_php_version { + /^7/: { + $default_config_root = '/etc/php7' + $package_prefix = 'php7-' + $default_fpm_pid_file = '/var/run/php7-fpm.pid' + $fpm_error_log = '/var/log/php7-fpm.log' + } + default: { + $default_config_root = '/etc/php5' + $package_prefix = 'php5-' + $default_fpm_pid_file = '/var/run/php5-fpm.pid' + $fpm_error_log = '/var/log/php5-fpm.log' + } + } } 'RedHat': { $default_config_root = '/etc/php.d' diff --git a/manifests/params.pp b/manifests/params.pp index 57d4f2ba..b6cde318 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -57,16 +57,22 @@ } 'Suse': { + if ($php::globals::php_version != undef) { + $php_version_major = $php::globals::php_version[0] + } else { + $php_version_major = 5 + } + $config_root = $php::globals::globals_config_root $config_root_ini = "${config_root}/conf.d" $config_root_inifile = "${config_root}/php.ini" - $common_package_names = ['php5'] + $common_package_names = ["php${php_version_major}"] $common_package_suffixes = [] $cli_inifile = "${config_root}/cli/php.ini" $dev_package_suffix = 'devel' $fpm_pid_file = $php::globals::globals_fpm_pid_file $fpm_config_file = "${config_root}/fpm/php-fpm.conf" - $fpm_error_log = '/var/log/php5-fpm.log' + $fpm_error_log = $php::globals::fpm_error_log $fpm_inifile = "${config_root}/fpm/php.ini" $fpm_package_suffix = 'fpm' $fpm_pool_dir = "${config_root}/fpm/pool.d" @@ -75,7 +81,7 @@ $fpm_group = 'www' $embedded_package_suffix = 'embed' $embedded_inifile = "${config_root}/embed/php.ini" - $package_prefix = 'php5-' + $package_prefix = $php::globals::package_prefix $manage_repos = true $root_group = 'root' $ext_tool_enabled = false From 1cdef077ef68c4e5f9d5c0c3599e7a56d3122395 Mon Sep 17 00:00:00 2001 From: Xaver Loppenstedt Date: Sun, 3 Jul 2016 15:29:43 +0200 Subject: [PATCH 060/221] fix error when dealing with php_version on suse closes #223 --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index b6cde318..b474ff72 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -58,7 +58,7 @@ 'Suse': { if ($php::globals::php_version != undef) { - $php_version_major = $php::globals::php_version[0] + $php_version_major = regsubst($php::globals::php_version, '^(\d+)\.(\d+)$','\1') } else { $php_version_major = 5 } From 03f25097b09a63fa403250a0a246f112c148b88e Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Tue, 12 Jul 2016 21:34:08 +0200 Subject: [PATCH 061/221] bring in puppet-blacksmith --- Gemfile | 1 + Rakefile | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/Gemfile b/Gemfile index d7411998..171c594c 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ group :development, :test do gem 'puppet-lint-unquoted_string-check' gem 'puppet-lint-version_comparison-check' gem 'metadata-json-lint' + gem 'puppet-blacksmith', '>= 3.1.0' end if facterversion = ENV['FACTER_VERSION'] diff --git a/Rakefile b/Rakefile index f3fb20bf..b60a6bc2 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,18 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' +# blacksmith is broken with ruby 1.8.7 +if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('1.8.7') + # blacksmith isn't always present, e.g. on Travis with --without development + begin + require 'puppet_blacksmith/rake_tasks' + Blacksmith::RakeTask.new do |t| + t.tag_pattern = "%s" + end + rescue LoadError + end +end + Rake::Task['lint'].clear PuppetLint::RakeTask.new :lint do |config| From 6e6c46c83e21db51057265462dee98838162f2e1 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Tue, 12 Jul 2016 21:38:07 +0200 Subject: [PATCH 062/221] use Puppet Forge badge for version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89386c44..50a506e5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![GitHub version](https://badge.fury.io/gh/mayflower%2Fpuppet-php.svg)](https://github.com/mayflower/puppet-php) +[![Puppet Forge](http://img.shields.io/puppetforge/v/mayflower/php.svg)](https://forge.puppetlabs.com/mayflower/php) [![Build Status](https://travis-ci.org/mayflower/puppet-php.svg?branch=master)](https://travis-ci.org/mayflower/puppet-php) ## Current Status From e2832a3181b7bf408bbec7e93e3ccf5c07451459 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Tue, 12 Jul 2016 21:50:19 +0200 Subject: [PATCH 063/221] update CHANGELOG --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d66fd6..5a5d9f5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,19 @@ * Fix a deprecation warning on `apt::key` when using `manage_repos` on wheezy (#110) This change requires puppetlabs/apt at >= 1.8.0 * Allow removal of config values (#124) - * Add `phpversion` fact, to be used for querying through PuppetDB (#119) + * Add `phpversion` fact, for querying through PuppetDB or Foreman (#119) * Allow configuring the fpm pid file (#123) + * Add embedded SAPI support (#115) + * Add options to fpm config and pool configs (#139) + * Add parameter logic for PHP 7 on Ubuntu/Debian (#180) + * add SLES PHP 7.0 Support (#220) ### Breaking Changes * Deep merge `php::extensions` the same way as `php::settings`. This technically is a breaking change but should not affect many people. + * PHP 5.6 is the default version on all systems now (except Ubuntu 16.04, where 7.0 is the default). + * There's a php::globals class now, where global paramters (like the PHP version) are set. (#132) + * Removal of php::repo::ubuntu::ppa (#218) ## 3.4.2 * Fix a bug that changed the default of `php::manage_repos` to `false` on From 649b14801ddc2566132682b25b4f2337221eb994 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Tue, 12 Jul 2016 21:51:47 +0200 Subject: [PATCH 064/221] start the 4.0.0 release cycle --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 094fc4a4..990d54df 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "mayflower-php", - "version": "3.4.2", + "version": "4.0.0-beta1", "author": "mayflower", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From a864318cf6ae7aa26c9355ccc05ef8a34b181488 Mon Sep 17 00:00:00 2001 From: iuri aranda Date: Tue, 19 Jul 2016 20:10:32 +0200 Subject: [PATCH 065/221] Fix command to enable php extensions (#226) Fix command to enable php extensions - phpquery command always exits with status code 0, even if the extension is not enabled, so the enable command is never run. Fix: grep the string stating the extension is not enabled, and only run the enable command if that string is found --- manifests/extension.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index f21063c0..0f2fd46f 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -200,12 +200,12 @@ if $sapi == 'ALL' { exec { $cmd: - unless => "${ext_tool_query} -s cli -m ${lowercase_title}", + onlyif => "${ext_tool_query} -s cli -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", require =>::Php::Config[$title], } } else { exec { $cmd: - unless => "${ext_tool_query} -s ${sapi} -m ${lowercase_title}", + onlyif => "${ext_tool_query} -s ${sapi} -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", require =>::Php::Config[$title], } } From 5d50ac56414c4ef972a8aa6512032fb4c05891a0 Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Thu, 25 Aug 2016 12:11:50 +0200 Subject: [PATCH 066/221] turn off strict variables for now --- .travis.yml | 12 ++++++------ Gemfile | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index be24d3fd..e605eccc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,9 @@ rvm: - 1.9.3 env: matrix: - - PUPPET_VERSION=4.3.2 - - PUPPET_VERSION=3.8.7 - - PUPPET_VERSION=3.8.7 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes + - PUPPET_VERSION=4.3.2 STRICT_VARIABLES=no + - PUPPET_VERSION=3.8.7 STRICT_VARIABLES=no + - PUPPET_VERSION=3.8.7 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes STRICT_VARIABLES=no global: - secure: Zc0V6JqwpFTTtVE7jVFg5R6UgXZrzsBGa6ckbOnIHPCOyJsV4oWO6RxKsYI+ozzD9nrEdrT/DTcHKRz84YqrMXxvBU9HA4S/ZrNQoRiH3bEnI3UHC6jQJRX0c71gaJEMQ3S33my39vLD7EsealX3p+j8asL8e8glYR1am9ekUB8= matrix: @@ -17,11 +17,11 @@ matrix: env: PUPPET_VERSION=3.8.7 include: - rvm: 2.1.6 - env: PUPPET_VERSION=3.8.7 DOCS=true + env: PUPPET_VERSION=3.8.7 STRICT_VARIABLES=no DOCS=true - rvm: 2.2.3 - env: PUPPET_VERSION=4.3.2 + env: PUPPET_VERSION=4.3.2 STRICT_VARIABLES=no - rvm: 2.3.0 - env: PUPPET_VERSION=4.5.2 + env: PUPPET_VERSION=4.6.1 STRICT_VARIABLES=no after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && diff --git a/Gemfile b/Gemfile index 171c594c..6a5471ac 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,8 @@ group :development, :test do gem 'puppetlabs_spec_helper' gem 'puppet-module' gem 'yard' - gem 'json', '< 2' + gem 'json', '~> 1.0', {"platforms"=>["ruby_18", "ruby_19"]} + gem 'json_pure', '~> 1.0', {"platforms"=>["ruby_18", "ruby_19"]} gem 'puppet-lint', '~> 2.0' gem 'puppet-lint-absolute_classname-check' gem 'puppet-lint-empty_string-check' From a0a0fa1a9f431889422e25270c5e166f1f5a4b6b Mon Sep 17 00:00:00 2001 From: Tristan Helmich Date: Mon, 12 Sep 2016 11:23:36 +0200 Subject: [PATCH 067/221] Update README.md regarding Vox Pupuli maintainership --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 50a506e5..f810f889 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ -[![Puppet Forge](http://img.shields.io/puppetforge/v/mayflower/php.svg)](https://forge.puppetlabs.com/mayflower/php) -[![Build Status](https://travis-ci.org/mayflower/puppet-php.svg?branch=master)](https://travis-ci.org/mayflower/puppet-php) +[![Puppet Forge](http://img.shields.io/puppetforge/v/voxpupuli/php.svg)](https://forge.puppetlabs.com/voxpupuli/php) +[![Build Status](https://travis-ci.org/voxpupuli/puppet-php.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-php) ## Current Status +As the original creators of `puppet-php` are no longer maintaining the module, it has been handed over into the care of Vox Pupuli. +Please be sure to update all your links to the new location. -The original maintainers of `puppet-php` are not developing it actively anymore, because they moved away from Puppet. -**If you want to help** maintaining this module please see [#183](https://github.com/mayflower/puppet-php/issues/183). +# voxpupuli/php Puppet Module -# mayflower/php Puppet Module - -mayflower/php is a Puppet module for managing PHP with a strong focus +voxpupuli/php is a Puppet module for managing PHP with a strong focus on php-fpm. The module aims to use sane defaults for the supported architectures. We strive to support all recent versions of Debian, Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache @@ -261,7 +260,8 @@ a big fat warning into this README to let you know. The project is released under the permissive MIT license. The source can be found at -[github.com/mayflower/puppet-php](https://github.com/mayflower/puppet-php/). +[github.com/voxpupuli/puppet-php](https://github.com/voxpupuli/puppet-php/). -This Puppet module is being actively maintained by some fellow puppeteers at -[Mayflower GmbH](https://mayflower.de). +This Puppet module was originally maintained by some fellow puppeteers at +[Mayflower GmbH](https://mayflower.de) and is now maintained by +[Vox Pupuli](https://voxpupuli.org/). From 72b73510bf6f8a899f9519f28ec789a864d49381 Mon Sep 17 00:00:00 2001 From: Tristan Helmich Date: Mon, 12 Sep 2016 11:28:59 +0200 Subject: [PATCH 068/221] Remove mayflower specific travis config --- .travis.yml | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index e605eccc..32a41065 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,31 +9,11 @@ env: - PUPPET_VERSION=4.3.2 STRICT_VARIABLES=no - PUPPET_VERSION=3.8.7 STRICT_VARIABLES=no - PUPPET_VERSION=3.8.7 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes STRICT_VARIABLES=no - global: - - secure: Zc0V6JqwpFTTtVE7jVFg5R6UgXZrzsBGa6ckbOnIHPCOyJsV4oWO6RxKsYI+ozzD9nrEdrT/DTcHKRz84YqrMXxvBU9HA4S/ZrNQoRiH3bEnI3UHC6jQJRX0c71gaJEMQ3S33my39vLD7EsealX3p+j8asL8e8glYR1am9ekUB8= matrix: - exclude: - - rvm: 2.1.6 - env: PUPPET_VERSION=3.8.7 include: - rvm: 2.1.6 - env: PUPPET_VERSION=3.8.7 STRICT_VARIABLES=no DOCS=true + env: PUPPET_VERSION=3.8.7 STRICT_VARIABLES=no - rvm: 2.2.3 env: PUPPET_VERSION=4.3.2 STRICT_VARIABLES=no - rvm: 2.3.0 env: PUPPET_VERSION=4.6.1 STRICT_VARIABLES=no -after_success: | - [ $TRAVIS_BRANCH = master ] && - [ $TRAVIS_PULL_REQUEST = false ] && - [ -n "$DOCS" ] && - puppet module install puppetlabs/strings && - puppet strings && - pip install --user ghp-import && - echo php.puppet.mayflower.de > doc/CNAME && - ~/.local/bin/ghp-import -n doc && - git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages -notifications: - webhooks: - urls: - - http://travis-notify.mayflower.de/opensource - on_start: true From e8d9f6798935c0e379adcd072364da261b58160b Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 12 Sep 2016 11:24:09 +0100 Subject: [PATCH 069/221] Fix rubocop Style/TrailingCommaInLiteral --- spec/classes/php_fpm_config_spec.rb | 24 ++++++------- spec/classes/php_fpm_spec.rb | 10 +++--- spec/classes/php_repo_ubuntu_spec.rb | 2 +- spec/classes/php_spec.rb | 54 ++++++++++++++-------------- spec/defines/extension_spec.rb | 14 ++++---- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index f17f9042..22c571ff 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -13,22 +13,22 @@ let(:params) {{ :inifile => '/etc/php/5.6/conf.d/unique-name.ini', :settings => { - 'apc.enabled' => 1, - }, + 'apc.enabled' => 1 + } }} it { should contain_class('php::fpm::config').with({ :inifile => '/etc/php/5.6/conf.d/unique-name.ini', :settings => { - 'apc.enabled' => 1, - }, + 'apc.enabled' => 1 + } })} it { should contain_php__config('fpm').with({ :file => '/etc/php/5.6/conf.d/unique-name.ini', :config => { - 'apc.enabled' => 1, - }, + 'apc.enabled' => 1 + } })} end else @@ -36,22 +36,22 @@ let(:params) {{ :inifile => '/etc/php5/conf.d/unique-name.ini', :settings => { - 'apc.enabled' => 1, - }, + 'apc.enabled' => 1 + } }} it { should contain_class('php::fpm::config').with({ :inifile => '/etc/php5/conf.d/unique-name.ini', :settings => { - 'apc.enabled' => 1, - }, + 'apc.enabled' => 1 + } })} it { should contain_php__config('fpm').with({ :file => '/etc/php5/conf.d/unique-name.ini', :config => { - 'apc.enabled' => 1, - }, + 'apc.enabled' => 1 + } })} end end diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index 5a39bfa9..b553cc2f 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -15,27 +15,27 @@ let(:params) { { :package => 'php5.6-fpm', :ensure => 'latest' } } it { should contain_package('php5.6-fpm').with({ - 'ensure' => 'latest', + 'ensure' => 'latest' }) should contain_service('php5.6-fpm').with({ - 'ensure' => 'running', + 'ensure' => 'running' }) } when 'Debian' let(:params) { { :package => 'php5-fpm', :ensure => 'latest' } } it { should contain_package('php5-fpm').with({ - 'ensure' => 'latest', + 'ensure' => 'latest' }) should contain_service('php5-fpm').with({ - 'ensure' => 'running', + 'ensure' => 'running' }) } end else it { should contain_service('php-fpm').with({ - 'ensure' => 'running', + 'ensure' => 'running' }) } end diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index 0ab5a378..ed00be49 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -35,7 +35,7 @@ describe 'when call with version 5.4 on Ubuntu trusty' do let(:params) {{ - :version => '5.4', + :version => '5.4' }} it { expect { should raise_error(Puppet::Error) }} end diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index b8b4a83b..c70cefee 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -15,21 +15,21 @@ it { should contain_class('php::fpm') should contain_package('php5.6-cli').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php5.6-fpm').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_class('php::dev') should contain_package('php5.6-dev').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) # The -xml package is enforced via the dev class should contain_package('php5.6-xml').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php-pear').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_class('php::composer') } @@ -38,16 +38,16 @@ should_not contain_class('php::global') should contain_class('php::fpm') should contain_package('php5-cli').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php5-fpm').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php5-dev').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php-pear').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_class('php::composer') } @@ -56,13 +56,13 @@ it { should contain_class('php::global') should contain_package('php5').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php5-devel').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php5-pear').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should_not contain_package('php5-cli') should_not contain_package('php5-dev') @@ -72,7 +72,7 @@ end describe 'when called with package_prefix parameter' do - let(:params) { { :package_prefix => 'myphp-', } } + let(:params) { { :package_prefix => 'myphp-' } } case facts[:osfamily] when 'Debian' case facts[:operatingsystem] @@ -80,21 +80,21 @@ it { should contain_class('php::fpm') should contain_package('myphp-cli').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('myphp-fpm').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_class('php::dev') should contain_package('myphp-dev').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) # The -xml package is enforced via the dev class should contain_package('myphp-xml').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php-pear').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_class('php::composer') } @@ -103,16 +103,16 @@ should_not contain_class('php::global') should contain_class('php::fpm') should contain_package('myphp-cli').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('myphp-fpm').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('myphp-dev').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('php-pear').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_class('php::composer') } @@ -121,13 +121,13 @@ it { should contain_class('php::global') should contain_package('php5').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('myphp-devel').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should contain_package('myphp-pear').with({ - 'ensure' => 'present', + 'ensure' => 'present' }) should_not contain_package('myphp-cli') should_not contain_package('myphp-dev') @@ -137,13 +137,13 @@ end describe 'when fpm is disabled' do - let(:params) { { :fpm => false, } } + let(:params) { { :fpm => false } } it { should_not contain_class('php::fpm') } end describe 'when composer is disabled' do - let(:params) { { :composer => false, } } + let(:params) { { :composer => false } } it { should_not contain_class('php::composer') } diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 870e4866..b33b54f0 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -36,7 +36,7 @@ :file => "#{etcdir}/json.ini", :config => { 'test' => 'foo' - }, + } }) } end @@ -82,7 +82,7 @@ context 'non-pecl extensions cannot be configured as zend' do let(:title) { 'xdebug' } let(:params) {{ - :zend => true, + :zend => true }} it { expect { should raise_error(Puppet::Error) }} @@ -109,7 +109,7 @@ let(:params) {{ :provider => 'pecl', :zend => true, - :so_name => 'opcache', + :so_name => 'opcache' }} it { @@ -117,7 +117,7 @@ :file => "#{etcdir}/opcache.ini", :config => { 'zend_extension' => 'opcache.so' - }, + } }) } end @@ -127,7 +127,7 @@ let(:params) {{ :provider => 'pecl', :zend => true, - :php_api_version => '20100525', + :php_api_version => '20100525' }} it { @@ -146,7 +146,7 @@ it { should contain_php__config('xdebug').with({ - :file => "#{etcdir}/xdebug.ini", + :file => "#{etcdir}/xdebug.ini" }) } context 'pecl installation' do @@ -169,7 +169,7 @@ :config => { 'extension' => 'nice_name.so', 'test' => 'foo' - }, + } }) } end From 6d4534a1d2738e16bb93800ed547a937336b6367 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 12 Sep 2016 11:31:20 +0100 Subject: [PATCH 070/221] Fix rubocop Style/HashSyntax --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- .../parser/functions/to_hash_settings.rb | 2 +- lib/puppet/provider/package/pear.rb | 14 ++-- lib/puppet/provider/package/pecl.rb | 14 ++-- spec/classes/php_fpm_config_spec.rb | 24 +++---- spec/classes/php_fpm_spec.rb | 6 +- spec/classes/php_repo_ubuntu_spec.rb | 8 +-- spec/classes/php_spec.rb | 8 +-- spec/defines/config_spec.rb | 32 +++++----- spec/defines/extension_spec.rb | 64 +++++++++---------- 10 files changed, 87 insertions(+), 87 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 631f2704..dc8928fe 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -1,6 +1,6 @@ module Puppet::Parser::Functions - newfunction(:ensure_prefix, :type => :rvalue, :doc => <<-EOS + newfunction(:ensure_prefix, type: :rvalue, doc: <<-EOS This function ensures a prefix for all elements in an array or the keys in a hash. *Examples:* diff --git a/lib/puppet/parser/functions/to_hash_settings.rb b/lib/puppet/parser/functions/to_hash_settings.rb index 981942c8..15eeef5e 100644 --- a/lib/puppet/parser/functions/to_hash_settings.rb +++ b/lib/puppet/parser/functions/to_hash_settings.rb @@ -1,6 +1,6 @@ module Puppet::Parser::Functions - newfunction(:to_hash_settings, :type => :rvalue, :doc => <<-EOS + newfunction(:to_hash_settings, type: :rvalue, doc: <<-EOS This function converts a +{key => value}+ hash into a nested hash and can add an id to the outer key. The optional id string as second parameter is prepended to the resource name. diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 43570523..e8847b4a 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -1,7 +1,7 @@ require 'puppet/provider/package' # PHP PEAR support. -Puppet::Type.type(:package).provide :pear, :parent => Puppet::Provider::Package do +Puppet::Type.type(:package).provide :pear, parent: Puppet::Provider::Package do desc "PHP PEAR support. By default uses the installed channels, but you can specify the path to a pear package via ``source``." has_feature :versionable @@ -10,9 +10,9 @@ case Facter.value(:operatingsystem) when "Solaris" - commands :pearcmd => "/opt/coolstack/php5/bin/pear" + commands pearcmd: "/opt/coolstack/php5/bin/pear" else - commands :pearcmd => "pear" + commands pearcmd: "pear" end def self.pearlist(hash) @@ -69,8 +69,8 @@ def self.pearsplit(desc, channel) version = $2 state = $3 return { - :name => "#{channel}/#{name}", - :ensure => state == 'stable' ? version : state + name: "#{channel}/#{name}", + ensure: state == 'stable' ? version : state } else Puppet.debug "Could not match '%s'" % desc @@ -79,7 +79,7 @@ def self.pearsplit(desc, channel) end def self.instances - pearlist(:local => true).collect do |hash| + pearlist(local: true).collect do |hash| new(hash) end end @@ -119,7 +119,7 @@ def latest end def query - self.class.pearlist(:justme => @resource[:name]) + self.class.pearlist(justme: @resource[:name]) end def uninstall diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 89156008..51435f9a 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -1,7 +1,7 @@ require 'puppet/provider/package' Puppet::Type.type(:package).newparam(:pipe) -Puppet::Type.type(:package).provide :pecl, :parent => Puppet::Provider::Package do +Puppet::Type.type(:package).provide :pecl, parent: Puppet::Provider::Package do desc "PHP pecl support. By default uses the installed channels, but you can specify the path to a pecl package via ``source``." has_feature :versionable @@ -9,9 +9,9 @@ case Facter.value(:operatingsystem) when "Solaris" - commands :peclcmd => "/opt/coolstack/php5/bin/pecl" + commands peclcmd: "/opt/coolstack/php5/bin/pecl" else - commands :peclcmd => "pecl" + commands peclcmd: "pecl" end def self.pecllist(hash) @@ -64,8 +64,8 @@ def self.peclsplit(desc) version = $2 return { - :name => "pecl-#{name.downcase}", - :ensure => version + name: "pecl-#{name.downcase}", + ensure: version } else Puppet.warning "Could not match %s" % desc @@ -74,7 +74,7 @@ def self.peclsplit(desc) end def self.instances - pecllist(:local => true).collect do |hash| + pecllist(local: true).collect do |hash| new(hash) end end @@ -118,7 +118,7 @@ def latest end def query - self.class.pecllist(:justme => self.peclname) + self.class.pecllist(justme: self.peclname) end def uninstall diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index 22c571ff..8688ec1b 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -11,22 +11,22 @@ when 'Ubuntu' describe 'creates config file' do let(:params) {{ - :inifile => '/etc/php/5.6/conf.d/unique-name.ini', - :settings => { + inifile: '/etc/php/5.6/conf.d/unique-name.ini', + settings: { 'apc.enabled' => 1 } }} it { should contain_class('php::fpm::config').with({ - :inifile => '/etc/php/5.6/conf.d/unique-name.ini', - :settings => { + inifile: '/etc/php/5.6/conf.d/unique-name.ini', + settings: { 'apc.enabled' => 1 } })} it { should contain_php__config('fpm').with({ - :file => '/etc/php/5.6/conf.d/unique-name.ini', - :config => { + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: { 'apc.enabled' => 1 } })} @@ -34,22 +34,22 @@ else describe 'creates config file' do let(:params) {{ - :inifile => '/etc/php5/conf.d/unique-name.ini', - :settings => { + inifile: '/etc/php5/conf.d/unique-name.ini', + settings: { 'apc.enabled' => 1 } }} it { should contain_class('php::fpm::config').with({ - :inifile => '/etc/php5/conf.d/unique-name.ini', - :settings => { + inifile: '/etc/php5/conf.d/unique-name.ini', + settings: { 'apc.enabled' => 1 } })} it { should contain_php__config('fpm').with({ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => { + file: '/etc/php5/conf.d/unique-name.ini', + config: { 'apc.enabled' => 1 } })} diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index b553cc2f..4d106709 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'php::fpm', :type => :class do +describe 'php::fpm', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let :facts do @@ -12,7 +12,7 @@ when 'Debian' case facts[:operatingsystem] when 'Ubuntu' - let(:params) { { :package => 'php5.6-fpm', :ensure => 'latest' } } + let(:params) { { package: 'php5.6-fpm', ensure: 'latest' } } it { should contain_package('php5.6-fpm').with({ 'ensure' => 'latest' @@ -22,7 +22,7 @@ }) } when 'Debian' - let(:params) { { :package => 'php5-fpm', :ensure => 'latest' } } + let(:params) { { package: 'php5-fpm', ensure: 'latest' } } it { should contain_package('php5-fpm').with({ 'ensure' => 'latest' diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index ed00be49..ae63c989 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'php::repo::ubuntu', :type => :class do +describe 'php::repo::ubuntu', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let :facts do @@ -17,7 +17,7 @@ describe 'when called with version 7.0 on Ubuntu trusty' do let(:params) {{ - :version => '7.0' + version: '7.0' }} it { should contain_exec('add-apt-repository-ppa:ondrej/php') @@ -26,7 +26,7 @@ describe 'when call with version 5.6 on Ubuntu trusty' do let(:params) {{ - :version => '5.6' + version: '5.6' }} it { should contain_exec('add-apt-repository-ppa:ondrej/php') @@ -35,7 +35,7 @@ describe 'when call with version 5.4 on Ubuntu trusty' do let(:params) {{ - :version => '5.4' + version: '5.4' }} it { expect { should raise_error(Puppet::Error) }} end diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index c70cefee..a45849ab 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'php', :type => :class do +describe 'php', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let :facts do @@ -72,7 +72,7 @@ end describe 'when called with package_prefix parameter' do - let(:params) { { :package_prefix => 'myphp-' } } + let(:params) { { package_prefix: 'myphp-' } } case facts[:osfamily] when 'Debian' case facts[:operatingsystem] @@ -137,13 +137,13 @@ end describe 'when fpm is disabled' do - let(:params) { { :fpm => false } } + let(:params) { { fpm: false } } it { should_not contain_class('php::fpm') } end describe 'when composer is disabled' do - let(:params) { { :composer => false } } + let(:params) { { composer: false } } it { should_not contain_class('php::composer') } diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index b40d9e4d..e58b0bc2 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -12,16 +12,16 @@ context 'default config' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php/5.6/conf.d/unique-name.ini', - :config => {} + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: {} }} end context 'simple example' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php/5.6/conf.d/unique-name.ini', - :config => { + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: { 'apc.enabled' => 1 } }} @@ -32,8 +32,8 @@ context 'empty array' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php/5.6/conf.d/unique-name.ini', - :config => {} + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: {} }} it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'})} @@ -42,8 +42,8 @@ context 'invalid config (string)' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php/5.6/conf.d/unique-name.ini', - :config => 'hello world' + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: 'hello world' }} it { expect { should raise_error(Puppet::Error) }} @@ -52,16 +52,16 @@ context 'default config' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => {} + file: '/etc/php5/conf.d/unique-name.ini', + config: {} }} end context 'simple example' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => { + file: '/etc/php5/conf.d/unique-name.ini', + config: { 'apc.enabled' => 1 } }} @@ -72,8 +72,8 @@ context 'empty array' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => {} + file: '/etc/php5/conf.d/unique-name.ini', + config: {} }} it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} @@ -82,8 +82,8 @@ context 'invalid config (string)' do let(:title) { 'unique-name' } let(:params) {{ - :file => '/etc/php5/conf.d/unique-name.ini', - :config => 'hello world' + file: '/etc/php5/conf.d/unique-name.ini', + config: 'hello world' }} it { expect { should raise_error(Puppet::Error) }} diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index b33b54f0..d500a9ed 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -24,8 +24,8 @@ context 'installation from repository' do let(:title) { 'json' } let(:params) {{ - :package_prefix => 'php5-', - :settings => { + package_prefix: 'php5-', + settings: { 'test' => 'foo' } }} @@ -33,8 +33,8 @@ it { should contain_package('php5-json') should contain_php__config('json').with({ - :file => "#{etcdir}/json.ini", - :config => { + file: "#{etcdir}/json.ini", + config: { 'test' => 'foo' } }) @@ -44,16 +44,16 @@ context 'add settings prefix if requested' do let(:title) {'json' } let(:params) {{ - :name => 'json', - :settings_prefix => true, - :settings => { + name: 'json', + settings_prefix: true, + settings: { 'test' => 'foo' } }} it { should contain_php__config('json').with({ - :config => { + config: { 'json.test' => 'foo' } }) @@ -63,16 +63,16 @@ context 'use specific settings prefix if requested' do let(:title) {'json' } let(:params) {{ - :name => 'json', - :settings_prefix => 'bar', - :settings => { + name: 'json', + settings_prefix: 'bar', + settings: { 'test' => 'foo' } }} it { should contain_php__config('json').with({ - :config => { + config: { 'bar.test' => 'foo' } }) @@ -82,7 +82,7 @@ context 'non-pecl extensions cannot be configured as zend' do let(:title) { 'xdebug' } let(:params) {{ - :zend => true + zend: true }} it { expect { should raise_error(Puppet::Error) }} @@ -91,13 +91,13 @@ context 'pecl extensions can be configured as zend' do let(:title) { 'xdebug' } let(:params) {{ - :provider => 'pecl', - :zend => true + provider: 'pecl', + zend: true }} it { should contain_php__config('xdebug').with({ - :config => { + config: { 'zend_extension' => 'xdebug.so' } }) @@ -107,15 +107,15 @@ context 'pecl extensions support so_name' do let(:title) { 'zendopcache' } let(:params) {{ - :provider => 'pecl', - :zend => true, - :so_name => 'opcache' + provider: 'pecl', + zend: true, + so_name: 'opcache' }} it { should contain_php__config('zendopcache').with({ - :file => "#{etcdir}/opcache.ini", - :config => { + file: "#{etcdir}/opcache.ini", + config: { 'zend_extension' => 'opcache.so' } }) @@ -125,14 +125,14 @@ context 'pecl extensions support php_api_version' do let(:title) { 'xdebug' } let(:params) {{ - :provider => 'pecl', - :zend => true, - :php_api_version => '20100525' + provider: 'pecl', + zend: true, + php_api_version: '20100525' }} it { should contain_php__config('xdebug').with({ - :config => { + config: { 'zend_extension' => '/usr/lib/php5/20100525/xdebug.so' } }) @@ -146,16 +146,16 @@ it { should contain_php__config('xdebug').with({ - :file => "#{etcdir}/xdebug.ini" + file: "#{etcdir}/xdebug.ini" }) } context 'pecl installation' do let(:title) { 'json' } let(:params) {{ - :provider => 'pecl', - :header_packages => ['libmemcached-dev'], - :name => 'nice_name', - :settings => { + provider: 'pecl', + header_packages: ['libmemcached-dev'], + name: 'nice_name', + settings: { 'test' => 'foo' } }} @@ -165,8 +165,8 @@ should contain_package('libmemcached-dev') should contain_package('build-essential') should contain_php__config('json').with({ - :file => "#{etcdir}/json.ini", - :config => { + file: "#{etcdir}/json.ini", + config: { 'extension' => 'nice_name.so', 'test' => 'foo' } From 4810638a4b2ce4d1b9f56e3442a1a2c1a380a9f2 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 12 Sep 2016 11:32:52 +0100 Subject: [PATCH 071/221] Fix rubocop Style/TrailingBlankLines --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1ae4d589..9c71c49e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' -include RspecPuppetFacts \ No newline at end of file +include RspecPuppetFacts From 7c17543552120187aedba01e1a9380bf4aa1f560 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Mon, 12 Sep 2016 11:34:17 +0100 Subject: [PATCH 072/221] Fix rubocop Style/SpaceInsideBlockBraces --- spec/classes/php_repo_ubuntu_spec.rb | 2 +- spec/defines/config_spec.rb | 12 ++++++------ spec/defines/extension_spec.rb | 6 +++--- spec/defines/fpm_pool_spec.rb | 4 ++-- spec/functions/to_hash_settings_spec.rb | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index ae63c989..60530e09 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -37,7 +37,7 @@ let(:params) {{ version: '5.4' }} - it { expect { should raise_error(Puppet::Error) }} + it { expect { should raise_error(Puppet::Error) } } end end diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index e58b0bc2..c7d2e148 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -26,7 +26,7 @@ } }} - it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'})} + it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'}) } end context 'empty array' do @@ -36,7 +36,7 @@ config: {} }} - it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'})} + it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'}) } end context 'invalid config (string)' do @@ -46,7 +46,7 @@ config: 'hello world' }} - it { expect { should raise_error(Puppet::Error) }} + it { expect { should raise_error(Puppet::Error) } } end else context 'default config' do @@ -66,7 +66,7 @@ } }} - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} + it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'}) } end context 'empty array' do @@ -76,7 +76,7 @@ config: {} }} - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'})} + it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'}) } end context 'invalid config (string)' do @@ -86,7 +86,7 @@ config: 'hello world' }} - it { expect { should raise_error(Puppet::Error) }} + it { expect { should raise_error(Puppet::Error) } } end end end diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index d500a9ed..ee8625a0 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -42,7 +42,7 @@ end context 'add settings prefix if requested' do - let(:title) {'json' } + let(:title) { 'json' } let(:params) {{ name: 'json', settings_prefix: true, @@ -61,7 +61,7 @@ end context 'use specific settings prefix if requested' do - let(:title) {'json' } + let(:title) { 'json' } let(:params) {{ name: 'json', settings_prefix: 'bar', @@ -85,7 +85,7 @@ zend: true }} - it { expect { should raise_error(Puppet::Error) }} + it { expect { should raise_error(Puppet::Error) } } end context 'pecl extensions can be configured as zend' do diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index c0ae9f19..9de3b38a 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -12,14 +12,14 @@ when 'Ubuntu' context 'plain config' do let(:title) { 'unique-name' } - let(:params) {{ }} + let(:params) { { } } it { should contain_file('/etc/php/5.6/fpm/pool.d/unique-name.conf') } end when 'Debian' context 'plain config' do let(:title) { 'unique-name' } - let(:params) {{ }} + let(:params) { { } } it { should contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } end diff --git a/spec/functions/to_hash_settings_spec.rb b/spec/functions/to_hash_settings_spec.rb index 6f53e688..bc4b7ef4 100644 --- a/spec/functions/to_hash_settings_spec.rb +++ b/spec/functions/to_hash_settings_spec.rb @@ -14,7 +14,7 @@ ] describe 'when first parameter is not a hash' do - it { should run.with_params('baz', input).and_raise_error(Puppet::ParseError)} + it { should run.with_params('baz', input).and_raise_error(Puppet::ParseError) } end describe 'when used with proper parameters' do From 84eb84032156ca0f292d4a678246eaf8aaa66124 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 19:21:03 +0100 Subject: [PATCH 073/221] Rubocop: Fix all php_fpm_spec.rb violations --- spec/classes/php_fpm_spec.rb | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index 4d106709..9f87ec86 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -6,38 +6,21 @@ let :facts do facts end - describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' case facts[:operatingsystem] when 'Ubuntu' let(:params) { { package: 'php5.6-fpm', ensure: 'latest' } } - it { - should contain_package('php5.6-fpm').with({ - 'ensure' => 'latest' - }) - should contain_service('php5.6-fpm').with({ - 'ensure' => 'running' - }) - } + it { is_expected.to contain_package('php5.6-fpm').with_ensure('latest') } + it { is_expected.to contain_service('php5.6-fpm').with_ensure('running') } when 'Debian' let(:params) { { package: 'php5-fpm', ensure: 'latest' } } - it { - should contain_package('php5-fpm').with({ - 'ensure' => 'latest' - }) - should contain_service('php5-fpm').with({ - 'ensure' => 'running' - }) - } + it { is_expected.to contain_package('php5-fpm').with_ensure('latest') } + it { is_expected.to contain_service('php5-fpm').with_ensure('running') } end else - it { - should contain_service('php-fpm').with({ - 'ensure' => 'running' - }) - } + it { is_expected.to contain_service('php-fpm').with_ensure('running') } end end end From 1e2d0b0b123296c17e5dc05cec8804c6abff11b7 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 19:38:04 +0100 Subject: [PATCH 074/221] Rubocop: Fix all php_fpm_config_spec.rb violations --- spec/classes/php_fpm_config_spec.rb | 86 ++++++++++++++++------------- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index 8688ec1b..e715a68c 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -10,51 +10,63 @@ case facts[:operatingsystem] when 'Ubuntu' describe 'creates config file' do - let(:params) {{ - inifile: '/etc/php/5.6/conf.d/unique-name.ini', - settings: { - 'apc.enabled' => 1 - } - }} + let(:params) do + { + inifile: '/etc/php/5.6/conf.d/unique-name.ini', + settings: { + 'apc.enabled' => 1 + } + } + end - it { should contain_class('php::fpm::config').with({ - inifile: '/etc/php/5.6/conf.d/unique-name.ini', - settings: { - 'apc.enabled' => 1 - } - })} + it do + is_expected.to contain_class('php::fpm::config').with( + inifile: '/etc/php/5.6/conf.d/unique-name.ini', + settings: { + 'apc.enabled' => 1 + } + ) + end - it { should contain_php__config('fpm').with({ - file: '/etc/php/5.6/conf.d/unique-name.ini', - config: { - 'apc.enabled' => 1 - } - })} - end - else - describe 'creates config file' do - let(:params) {{ - inifile: '/etc/php5/conf.d/unique-name.ini', - settings: { - 'apc.enabled' => 1 + it do + is_expected.to contain_php__config('fpm').with( + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: { + 'apc.enabled' => 1 } - }} - - it { should contain_class('php::fpm::config').with({ + ) + end + end + else + describe 'creates config file' do + let(:params) do + { inifile: '/etc/php5/conf.d/unique-name.ini', settings: { 'apc.enabled' => 1 } - })} + } + end - it { should contain_php__config('fpm').with({ - file: '/etc/php5/conf.d/unique-name.ini', - config: { - 'apc.enabled' => 1 - } - })} - end - end + it do + is_expected.to contain_class('php::fpm::config').with( + inifile: '/etc/php5/conf.d/unique-name.ini', + settings: { + 'apc.enabled' => 1 + } + ) + end + + it do + is_expected.to contain_php__config('fpm').with( + file: '/etc/php5/conf.d/unique-name.ini', + config: { + 'apc.enabled' => 1 + } + ) + end + end + end end end end From 4aee3c22bb46cbe2d74e6b14496a7e88c5c41ad5 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 19:45:03 +0100 Subject: [PATCH 075/221] Rubocop: Fix all php_repo_ubuntu_spec.rb violations --- spec/classes/php_repo_ubuntu_spec.rb | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index 60530e09..3aa5f2e1 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -10,34 +10,34 @@ case facts[:lsbdistcodename] when 'trusty' describe 'when called with no parameters on Ubuntu trusty' do - it { - should contain_exec('add-apt-repository-ppa:ondrej/php') - } + it { is_expected.to contain_exec('add-apt-repository-ppa:ondrej/php') } end describe 'when called with version 7.0 on Ubuntu trusty' do - let(:params) {{ + let(:params) do + { version: '7.0' - }} - it { - should contain_exec('add-apt-repository-ppa:ondrej/php') - } + } + 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) {{ + let(:params) do + { version: '5.6' - }} - it { - should contain_exec('add-apt-repository-ppa:ondrej/php') - } + } + 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) {{ + let(:params) do + { version: '5.4' - }} - it { expect { should raise_error(Puppet::Error) } } + } + end + it { expect { is_expected.to raise_error(Puppet::Error) } } end end From e17c81999fa8700a61551a2ad54fc9deace6a2ad Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 20:36:39 +0100 Subject: [PATCH 076/221] Rubocop: Fix all php_spec.rb violations --- spec/classes/php_spec.rb | 160 ++++++++++++--------------------------- 1 file changed, 48 insertions(+), 112 deletions(-) diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index a45849ab..6574f632 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -12,62 +12,32 @@ when 'Debian' case facts[:operatingsystem] when 'Ubuntu' - it { - should contain_class('php::fpm') - should contain_package('php5.6-cli').with({ - 'ensure' => 'present' - }) - should contain_package('php5.6-fpm').with({ - 'ensure' => 'present' - }) - should contain_class('php::dev') - should contain_package('php5.6-dev').with({ - 'ensure' => 'present' - }) - # The -xml package is enforced via the dev class - should contain_package('php5.6-xml').with({ - 'ensure' => 'present' - }) - should contain_package('php-pear').with({ - 'ensure' => 'present' - }) - should contain_class('php::composer') - } + it { is_expected.to contain_class('php::fpm') } + it { is_expected.to contain_package('php5.6-cli').with_ensure('present') } + it { is_expected.to contain_package('php5.6-fpm').with_ensure('present') } + it { is_expected.to contain_class('php::dev') } + it { is_expected.to contain_package('php5.6-dev').with_ensure('present') } + # The -xml package is enforced via the dev class + it { is_expected.to contain_package('php5.6-xml').with_ensure('present') } + it { is_expected.to contain_package('php-pear').with_ensure('present') } + it { is_expected.to contain_class('php::composer') } when 'Debian' - it { - should_not contain_class('php::global') - should contain_class('php::fpm') - should contain_package('php5-cli').with({ - 'ensure' => 'present' - }) - should contain_package('php5-fpm').with({ - 'ensure' => 'present' - }) - should contain_package('php5-dev').with({ - 'ensure' => 'present' - }) - should contain_package('php-pear').with({ - 'ensure' => 'present' - }) - should contain_class('php::composer') - } + it { is_expected.not_to contain_class('php::global') } + it { is_expected.to contain_class('php::fpm') } + 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') } + it { is_expected.to contain_package('php-pear').with_ensure('present') } + it { is_expected.to contain_class('php::composer') } end when 'Suse' - it { - should contain_class('php::global') - should contain_package('php5').with({ - 'ensure' => 'present' - }) - should contain_package('php5-devel').with({ - 'ensure' => 'present' - }) - should contain_package('php5-pear').with({ - 'ensure' => 'present' - }) - should_not contain_package('php5-cli') - should_not contain_package('php5-dev') - should_not contain_package('php-pear') - } + it { is_expected.to contain_class('php::global') } + it { is_expected.to contain_package('php5').with_ensure('present') } + it { is_expected.to contain_package('php5-devel').with_ensure('present') } + it { is_expected.to contain_package('php5-pear').with_ensure('present') } + it { is_expected.not_to contain_package('php5-cli') } + it { is_expected.not_to contain_package('php5-dev') } + it { is_expected.not_to contain_package('php-pear') } end end @@ -77,76 +47,42 @@ when 'Debian' case facts[:operatingsystem] when 'Ubuntu' - it { - should contain_class('php::fpm') - should contain_package('myphp-cli').with({ - 'ensure' => 'present' - }) - should contain_package('myphp-fpm').with({ - 'ensure' => 'present' - }) - should contain_class('php::dev') - should contain_package('myphp-dev').with({ - 'ensure' => 'present' - }) - # The -xml package is enforced via the dev class - should contain_package('myphp-xml').with({ - 'ensure' => 'present' - }) - should contain_package('php-pear').with({ - 'ensure' => 'present' - }) - should contain_class('php::composer') - } + it { is_expected.to contain_class('php::fpm') } + it { is_expected.to contain_package('myphp-cli').with_ensure('present') } + it { is_expected.to contain_package('myphp-fpm').with_ensure('present') } + it { is_expected.to contain_class('php::dev') } + it { is_expected.to contain_package('myphp-dev').with_ensure('present') } + # The -xml package is enforced via the dev class + it { is_expected.to contain_package('myphp-xml').with_ensure('present') } + it { is_expected.to contain_package('php-pear').with_ensure('present') } + it { is_expected.to contain_class('php::composer') } when 'Debian' - it { - should_not contain_class('php::global') - should contain_class('php::fpm') - should contain_package('myphp-cli').with({ - 'ensure' => 'present' - }) - should contain_package('myphp-fpm').with({ - 'ensure' => 'present' - }) - should contain_package('myphp-dev').with({ - 'ensure' => 'present' - }) - should contain_package('php-pear').with({ - 'ensure' => 'present' - }) - should contain_class('php::composer') - } + it { is_expected.not_to contain_class('php::global') } + it { is_expected.to contain_class('php::fpm') } + it { is_expected.to contain_package('myphp-cli').with_ensure('present') } + it { is_expected.to contain_package('myphp-fpm').with_ensure('present') } + it { is_expected.to contain_package('myphp-dev').with_ensure('present') } + it { is_expected.to contain_package('php-pear').with_ensure('present') } + it { is_expected.to contain_class('php::composer') } end when 'Suse' - it { - should contain_class('php::global') - should contain_package('php5').with({ - 'ensure' => 'present' - }) - should contain_package('myphp-devel').with({ - 'ensure' => 'present' - }) - should contain_package('myphp-pear').with({ - 'ensure' => 'present' - }) - should_not contain_package('myphp-cli') - should_not contain_package('myphp-dev') - should_not contain_package('php-pear') - } + it { is_expected.to contain_class('php::global') } + it { is_expected.to contain_package('php5').with_ensure('present') } + it { is_expected.to contain_package('myphp-devel').with_ensure('present') } + it { is_expected.to contain_package('myphp-pear').with_ensure('present') } + it { is_expected.not_to contain_package('myphp-cli') } + it { is_expected.not_to contain_package('myphp-dev') } + it { is_expected.not_to contain_package('php-pear') } end end describe 'when fpm is disabled' do let(:params) { { fpm: false } } - it { - should_not contain_class('php::fpm') - } + it { is_expected.not_to contain_class('php::fpm') } end describe 'when composer is disabled' do let(:params) { { composer: false } } - it { - should_not contain_class('php::composer') - } + it { is_expected.not_to contain_class('php::composer') } end end end From a80ae3ec7e18e9331276f7392933cdaebc0bd16a Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 20:44:40 +0100 Subject: [PATCH 077/221] Rubocop: Fix all config_spec.rb violations --- spec/defines/config_spec.rb | 98 ++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 40 deletions(-) diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index c7d2e148..e20639c4 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -11,82 +11,100 @@ when 'Ubuntu' context 'default config' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php/5.6/conf.d/unique-name.ini', - config: {} - }} + let(:params) do + { + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: {} + } + end + it { is_expected.to compile } end context 'simple example' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php/5.6/conf.d/unique-name.ini', - config: { - 'apc.enabled' => 1 + let(:params) do + { + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: { + 'apc.enabled' => 1 + } } - }} + end - it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'}) } + it { is_expected.to contain_php__config('unique-name').with_file('/etc/php/5.6/conf.d/unique-name.ini') } end context 'empty array' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php/5.6/conf.d/unique-name.ini', - config: {} - }} + let(:params) do + { + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: {} + } + end - it { should contain_php__config('unique-name').with({'file' => '/etc/php/5.6/conf.d/unique-name.ini'}) } + it { is_expected.to contain_php__config('unique-name').with_file('/etc/php/5.6/conf.d/unique-name.ini') } end context 'invalid config (string)' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php/5.6/conf.d/unique-name.ini', - config: 'hello world' - }} + let(:params) do + { + file: '/etc/php/5.6/conf.d/unique-name.ini', + config: 'hello world' + } + end - it { expect { should raise_error(Puppet::Error) } } + it { expect { is_expected.to raise_error(Puppet::Error) } } end else context 'default config' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php5/conf.d/unique-name.ini', - config: {} - }} + let(:params) do + { + file: '/etc/php5/conf.d/unique-name.ini', + config: {} + } + end + it { is_expected.to compile } end context 'simple example' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php5/conf.d/unique-name.ini', - config: { - 'apc.enabled' => 1 + let(:params) do + { + file: '/etc/php5/conf.d/unique-name.ini', + config: { + 'apc.enabled' => 1 + } } - }} + end - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'}) } + it { is_expected.to contain_php__config('unique-name').with_file('/etc/php5/conf.d/unique-name.ini') } end context 'empty array' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php5/conf.d/unique-name.ini', - config: {} - }} + let(:params) do + { + file: '/etc/php5/conf.d/unique-name.ini', + config: {} + } + end - it { should contain_php__config('unique-name').with({'file' => '/etc/php5/conf.d/unique-name.ini'}) } + it { is_expected.to contain_php__config('unique-name').with_file('/etc/php5/conf.d/unique-name.ini') } end context 'invalid config (string)' do let(:title) { 'unique-name' } - let(:params) {{ - file: '/etc/php5/conf.d/unique-name.ini', - config: 'hello world' - }} + let(:params) do + { + file: '/etc/php5/conf.d/unique-name.ini', + config: 'hello world' + } + end - it { expect { should raise_error(Puppet::Error) } } + it { expect { is_expected.to raise_error(Puppet::Error) } } end end end From 6d4b154fe56930f36401a05fb74512bf41167f04 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 21:05:27 +0100 Subject: [PATCH 078/221] Rubocop: Fix all extension_spec.rb violations --- spec/defines/extension_spec.rb | 192 ++++++++++++++++----------------- 1 file changed, 90 insertions(+), 102 deletions(-) diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index ee8625a0..bde97723 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -8,135 +8,125 @@ end let(:pre_condition) { 'include php::params' } - unless (facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD') # FIXME - something is wrong on these - case facts[:osfamily] - when 'Debian' - case facts[:operatingsystem] - when 'Ubuntu' - etcdir = '/etc/php/5.6/mods-available' - else - etcdir = '/etc/php5/mods-available' - end - else - etcdir = '/etc/php.d' - end + unless facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD' # FIXME: something is wrong on these + etcdir = case facts[:osfamily] + when 'Debian' + case facts[:operatingsystem] + when 'Ubuntu' + '/etc/php/5.6/mods-available' + else + '/etc/php5/mods-available' + end + else + '/etc/php.d' + end context 'installation from repository' do let(:title) { 'json' } - let(:params) {{ - package_prefix: 'php5-', - settings: { - 'test' => 'foo' + let(:params) do + { + package_prefix: 'php5-', + settings: { + 'test' => 'foo' + } } - }} + end - it { - should contain_package('php5-json') - should contain_php__config('json').with({ + it { is_expected.to contain_package('php5-json') } + it do + is_expected.to contain_php__config('json').with( file: "#{etcdir}/json.ini", config: { 'test' => 'foo' } - }) - } + ) + end end context 'add settings prefix if requested' do let(:title) { 'json' } - let(:params) {{ - name: 'json', - settings_prefix: true, - settings: { - 'test' => 'foo' + let(:params) do + { + name: 'json', + settings_prefix: true, + settings: { + 'test' => 'foo' + } } - }} + end - it { - should contain_php__config('json').with({ - config: { - 'json.test' => 'foo' - } - }) - } + it { is_expected.to contain_php__config('json').with_config('json.test' => 'foo') } end context 'use specific settings prefix if requested' do let(:title) { 'json' } - let(:params) {{ - name: 'json', - settings_prefix: 'bar', - settings: { - 'test' => 'foo' + let(:params) do + { + name: 'json', + settings_prefix: 'bar', + settings: { + 'test' => 'foo' + } } - }} + end - it { - should contain_php__config('json').with({ - config: { - 'bar.test' => 'foo' - } - }) - } + it { is_expected.to contain_php__config('json').with_config('bar.test' => 'foo') } end context 'non-pecl extensions cannot be configured as zend' do let(:title) { 'xdebug' } - let(:params) {{ - zend: true - }} + let(:params) do + { + zend: true + } + end - it { expect { should raise_error(Puppet::Error) } } + it { expect { is_expected.to raise_error(Puppet::Error) } } end context 'pecl extensions can be configured as zend' do let(:title) { 'xdebug' } - let(:params) {{ - provider: 'pecl', - zend: true - }} + let(:params) do + { + provider: 'pecl', + zend: true + } + end - it { - should contain_php__config('xdebug').with({ - config: { - 'zend_extension' => 'xdebug.so' - } - }) - } + it { is_expected.to contain_php__config('xdebug').with_config('zend_extension' => 'xdebug.so') } end context 'pecl extensions support so_name' do let(:title) { 'zendopcache' } - let(:params) {{ - provider: 'pecl', - zend: true, - so_name: 'opcache' - }} - - it { - should contain_php__config('zendopcache').with({ + let(:params) do + { + provider: 'pecl', + zend: true, + so_name: 'opcache' + } + end + + it do + is_expected.to contain_php__config('zendopcache').with( file: "#{etcdir}/opcache.ini", config: { 'zend_extension' => 'opcache.so' } - }) - } + ) + end end context 'pecl extensions support php_api_version' do let(:title) { 'xdebug' } - let(:params) {{ - provider: 'pecl', - zend: true, - php_api_version: '20100525' - }} - - it { - should contain_php__config('xdebug').with({ - config: { - 'zend_extension' => '/usr/lib/php5/20100525/xdebug.so' - } - }) - } + let(:params) do + { + provider: 'pecl', + zend: true, + php_api_version: '20100525' + } + end + + it { is_expected.to contain_php__config('xdebug').with_config('zend_extension' => '/usr/lib/php5/20100525/xdebug.so') } end case facts[:osfamily] @@ -144,34 +134,32 @@ context 'on Debian' do let(:title) { 'xdebug' } - it { - should contain_php__config('xdebug').with({ - file: "#{etcdir}/xdebug.ini" - }) - } + it { is_expected.to contain_php__config('xdebug').with_file("#{etcdir}/xdebug.ini") } context 'pecl installation' do let(:title) { 'json' } - let(:params) {{ + let(:params) do + { provider: 'pecl', header_packages: ['libmemcached-dev'], name: 'nice_name', settings: { - 'test' => 'foo' + 'test' => 'foo' } - }} - - it { - should contain_package('pecl-json') - should contain_package('libmemcached-dev') - should contain_package('build-essential') - should contain_php__config('json').with({ + } + end + + it { is_expected.to contain_package('pecl-json') } + it { is_expected.to contain_package('libmemcached-dev') } + it { is_expected.to contain_package('build-essential') } + it do + is_expected.to contain_php__config('json').with( file: "#{etcdir}/json.ini", config: { 'extension' => 'nice_name.so', 'test' => 'foo' } - }) - } + ) + end end end end From 44c0618e7f4520a376a4cf7d8f2b413a0b1d2cef Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 21:06:56 +0100 Subject: [PATCH 079/221] Rubocop: Fix all fpm_pool_spec.rb violations --- spec/defines/fpm_pool_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index 9de3b38a..f3f7c35a 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -7,21 +7,21 @@ facts end case facts[:osfamily] - when 'Debian' + when 'Debian' case facts[:operatingsystem] when 'Ubuntu' context 'plain config' do let(:title) { 'unique-name' } - let(:params) { { } } + let(:params) { {} } - it { should contain_file('/etc/php/5.6/fpm/pool.d/unique-name.conf') } - end + it { is_expected.to contain_file('/etc/php/5.6/fpm/pool.d/unique-name.conf') } + end when 'Debian' context 'plain config' do let(:title) { 'unique-name' } - let(:params) { { } } + let(:params) { {} } - it { should contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } + it { is_expected.to contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } end end end From fb1199a2debfe7ea002c87da26bbb8831df61cad Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 21:09:48 +0100 Subject: [PATCH 080/221] Fix rubocop Style/StringLiterals --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- .../parser/functions/to_hash_settings.rb | 6 ++--- lib/puppet/provider/package/pear.rb | 22 +++++++++---------- lib/puppet/provider/package/pecl.rb | 22 +++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index dc8928fe..30592284 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -21,7 +21,7 @@ module Puppet::Parser::Functions EOS ) do |arguments| - raise(Puppet::ParseError, "ensure_prefix(): Wrong number of arguments " + + raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' + "given (#{arguments.size} for 2)") if arguments.size < 2 enumerable = arguments[0] diff --git a/lib/puppet/parser/functions/to_hash_settings.rb b/lib/puppet/parser/functions/to_hash_settings.rb index 15eeef5e..70975ec7 100644 --- a/lib/puppet/parser/functions/to_hash_settings.rb +++ b/lib/puppet/parser/functions/to_hash_settings.rb @@ -27,12 +27,12 @@ module Puppet::Parser::Functions ) do |arguments| hash, id = arguments - id = (id.nil? ? "" : "#{id}: ") + id = (id.nil? ? '' : "#{id}: ") - raise(Puppet::ParseError, "to_hash_settings(): Requires hash to work with") unless hash.is_a?(Hash) + raise(Puppet::ParseError, 'to_hash_settings(): Requires hash to work with') unless hash.is_a?(Hash) return hash.reduce({}) do |acc, kv| - acc[id + kv[0]] = { "key" => kv[0], "value" => kv[1] } + acc[id + kv[0]] = { 'key' => kv[0], 'value' => kv[1] } acc end end diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index e8847b4a..dcd42750 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -2,22 +2,22 @@ # PHP PEAR support. Puppet::Type.type(:package).provide :pear, parent: Puppet::Provider::Package do - desc "PHP PEAR support. By default uses the installed channels, but you can specify the path to a pear package via ``source``." + desc 'PHP PEAR support. By default uses the installed channels, but you can specify the path to a pear package via ``source``.' has_feature :versionable has_feature :upgradeable has_feature :install_options case Facter.value(:operatingsystem) - when "Solaris" - commands pearcmd: "/opt/coolstack/php5/bin/pear" + when 'Solaris' + commands pearcmd: '/opt/coolstack/php5/bin/pear' else - commands pearcmd: "pear" + commands pearcmd: 'pear' end def self.pearlist(hash) - command = [command(:pearcmd), "list", "-a"] - channel = "pear" + command = [command(:pearcmd), 'list', '-a'] + channel = 'pear' begin list = execute(command).split("\n") @@ -45,7 +45,7 @@ def self.pearlist(hash) end.reject { |p| p.nil? } rescue Puppet::ExecutionFailure => detail - raise Puppet::Error, "Could not list pears: %s" % detail + raise Puppet::Error, 'Could not list pears: %s' % detail end if hash[:justme] @@ -85,11 +85,11 @@ def self.instances end def install(useversion = true) - command = ["-D", "auto_discover=1", "upgrade"] + command = ['-D', 'auto_discover=1', 'upgrade'] if @resource[:install_options] command << @resource[:install_options] else - command << "--alldeps" + command << '--alldeps' end if source = @resource[:source] @@ -108,7 +108,7 @@ def install(useversion = true) def latest # This always gets the latest version available. version = '' - command = [command(:pearcmd), "remote-info", @resource[:name]] + command = [command(:pearcmd), 'remote-info', @resource[:name]] list = execute(command).split("\n") list = list.collect do |set| if set =~ /^Latest/ @@ -123,7 +123,7 @@ def query end def uninstall - output = pearcmd "uninstall", @resource[:name] + output = pearcmd 'uninstall', @resource[:name] if output =~ /^uninstall ok/ else raise Puppet::Error, output diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 51435f9a..3b484b52 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -2,20 +2,20 @@ Puppet::Type.type(:package).newparam(:pipe) Puppet::Type.type(:package).provide :pecl, parent: Puppet::Provider::Package do - desc "PHP pecl support. By default uses the installed channels, but you can specify the path to a pecl package via ``source``." + desc 'PHP pecl support. By default uses the installed channels, but you can specify the path to a pecl package via ``source``.' has_feature :versionable has_feature :upgradeable case Facter.value(:operatingsystem) - when "Solaris" - commands peclcmd: "/opt/coolstack/php5/bin/pecl" + when 'Solaris' + commands peclcmd: '/opt/coolstack/php5/bin/pecl' else - commands peclcmd: "pecl" + commands peclcmd: 'pecl' end def self.pecllist(hash) - command = [command(:peclcmd), "list"] + command = [command(:peclcmd), 'list'] begin list = execute(command).split("\n").collect do |set| @@ -40,7 +40,7 @@ def self.pecllist(hash) end end.reject { |p| p.nil? } rescue Puppet::ExecutionFailure => detail - raise Puppet::Error, "Could not list pecls: %s" % detail + raise Puppet::Error, 'Could not list pecls: %s' % detail end if hash[:justme] @@ -68,7 +68,7 @@ def self.peclsplit(desc) ensure: version } else - Puppet.warning "Could not match %s" % desc + Puppet.warning 'Could not match %s' % desc nil end end @@ -84,7 +84,7 @@ def peclname end def install(useversion = true) - command = ["upgrade"] + command = ['upgrade'] if source = @resource[:source] command << source @@ -98,7 +98,7 @@ def install(useversion = true) end if pipe = @resource[:pipe] - command << "<<<" + command << '<<<' command << @resource[:pipe] end @@ -107,7 +107,7 @@ def install(useversion = true) def latest version = '' - command = [command(:peclcmd), "remote-info", self.peclname] + command = [command(:peclcmd), 'remote-info', self.peclname] list = execute(command).each_line do |set| if set =~ /^Latest/ version = set.split[1] @@ -122,7 +122,7 @@ def query end def uninstall - output = peclcmd "uninstall", self.peclname + output = peclcmd 'uninstall', self.peclname if output =~ /^uninstall ok/ else raise Puppet::Error, output From 371d2634f8986e71c8fdfaa73bf0f1ddab88b6ee Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 21:12:53 +0100 Subject: [PATCH 081/221] Fix rubocop Style/RedundantSelf --- lib/puppet/provider/package/pear.rb | 2 +- lib/puppet/provider/package/pecl.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index dcd42750..5f4f06b1 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -131,7 +131,7 @@ def uninstall end def update - self.install(false) + install(false) end end diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 3b484b52..ab9ef3b6 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -80,7 +80,7 @@ def self.instances end def peclname - self.name.sub('pecl-', '').downcase + name.sub('pecl-', '').downcase end def install(useversion = true) @@ -91,9 +91,9 @@ def install(useversion = true) else if (! @resource.should(:ensure).is_a? Symbol) and useversion command << '-f' - command << "#{self.peclname}-#{@resource.should(:ensure)}" + command << "#{peclname}-#{@resource.should(:ensure)}" else - command << self.peclname + command << peclname end end @@ -107,7 +107,7 @@ def install(useversion = true) def latest version = '' - command = [command(:peclcmd), 'remote-info', self.peclname] + command = [command(:peclcmd), 'remote-info', peclname] list = execute(command).each_line do |set| if set =~ /^Latest/ version = set.split[1] @@ -118,11 +118,11 @@ def latest end def query - self.class.pecllist(justme: self.peclname) + self.class.pecllist(justme: peclname) end def uninstall - output = peclcmd 'uninstall', self.peclname + output = peclcmd 'uninstall', peclname if output =~ /^uninstall ok/ else raise Puppet::Error, output @@ -130,6 +130,6 @@ def uninstall end def update - self.install(false) + install(false) end end From f4b14bab67ccfadbda3ae7493020d4333c4e819f Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 21:13:51 +0100 Subject: [PATCH 082/221] Fix rubocop Style/RedundantReturn --- lib/puppet/provider/package/pear.rb | 2 +- lib/puppet/provider/package/pecl.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 5f4f06b1..742a9115 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -115,7 +115,7 @@ def latest version = set.split[1] end end - return version + version end def query diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index ab9ef3b6..972644fe 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -114,7 +114,7 @@ def latest end end - return version + version end def query From d18cc835b0417f34e791f7e2a032548c43443972 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 21:19:14 +0100 Subject: [PATCH 083/221] Fix rubocop Style/RegexpLiteral --- lib/facter/phpversion.rb | 2 +- lib/puppet/provider/package/pear.rb | 20 ++++++++++---------- lib/puppet/provider/package/pecl.rb | 18 +++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/facter/phpversion.rb b/lib/facter/phpversion.rb index 1460adb0..310f651f 100644 --- a/lib/facter/phpversion.rb +++ b/lib/facter/phpversion.rb @@ -4,7 +4,7 @@ unless output.nil? output.split("\n").first.split(' '). - select { |x| x =~ /^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)/ }.first + select { |x| x =~ %r{^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)} }.first end end end diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 742a9115..09e5e0aa 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -22,12 +22,12 @@ def self.pearlist(hash) begin list = execute(command).split("\n") list = list.collect do |set| - if match = /INSTALLED PACKAGES, CHANNEL (.*):/i.match(set) + if match = %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) channel = match[1].downcase end if hash[:justme] - if set =~ /^#{hash[:justme]}/ + if set =~ %r{^#{hash[:justme]}} pearhash = pearsplit(set, channel) pearhash[:provider] = :pear pearhash @@ -59,12 +59,12 @@ def self.pearsplit(desc, channel) desc.strip! case desc - when /^$/ then return nil - when /^INSTALLED/i then return nil - when /no packages installed/i then return nil - when /^=/ then return nil - when /^PACKAGE/i then return nil - when /^(\S+)\s+(\S+)\s+(\S+)\s*$/ then + when %r{^$} then return nil + when %r{^INSTALLED}i then return nil + when %r{no packages installed}i then return nil + when %r{^=} then return nil + when %r{^PACKAGE}i then return nil + when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} then name = $1 version = $2 state = $3 @@ -111,7 +111,7 @@ def latest command = [command(:pearcmd), 'remote-info', @resource[:name]] list = execute(command).split("\n") list = list.collect do |set| - if set =~ /^Latest/ + if set =~ %r{^Latest} version = set.split[1] end end @@ -124,7 +124,7 @@ def query def uninstall output = pearcmd 'uninstall', @resource[:name] - if output =~ /^uninstall ok/ + if output =~ %r{^uninstall ok} else raise Puppet::Error, output end diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 972644fe..1e3040a8 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -20,7 +20,7 @@ def self.pecllist(hash) begin list = execute(command).split("\n").collect do |set| if hash[:justme] - if /^#{hash[:justme]}$/i.match(set) + if %r{^#{hash[:justme]}$}i.match(set) if peclhash = peclsplit(set) peclhash[:provider] = :peclcmd peclhash @@ -54,12 +54,12 @@ def self.peclsplit(desc) desc.strip! case desc - when /^INSTALLED/ then return nil - when /No packages installed from channel/i then return nil - when /^=/ then return nil - when /^PACKAGE/ then return nil - when /\[1m/ then return nil # Newer versions of PEAR use colorized output - when /^(\S+)\s+(\S+)\s+\S+/ then + when %r{^INSTALLED} then return nil + when %r{No packages installed from channel}i then return nil + when %r{^=} then return nil + when %r{^PACKAGE} then return nil + when %r{\[1m} then return nil # Newer versions of PEAR use colorized output + when %r{^(\S+)\s+(\S+)\s+\S+} then name = $1 version = $2 @@ -109,7 +109,7 @@ def latest version = '' command = [command(:peclcmd), 'remote-info', peclname] list = execute(command).each_line do |set| - if set =~ /^Latest/ + if set =~ %r{^Latest} version = set.split[1] end end @@ -123,7 +123,7 @@ def query def uninstall output = peclcmd 'uninstall', peclname - if output =~ /^uninstall ok/ + if output =~ %r{^uninstall ok} else raise Puppet::Error, output end From d3daa4728330c5226685d570818da0b4175550c7 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Tue, 20 Sep 2016 21:20:01 +0100 Subject: [PATCH 084/221] Fix rubocop Style/SpaceAfterNot --- lib/puppet/provider/package/pear.rb | 2 +- lib/puppet/provider/package/pecl.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 09e5e0aa..690f069c 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -95,7 +95,7 @@ def install(useversion = true) if source = @resource[:source] command << source else - if (! @resource.should(:ensure).is_a? Symbol) and useversion + if (!@resource.should(:ensure).is_a? Symbol) and useversion command << "#{@resource[:name]}-#{@resource.should(:ensure)}" else command << @resource[:name] diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 1e3040a8..66035d65 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -89,7 +89,7 @@ def install(useversion = true) if source = @resource[:source] command << source else - if (! @resource.should(:ensure).is_a? Symbol) and useversion + if (!@resource.should(:ensure).is_a? Symbol) and useversion command << '-f' command << "#{peclname}-#{@resource.should(:ensure)}" else From d6561ce8921a577865eae2d124fc17e760358aaa Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:23 +0100 Subject: [PATCH 085/221] Fix rubocop Style/SpaceInsideBrackets Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 30592284..8cb226d9 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -47,7 +47,7 @@ module Puppet::Parser::Functions else result = Hash[enumerable.map do |k,v| k = k.to_s - [ prefix && !k.start_with?(prefix) ? prefix + k : k, v ] + [prefix && !k.start_with?(prefix) ? prefix + k : k, v] end] end From fc9f4a3e90767c77820b6cf7a73fda622bd3b828 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:24 +0100 Subject: [PATCH 086/221] Fix rubocop Style/SpaceAfterComma Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 8cb226d9..3aea35f4 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -45,7 +45,7 @@ module Puppet::Parser::Functions prefix && !i.start_with?(prefix) ? prefix + i : i end else - result = Hash[enumerable.map do |k,v| + result = Hash[enumerable.map do |k, v| k = k.to_s [prefix && !k.start_with?(prefix) ? prefix + k : k, v] end] From 12acd17e4c1ed5054c18dd6a90647fae1ea881b7 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:25 +0100 Subject: [PATCH 087/221] Fix rubocop Style/EmptyLinesAroundBlockBody Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 690f069c..6f353334 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -133,5 +133,4 @@ def uninstall def update install(false) end - end From 8c7d31d095289eb3f2dead132b41bdde729a02fe Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:26 +0100 Subject: [PATCH 088/221] Rubocop: Indentation fixes The following cops are fixed in this commit. `Style/ClosingParenthesisIndentation` `Style/CaseIndentation` `Style/IndentationWidth` `Style/IndentationConsistency` Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- .../parser/functions/to_hash_settings.rb | 2 +- lib/puppet/provider/package/pear.rb | 36 +++++++++---------- lib/puppet/provider/package/pecl.rb | 10 +++--- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 3aea35f4..50464613 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -19,7 +19,7 @@ module Puppet::Parser::Functions Will return: ['p.a', 'p.b', 'p.c'] EOS - ) do |arguments| + ) do |arguments| raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' + "given (#{arguments.size} for 2)") if arguments.size < 2 diff --git a/lib/puppet/parser/functions/to_hash_settings.rb b/lib/puppet/parser/functions/to_hash_settings.rb index 70975ec7..e78326a3 100644 --- a/lib/puppet/parser/functions/to_hash_settings.rb +++ b/lib/puppet/parser/functions/to_hash_settings.rb @@ -24,7 +24,7 @@ module Puppet::Parser::Functions 'foo: b' => {'key' => 'b', 'value' => 2} } EOS - ) do |arguments| + ) do |arguments| hash, id = arguments id = (id.nil? ? '' : "#{id}: ") diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 6f353334..47b14c57 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -59,19 +59,19 @@ def self.pearsplit(desc, channel) desc.strip! case desc - when %r{^$} then return nil - when %r{^INSTALLED}i then return nil - when %r{no packages installed}i then return nil - when %r{^=} then return nil - when %r{^PACKAGE}i then return nil - when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} then - name = $1 - version = $2 - state = $3 - return { - name: "#{channel}/#{name}", - ensure: state == 'stable' ? version : state - } + when %r{^$} then return nil + when %r{^INSTALLED}i then return nil + when %r{no packages installed}i then return nil + when %r{^=} then return nil + when %r{^PACKAGE}i then return nil + when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} then + name = $1 + version = $2 + state = $3 + return { + name: "#{channel}/#{name}", + ensure: state == 'stable' ? version : state + } else Puppet.debug "Could not match '%s'" % desc nil @@ -109,12 +109,12 @@ def latest # This always gets the latest version available. version = '' command = [command(:pearcmd), 'remote-info', @resource[:name]] - list = execute(command).split("\n") - list = list.collect do |set| - if set =~ %r{^Latest} - version = set.split[1] - end + list = execute(command).split("\n") + list = list.collect do |set| + if set =~ %r{^Latest} + version = set.split[1] end + end version end diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 66035d65..d7999452 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -8,10 +8,10 @@ has_feature :upgradeable case Facter.value(:operatingsystem) - when 'Solaris' - commands peclcmd: '/opt/coolstack/php5/bin/pecl' + when 'Solaris' + commands peclcmd: '/opt/coolstack/php5/bin/pecl' else - commands peclcmd: 'pecl' + commands peclcmd: 'pecl' end def self.pecllist(hash) @@ -98,8 +98,8 @@ def install(useversion = true) end if pipe = @resource[:pipe] - command << '<<<' - command << @resource[:pipe] + command << '<<<' + command << @resource[:pipe] end peclcmd(*command) From 0b0c1b7c8d79bce24dd2da8d26e9736a4a9fec39 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:27 +0100 Subject: [PATCH 089/221] Fix rubocop Style/ElseAlignment Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pecl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index d7999452..2aee66a9 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -10,7 +10,7 @@ case Facter.value(:operatingsystem) when 'Solaris' commands peclcmd: '/opt/coolstack/php5/bin/pecl' - else + else commands peclcmd: 'pecl' end From ea5b7ec55f4285e9f2f2213f67446a731029b362 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:28 +0100 Subject: [PATCH 090/221] Fix rubocop Lint/BlockAlignment Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 47b14c57..c540dd91 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -111,10 +111,10 @@ def latest command = [command(:pearcmd), 'remote-info', @resource[:name]] list = execute(command).split("\n") list = list.collect do |set| - if set =~ %r{^Latest} - version = set.split[1] + if set =~ %r{^Latest} + version = set.split[1] + end end - end version end From 5a357fffcc80a4dba1e211bb6907574834377fc3 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:29 +0100 Subject: [PATCH 091/221] Fix rubocop Style/LineEndConcatenation Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 50464613..e28d9363 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -21,7 +21,7 @@ module Puppet::Parser::Functions EOS ) do |arguments| - raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' + + raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' \ "given (#{arguments.size} for 2)") if arguments.size < 2 enumerable = arguments[0] From ea4e94d944339617d327c717da3af4dc00243b2f Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:29 +0100 Subject: [PATCH 092/221] Fix rubocop Style/AndOr Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- lib/puppet/provider/package/pear.rb | 2 +- lib/puppet/provider/package/pecl.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index e28d9363..a56caee3 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -26,7 +26,7 @@ module Puppet::Parser::Functions enumerable = arguments[0] - unless enumerable.is_a?(Array) or enumerable.is_a?(Hash) + unless enumerable.is_a?(Array) || enumerable.is_a?(Hash) raise Puppet::ParseError, "ensure_prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}" end diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index c540dd91..26d96100 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -95,7 +95,7 @@ def install(useversion = true) if source = @resource[:source] command << source else - if (!@resource.should(:ensure).is_a? Symbol) and useversion + if (!@resource.should(:ensure).is_a? Symbol) && useversion command << "#{@resource[:name]}-#{@resource.should(:ensure)}" else command << @resource[:name] diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 2aee66a9..98e9e628 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -89,7 +89,7 @@ def install(useversion = true) if source = @resource[:source] command << source else - if (!@resource.should(:ensure).is_a? Symbol) and useversion + if (!@resource.should(:ensure).is_a? Symbol) && useversion command << '-f' command << "#{peclname}-#{@resource.should(:ensure)}" else From 8f304b103a16b814c1bb9744265d9482b4d78600 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:30 +0100 Subject: [PATCH 093/221] Fix rubocop Style/ExtraSpacing Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pecl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 98e9e628..e6cb7585 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -58,7 +58,7 @@ def self.peclsplit(desc) when %r{No packages installed from channel}i then return nil when %r{^=} then return nil when %r{^PACKAGE} then return nil - when %r{\[1m} then return nil # Newer versions of PEAR use colorized output + when %r{\[1m} then return nil # Newer versions of PEAR use colorized output when %r{^(\S+)\s+(\S+)\s+\S+} then name = $1 version = $2 From e53ec47a39490d6ea0f687c3cd5bd56ea518b496 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:31 +0100 Subject: [PATCH 094/221] Fix rubocop Style/FormatString Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 4 ++-- lib/puppet/provider/package/pecl.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 26d96100..05940f8f 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -45,7 +45,7 @@ def self.pearlist(hash) end.reject { |p| p.nil? } rescue Puppet::ExecutionFailure => detail - raise Puppet::Error, 'Could not list pears: %s' % detail + raise Puppet::Error, format('Could not list pears: %s', detail) end if hash[:justme] @@ -73,7 +73,7 @@ def self.pearsplit(desc, channel) ensure: state == 'stable' ? version : state } else - Puppet.debug "Could not match '%s'" % desc + Puppet.debug format("Could not match '%s'", desc) nil end end diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index e6cb7585..a1eb1372 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -40,7 +40,7 @@ def self.pecllist(hash) end end.reject { |p| p.nil? } rescue Puppet::ExecutionFailure => detail - raise Puppet::Error, 'Could not list pecls: %s' % detail + raise Puppet::Error, format('Could not list pecls: %s', detail) end if hash[:justme] @@ -68,7 +68,7 @@ def self.peclsplit(desc) ensure: version } else - Puppet.warning 'Could not match %s' % desc + Puppet.warning format('Could not match %s', desc) nil end end From 9e07a186e76f3cf64d17d35b9941b04849bfa9d2 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:32 +0100 Subject: [PATCH 095/221] Fix rubocop Style/PerlBackrefs Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 6 +++--- lib/puppet/provider/package/pecl.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 05940f8f..d9939d98 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -65,9 +65,9 @@ def self.pearsplit(desc, channel) when %r{^=} then return nil when %r{^PACKAGE}i then return nil when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} then - name = $1 - version = $2 - state = $3 + name = Regexp.last_match(1) + version = Regexp.last_match(2) + state = Regexp.last_match(3) return { name: "#{channel}/#{name}", ensure: state == 'stable' ? version : state diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index a1eb1372..311c7208 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -60,8 +60,8 @@ def self.peclsplit(desc) when %r{^PACKAGE} then return nil when %r{\[1m} then return nil # Newer versions of PEAR use colorized output when %r{^(\S+)\s+(\S+)\s+\S+} then - name = $1 - version = $2 + name = Regexp.last_match(1) + version = Regexp.last_match(2) return { name: "pecl-#{name.downcase}", From 6593116472a6d25b237b9e8f31b2f3d5857970c9 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:33 +0100 Subject: [PATCH 096/221] Fix rubocop Style/CollectionMethods Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 2 +- lib/puppet/provider/package/pear.rb | 6 +++--- lib/puppet/provider/package/pecl.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index a56caee3..611aef65 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -40,7 +40,7 @@ module Puppet::Parser::Functions if enumerable.is_a?(Array) # Turn everything into string same as join would do ... - result = enumerable.collect do |i| + result = enumerable.map do |i| i = i.to_s prefix && !i.start_with?(prefix) ? prefix + i : i end diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index d9939d98..732c463b 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -21,7 +21,7 @@ def self.pearlist(hash) begin list = execute(command).split("\n") - list = list.collect do |set| + list = list.map do |set| if match = %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) channel = match[1].downcase end @@ -79,7 +79,7 @@ def self.pearsplit(desc, channel) end def self.instances - pearlist(local: true).collect do |hash| + pearlist(local: true).map do |hash| new(hash) end end @@ -110,7 +110,7 @@ def latest version = '' command = [command(:pearcmd), 'remote-info', @resource[:name]] list = execute(command).split("\n") - list = list.collect do |set| + list = list.map do |set| if set =~ %r{^Latest} version = set.split[1] end diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 311c7208..82115c37 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -18,7 +18,7 @@ def self.pecllist(hash) command = [command(:peclcmd), 'list'] begin - list = execute(command).split("\n").collect do |set| + list = execute(command).split("\n").map do |set| if hash[:justme] if %r{^#{hash[:justme]}$}i.match(set) if peclhash = peclsplit(set) @@ -74,7 +74,7 @@ def self.peclsplit(desc) end def self.instances - pecllist(local: true).collect do |hash| + pecllist(local: true).map do |hash| new(hash) end end From f45de7b9bcd11d95995ee11b1f5252c31ede56de Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:34 +0100 Subject: [PATCH 097/221] Fix rubocop Style/GuardClause Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 12 +++--------- lib/puppet/provider/package/pecl.rb | 12 +++--------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 732c463b..04faaed6 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -48,11 +48,8 @@ def self.pearlist(hash) raise Puppet::Error, format('Could not list pears: %s', detail) end - if hash[:justme] - return list.shift - else - return list - end + return list.shift if hash[:justme] + list end def self.pearsplit(desc, channel) @@ -124,10 +121,7 @@ def query def uninstall output = pearcmd 'uninstall', @resource[:name] - if output =~ %r{^uninstall ok} - else - raise Puppet::Error, output - end + raise Puppet::Error, output unless output =~ %r{^uninstall ok} end def update diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 82115c37..812d3f67 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -43,11 +43,8 @@ def self.pecllist(hash) raise Puppet::Error, format('Could not list pecls: %s', detail) end - if hash[:justme] - return list.shift - else - return list - end + return list.shift if hash[:justme] + list end def self.peclsplit(desc) @@ -123,10 +120,7 @@ def query def uninstall output = peclcmd 'uninstall', peclname - if output =~ %r{^uninstall ok} - else - raise Puppet::Error, output - end + raise Puppet::Error, output unless output =~ %r{^uninstall ok} end def update From 28263eecc17edcf3d2d62b87460c280837bf20fc Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:35 +0100 Subject: [PATCH 098/221] Rubocop fix Lint/UselessAssignment Refactored `lib/puppet/provider/package/pear.rb` `latest` method to match `latest` in `lib/puppet/provider/package/pecl.rb`. Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 4 ++-- lib/puppet/provider/package/pecl.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 04faaed6..6409cdb8 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -106,12 +106,12 @@ def latest # This always gets the latest version available. version = '' command = [command(:pearcmd), 'remote-info', @resource[:name]] - list = execute(command).split("\n") - list = list.map do |set| + execute(command).each_line do |set| if set =~ %r{^Latest} version = set.split[1] end end + version end diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 812d3f67..6b0026eb 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -94,7 +94,7 @@ def install(useversion = true) end end - if pipe = @resource[:pipe] + if pipe == @resource[:pipe] command << '<<<' command << @resource[:pipe] end @@ -105,7 +105,7 @@ def install(useversion = true) def latest version = '' command = [command(:peclcmd), 'remote-info', peclname] - list = execute(command).each_line do |set| + execute(command).each_line do |set| if set =~ %r{^Latest} version = set.split[1] end From 520f0329b53e29157a0fd233804a9ed77dd7178e Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:31:35 +0100 Subject: [PATCH 099/221] Fix rubocop Style/ConditionalAssignment Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 24 ++++++++-------- lib/puppet/provider/package/pear.rb | 30 ++++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 611aef65..5be2ef55 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -38,18 +38,18 @@ module Puppet::Parser::Functions end end - if enumerable.is_a?(Array) - # Turn everything into string same as join would do ... - result = enumerable.map do |i| - i = i.to_s - prefix && !i.start_with?(prefix) ? prefix + i : i - end - else - result = Hash[enumerable.map do |k, v| - k = k.to_s - [prefix && !k.start_with?(prefix) ? prefix + k : k, v] - end] - end + result = if enumerable.is_a?(Array) + # Turn everything into string same as join would do ... + enumerable.map do |i| + i = i.to_s + prefix && !i.start_with?(prefix) ? prefix + i : i + end + else + Hash[enumerable.map do |k, v| + k = k.to_s + [prefix && !k.start_with?(prefix) ? prefix + k : k, v] + end] + end return result end diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 6409cdb8..0c59ff58 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -83,21 +83,21 @@ def self.instances def install(useversion = true) command = ['-D', 'auto_discover=1', 'upgrade'] - if @resource[:install_options] - command << @resource[:install_options] - else - command << '--alldeps' - end - - if source = @resource[:source] - command << source - else - if (!@resource.should(:ensure).is_a? Symbol) && useversion - command << "#{@resource[:name]}-#{@resource.should(:ensure)}" - else - command << @resource[:name] - end - end + command << if @resource[:install_options] + @resource[:install_options] + else + '--alldeps' + end + + command << if source = @resource[:source] + source + else + if (!@resource.should(:ensure).is_a? Symbol) && useversion + "#{@resource[:name]}-#{@resource.should(:ensure)}" + else + @resource[:name] + end + end pearcmd(*command) end From 420e37f56d7fe9553495102c2495ab1c4e2ab144 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:40:39 +0100 Subject: [PATCH 100/221] Rubocop fix Lint/AssignmentInCondition I've disabled the cop on the instances where `assignment in condition` seemed to make very good sense. Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 8 ++++---- lib/puppet/provider/package/pecl.rb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 0c59ff58..104ee2c2 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -22,7 +22,7 @@ def self.pearlist(hash) begin list = execute(command).split("\n") list = list.map do |set| - if match = %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) + if match = %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) # rubocop:disable Lint/AssignmentInCondition channel = match[1].downcase end @@ -35,7 +35,7 @@ def self.pearlist(hash) nil end else - if pearhash = pearsplit(set, channel) + if pearhash = pearsplit(set, channel) # rubocop:disable Lint/AssignmentInCondition pearhash[:provider] = :pear pearhash else @@ -89,8 +89,8 @@ def install(useversion = true) '--alldeps' end - command << if source = @resource[:source] - source + command << if @resource[:source] + @resource[:source] else if (!@resource.should(:ensure).is_a? Symbol) && useversion "#{@resource[:name]}-#{@resource.should(:ensure)}" diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 6b0026eb..14ee7a63 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -21,7 +21,7 @@ def self.pecllist(hash) list = execute(command).split("\n").map do |set| if hash[:justme] if %r{^#{hash[:justme]}$}i.match(set) - if peclhash = peclsplit(set) + if peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition peclhash[:provider] = :peclcmd peclhash else @@ -31,7 +31,7 @@ def self.pecllist(hash) nil end else - if peclhash = peclsplit(set) + if peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition peclhash[:provider] = :peclcmd peclhash else @@ -83,8 +83,8 @@ def peclname def install(useversion = true) command = ['upgrade'] - if source = @resource[:source] - command << source + if @resource[:source] + command << @resource[:source] else if (!@resource.should(:ensure).is_a? Symbol) && useversion command << '-f' From fbd0a39139ac93e390f1a9b7cba385bcfbdd0e6d Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:54:59 +0100 Subject: [PATCH 101/221] Fix rubocop Style/IfUnlessModifier Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 4 +--- lib/puppet/provider/package/pecl.rb | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 104ee2c2..21c36123 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -107,9 +107,7 @@ def latest version = '' command = [command(:pearcmd), 'remote-info', @resource[:name]] execute(command).each_line do |set| - if set =~ %r{^Latest} - version = set.split[1] - end + version = set.split[1] if set =~ %r{^Latest} end version diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 14ee7a63..fbfd9476 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -106,9 +106,7 @@ def latest version = '' command = [command(:peclcmd), 'remote-info', peclname] execute(command).each_line do |set| - if set =~ %r{^Latest} - version = set.split[1] - end + version = set.split[1] if set =~ %r{^Latest} end version From 2538e109a3d0b8617cf6dea6b23d65027fdd7b99 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 18:57:36 +0100 Subject: [PATCH 102/221] Fix rubocop Style/EmptyLinesAroundBlockBody Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/ensure_prefix.rb | 1 - lib/puppet/parser/functions/to_hash_settings.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 5be2ef55..58bf4135 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -20,7 +20,6 @@ module Puppet::Parser::Functions ['p.a', 'p.b', 'p.c'] EOS ) do |arguments| - raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' \ "given (#{arguments.size} for 2)") if arguments.size < 2 diff --git a/lib/puppet/parser/functions/to_hash_settings.rb b/lib/puppet/parser/functions/to_hash_settings.rb index e78326a3..576180c8 100644 --- a/lib/puppet/parser/functions/to_hash_settings.rb +++ b/lib/puppet/parser/functions/to_hash_settings.rb @@ -25,7 +25,6 @@ module Puppet::Parser::Functions } EOS ) do |arguments| - hash, id = arguments id = (id.nil? ? '' : "#{id}: ") From 6bbdc78177b53b84b6e6e7f27eb0edb21309e6ae Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 23 Sep 2016 19:00:56 +0100 Subject: [PATCH 103/221] Fix rubocop Style/EmptyElse Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 4 ---- lib/puppet/provider/package/pecl.rb | 6 ------ 2 files changed, 10 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 21c36123..8150db24 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -31,15 +31,11 @@ def self.pearlist(hash) pearhash = pearsplit(set, channel) pearhash[:provider] = :pear pearhash - else - nil end else if pearhash = pearsplit(set, channel) # rubocop:disable Lint/AssignmentInCondition pearhash[:provider] = :pear pearhash - else - nil end end end.reject { |p| p.nil? } diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index fbfd9476..bb4de994 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -24,18 +24,12 @@ def self.pecllist(hash) if peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition peclhash[:provider] = :peclcmd peclhash - else - nil end - else - nil end else if peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition peclhash[:provider] = :peclcmd peclhash - else - nil end end end.reject { |p| p.nil? } From 850449310e580062de3e5ff20c55fa99437e9342 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Sat, 24 Sep 2016 10:46:22 +0100 Subject: [PATCH 104/221] Fix rubocop Performance/RedundantMatch Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pecl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index bb4de994..9fb7b87c 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -20,7 +20,7 @@ def self.pecllist(hash) begin list = execute(command).split("\n").map do |set| if hash[:justme] - if %r{^#{hash[:justme]}$}i.match(set) + if %r{^#{hash[:justme]}$}i =~ set if peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition peclhash[:provider] = :peclcmd peclhash From 865401daba660c6135d0ef73f76443228944e2d0 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Sat, 24 Sep 2016 10:59:41 +0100 Subject: [PATCH 105/221] Fix rubocop Style/IfInsideElse Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 16 ++++++---------- lib/puppet/provider/package/pecl.rb | 18 +++++++----------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 8150db24..3527a2b9 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -32,11 +32,9 @@ def self.pearlist(hash) pearhash[:provider] = :pear pearhash end - else - if pearhash = pearsplit(set, channel) # rubocop:disable Lint/AssignmentInCondition - pearhash[:provider] = :pear - pearhash - end + elsif pearhash = pearsplit(set, channel) # rubocop:disable Lint/AssignmentInCondition + pearhash[:provider] = :pear + pearhash end end.reject { |p| p.nil? } @@ -87,12 +85,10 @@ def install(useversion = true) command << if @resource[:source] @resource[:source] + elsif (!@resource.should(:ensure).is_a? Symbol) && useversion + "#{@resource[:name]}-#{@resource.should(:ensure)}" else - if (!@resource.should(:ensure).is_a? Symbol) && useversion - "#{@resource[:name]}-#{@resource.should(:ensure)}" - else - @resource[:name] - end + @resource[:name] end pearcmd(*command) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 9fb7b87c..2a2dcd0d 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -26,11 +26,9 @@ def self.pecllist(hash) peclhash end end - else - if peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition - peclhash[:provider] = :peclcmd - peclhash - end + elsif peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition + peclhash[:provider] = :peclcmd + peclhash end end.reject { |p| p.nil? } rescue Puppet::ExecutionFailure => detail @@ -79,13 +77,11 @@ def install(useversion = true) if @resource[:source] command << @resource[:source] + elsif (!@resource.should(:ensure).is_a? Symbol) && useversion + command << '-f' + command << "#{peclname}-#{@resource.should(:ensure)}" else - if (!@resource.should(:ensure).is_a? Symbol) && useversion - command << '-f' - command << "#{peclname}-#{@resource.should(:ensure)}" - else - command << peclname - end + command << peclname end if pipe == @resource[:pipe] From 4f1fd3f096b9baae6775dd24fd1f40399acb4366 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Sat, 24 Sep 2016 11:03:13 +0100 Subject: [PATCH 106/221] Fix rubocop Style/SymbolProc Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 2 +- lib/puppet/provider/package/pecl.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 3527a2b9..0de1ad96 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -36,7 +36,7 @@ def self.pearlist(hash) pearhash[:provider] = :pear pearhash end - end.reject { |p| p.nil? } + end.reject(&:nil?) rescue Puppet::ExecutionFailure => detail raise Puppet::Error, format('Could not list pears: %s', detail) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 2a2dcd0d..09a116d7 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -30,7 +30,7 @@ def self.pecllist(hash) peclhash[:provider] = :peclcmd peclhash end - end.reject { |p| p.nil? } + end.reject(&:nil?) rescue Puppet::ExecutionFailure => detail raise Puppet::Error, format('Could not list pecls: %s', detail) end From 3f6cef97120dba393ff41a1d37bc4a196da3285a Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Sat, 24 Sep 2016 12:24:29 +0100 Subject: [PATCH 107/221] Fix rubocop Style/EachWithObject Thanks to elomatreb on #ruby IRC Signed-off-by: Alexander Fisher --- lib/puppet/parser/functions/to_hash_settings.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/puppet/parser/functions/to_hash_settings.rb b/lib/puppet/parser/functions/to_hash_settings.rb index 576180c8..88083906 100644 --- a/lib/puppet/parser/functions/to_hash_settings.rb +++ b/lib/puppet/parser/functions/to_hash_settings.rb @@ -30,9 +30,8 @@ module Puppet::Parser::Functions raise(Puppet::ParseError, 'to_hash_settings(): Requires hash to work with') unless hash.is_a?(Hash) - return hash.reduce({}) do |acc, kv| + return hash.each_with_object({}) do |kv, acc| acc[id + kv[0]] = { 'key' => kv[0], 'value' => kv[1] } - acc end end end From 27af3722876d77a79437655b4dffd2787492454b Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Sat, 24 Sep 2016 12:35:11 +0100 Subject: [PATCH 108/221] Refactor to avoid Lint/AssignmentInCondition Give block to `match` instead of using an `if` See https://ruby-doc.org/core-2.1.1/Regexp.html#method-i-match Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index 0de1ad96..aa13f8ac 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -22,9 +22,7 @@ def self.pearlist(hash) begin list = execute(command).split("\n") list = list.map do |set| - if match = %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) # rubocop:disable Lint/AssignmentInCondition - channel = match[1].downcase - end + %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) { |m| channel = m[1].downcase } if hash[:justme] if set =~ %r{^#{hash[:justme]}} From 7d6ff093326de68ebccdb2ee324da3d96b8b5a61 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Sat, 24 Sep 2016 14:37:50 +0100 Subject: [PATCH 109/221] Refactor nested `if`s and `reject(&:nil?)` Signed-off-by: Alexander Fisher --- lib/puppet/provider/package/pear.rb | 14 ++++++-------- lib/puppet/provider/package/pecl.rb | 14 +++++--------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index aa13f8ac..dbbf8e9c 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -24,17 +24,15 @@ def self.pearlist(hash) list = list.map do |set| %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) { |m| channel = m[1].downcase } - if hash[:justme] - if set =~ %r{^#{hash[:justme]}} - pearhash = pearsplit(set, channel) - pearhash[:provider] = :pear - pearhash - end - elsif pearhash = pearsplit(set, channel) # rubocop:disable Lint/AssignmentInCondition + if hash[:justme] && set =~ %r{^#{hash[:justme]}} + pearhash = pearsplit(set, channel) + pearhash[:provider] = :pear + pearhash + elsif (pearhash = pearsplit(set, channel)) pearhash[:provider] = :pear pearhash end - end.reject(&:nil?) + end.compact rescue Puppet::ExecutionFailure => detail raise Puppet::Error, format('Could not list pears: %s', detail) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 09a116d7..716baac9 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -19,18 +19,14 @@ def self.pecllist(hash) begin list = execute(command).split("\n").map do |set| - if hash[:justme] - if %r{^#{hash[:justme]}$}i =~ set - if peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition - peclhash[:provider] = :peclcmd - peclhash - end - end - elsif peclhash = peclsplit(set) # rubocop:disable Lint/AssignmentInCondition + if hash[:justme] && %r{^#{hash[:justme]}$}i =~ set && (peclhash = peclsplit(set)) + peclhash[:provider] = :peclcmd + peclhash + elsif (peclhash = peclsplit(set)) peclhash[:provider] = :peclcmd peclhash end - end.reject(&:nil?) + end.compact rescue Puppet::ExecutionFailure => detail raise Puppet::Error, format('Could not list pecls: %s', detail) end From 1a393cbbdd2300c2815eec7d92ddc0d281d99f45 Mon Sep 17 00:00:00 2001 From: asasfu Date: Sun, 25 Sep 2016 06:33:51 -0700 Subject: [PATCH 110/221] Pipe was broken in the previous rubucop fix Pipe was being set previously, 2 commits back, but then not used so rubucop complained. 1 commit back, pipe was then changed to being compared, which broke it because it was never set. This fixes that to remove the variable `pipe` altogether since we only use @resource[:pipe] once and don't need a variable for it. Brings it in line with things like @resource[:source] --- lib/puppet/provider/package/pecl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index bb4de994..fdd31874 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -88,7 +88,7 @@ def install(useversion = true) end end - if pipe == @resource[:pipe] + if @resource[:pipe] command << '<<<' command << @resource[:pipe] end From d646b27d9aed9af6d51e48a7c79c5afec8438488 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Sun, 25 Sep 2016 15:04:37 -0400 Subject: [PATCH 111/221] better gitignore Copies voxpupuli's gitignore from modulesync_config --- .gitignore | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 479ee755..3c1af2d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,14 @@ pkg/ Gemfile.lock -spec/fixtures/modules/ -.vagrant -.bundle -.idea +Gemfile.local vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +coverage/ +log/ +.idea/ +*.iml +.*.sw From 67b7cec2b647043b55124430a00d8601240b17f5 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Sun, 25 Sep 2016 17:35:49 -0400 Subject: [PATCH 112/221] fixtures: don't pin puppetlabs-apt version --- .fixtures.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index e18c0693..475e69b3 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,9 +1,7 @@ fixtures: repositories: stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" - apt: - repo: "git://github.com/puppetlabs/puppetlabs-apt.git" - branch: "1.8.x" + apt: "git://github.com/puppetlabs/puppetlabs-apt.git" zypprepo: "git://github.com/deadpoint/puppet-zypprepo.git" inifile: "git://github.com/puppetlabs/puppetlabs-inifile.git" symlinks: From c4d817d42e0f6941b5301f886ad486db7721f491 Mon Sep 17 00:00:00 2001 From: cliff-wakefield Date: Thu, 29 Sep 2016 17:39:59 +1000 Subject: [PATCH 113/221] Fixapt (#250) * Included apt class for debian family * Removed old if condition which is no longer used * Added scope to the apt include --- manifests/packages.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/packages.pp b/manifests/packages.pp index 58dec754..0f827513 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -29,7 +29,8 @@ validate_array($names_to_prefix) $real_names = union($names, $names_to_prefix) - if $::operatingsystem == 'Ubuntu' { + if $::osfamily == 'debian' { + include ::apt package { $real_names: ensure => $ensure, require => Class['::apt::update'], From 6938cd4a8b5fa404372d02a6d99c223f8646a259 Mon Sep 17 00:00:00 2001 From: Jacky Leung Date: Fri, 30 Sep 2016 00:51:52 +1300 Subject: [PATCH 114/221] Update module Ubuntu 14.04 default to official repository setup --- manifests/globals.pp | 40 ++++++------------- metadata.json | 4 +- spec/classes/php_fpm_config_spec.rb | 62 +++++++---------------------- spec/classes/php_fpm_spec.rb | 13 ++---- spec/classes/php_spec.rb | 27 ++++--------- spec/defines/extension_spec.rb | 12 +++--- spec/defines/fpm_pool_spec.rb | 2 +- 7 files changed, 44 insertions(+), 116 deletions(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index b457b573..b0094bbc 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -31,7 +31,7 @@ 'Debian' => $::operatingsystem ? { 'Ubuntu' => $::operatingsystemrelease ? { /^(16.04)$/ => '7.0', - default => '5.6', + default => '5.x', }, default => '5.x', }, @@ -53,41 +53,25 @@ $ext_tool_query = '/usr/sbin/php5query' $package_prefix = 'php5-' } - /^5\.5/: { + /^[57].[0-9]/: { $default_config_root = "/etc/php/${globals_php_version}" $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" $fpm_service_name = "php${globals_php_version}-fpm" $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php5.5-' - } - /^5\.6/: { - $default_config_root = "/etc/php/${globals_php_version}" - $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php5.6-' - } - /^7/: { - $default_config_root = "/etc/php/${globals_php_version}" - $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php7.0-' + $package_prefix = "php${globals_php_version}-" } default: { - $default_config_root = "/etc/php/${globals_php_version}" - $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid" - $fpm_error_log = "/var/log/php${globals_php_version}-fpm.log" - $fpm_service_name = "php${globals_php_version}-fpm" - $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" - $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php-' + # Default php installation from Ubuntu official repository use the following paths until 16.04 + # For PPA please use the $php_version to override it. + $default_config_root = '/etc/php5' + $default_fpm_pid_file = '/var/run/php5-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-' } } } else { diff --git a/metadata.json b/metadata.json index 990d54df..8489961a 100644 --- a/metadata.json +++ b/metadata.json @@ -22,9 +22,7 @@ "operatingsystem_support": [ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.10", - "14.04", - "12.04" + "14.04" ] }, { "operatingsystem": "Debian", diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index e715a68c..538c7222 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -7,64 +7,32 @@ facts end - case facts[:operatingsystem] - when 'Ubuntu' - describe 'creates config file' do - let(:params) do - { - inifile: '/etc/php/5.6/conf.d/unique-name.ini', - settings: { - 'apc.enabled' => 1 - } - } - end - - it do - is_expected.to contain_class('php::fpm::config').with( - inifile: '/etc/php/5.6/conf.d/unique-name.ini', - settings: { - 'apc.enabled' => 1 - } - ) - end - - it do - is_expected.to contain_php__config('fpm').with( - file: '/etc/php/5.6/conf.d/unique-name.ini', - config: { - 'apc.enabled' => 1 - } - ) - end - end - else - describe 'creates config file' do - let(:params) do - { + describe 'creates config file' do + let(:params) do + { inifile: '/etc/php5/conf.d/unique-name.ini', settings: { - 'apc.enabled' => 1 + 'apc.enabled' => 1 } - } - end + } + end - it do - is_expected.to contain_class('php::fpm::config').with( + it do + is_expected.to contain_class('php::fpm::config').with( inifile: '/etc/php5/conf.d/unique-name.ini', settings: { - 'apc.enabled' => 1 + 'apc.enabled' => 1 } - ) - end + ) + end - it do - is_expected.to contain_php__config('fpm').with( + it do + is_expected.to contain_php__config('fpm').with( file: '/etc/php5/conf.d/unique-name.ini', config: { - 'apc.enabled' => 1 + 'apc.enabled' => 1 } - ) - end + ) end end end diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index 9f87ec86..e2768926 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -9,16 +9,9 @@ describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' - case facts[:operatingsystem] - when 'Ubuntu' - let(:params) { { package: 'php5.6-fpm', ensure: 'latest' } } - it { is_expected.to contain_package('php5.6-fpm').with_ensure('latest') } - it { is_expected.to contain_service('php5.6-fpm').with_ensure('running') } - when 'Debian' - let(:params) { { package: 'php5-fpm', ensure: 'latest' } } - it { is_expected.to contain_package('php5-fpm').with_ensure('latest') } - it { is_expected.to contain_service('php5-fpm').with_ensure('running') } - end + let(:params) { { package: 'php5-fpm', ensure: 'latest' } } + it { is_expected.to contain_package('php5-fpm').with_ensure('latest') } + it { is_expected.to contain_service('php5-fpm').with_ensure('running') } else it { is_expected.to contain_service('php-fpm').with_ensure('running') } end diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index 6574f632..ec75ebab 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -10,26 +10,13 @@ describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' - case facts[:operatingsystem] - when 'Ubuntu' - it { is_expected.to contain_class('php::fpm') } - it { is_expected.to contain_package('php5.6-cli').with_ensure('present') } - it { is_expected.to contain_package('php5.6-fpm').with_ensure('present') } - it { is_expected.to contain_class('php::dev') } - it { is_expected.to contain_package('php5.6-dev').with_ensure('present') } - # The -xml package is enforced via the dev class - it { is_expected.to contain_package('php5.6-xml').with_ensure('present') } - it { is_expected.to contain_package('php-pear').with_ensure('present') } - it { is_expected.to contain_class('php::composer') } - when 'Debian' - it { is_expected.not_to contain_class('php::global') } - it { is_expected.to contain_class('php::fpm') } - 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') } - it { is_expected.to contain_package('php-pear').with_ensure('present') } - it { is_expected.to contain_class('php::composer') } - end + it { is_expected.not_to contain_class('php::global') } + it { is_expected.to contain_class('php::fpm') } + 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') } + it { is_expected.to contain_package('php-pear').with_ensure('present') } + it { is_expected.to contain_class('php::composer') } when 'Suse' it { is_expected.to contain_class('php::global') } it { is_expected.to contain_package('php5').with_ensure('present') } diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index bde97723..12140406 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -6,17 +6,15 @@ let :facts do facts end - let(:pre_condition) { 'include php::params' } + let(:pre_condition) { ' + include php + include php::params + ' } unless facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD' # FIXME: something is wrong on these etcdir = case facts[:osfamily] when 'Debian' - case facts[:operatingsystem] - when 'Ubuntu' - '/etc/php/5.6/mods-available' - else - '/etc/php5/mods-available' - end + '/etc/php5/mods-available' else '/etc/php.d' end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index f3f7c35a..eb807645 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -14,7 +14,7 @@ let(:title) { 'unique-name' } let(:params) { {} } - it { is_expected.to contain_file('/etc/php/5.6/fpm/pool.d/unique-name.conf') } + it { is_expected.to contain_file('/etc/php5/fpm/pool.d/unique-name.conf') } end when 'Debian' context 'plain config' do From 55059b98e76b91c8dbc2360bd7fdce27afb98696 Mon Sep 17 00:00:00 2001 From: Jacky Leung Date: Fri, 30 Sep 2016 01:05:12 +1300 Subject: [PATCH 115/221] Fix: remove package not found error --- manifests/dev.pp | 3 ++- manifests/pear.pp | 3 ++- spec/classes/php_spec.rb | 27 +++++++-------------------- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/manifests/dev.pp b/manifests/dev.pp index 212768f7..0ac8c1d3 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -26,7 +26,8 @@ default => $package, } - if $::operatingsystem == 'Ubuntu' { + # Default PHP come with xml module and no seperate package for it + if $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease >= '16.04' { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], diff --git a/manifests/pear.pp b/manifests/pear.pp index 8c507201..423030af 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -43,7 +43,8 @@ validate_string($ensure) validate_string($package_name) - if $::operatingsystem == 'Ubuntu' { + # Default PHP come with xml module and no seperate package for it + if $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease >= '16.04' { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index ec75ebab..c8b7d85f 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -32,26 +32,13 @@ let(:params) { { package_prefix: 'myphp-' } } case facts[:osfamily] when 'Debian' - case facts[:operatingsystem] - when 'Ubuntu' - it { is_expected.to contain_class('php::fpm') } - it { is_expected.to contain_package('myphp-cli').with_ensure('present') } - it { is_expected.to contain_package('myphp-fpm').with_ensure('present') } - it { is_expected.to contain_class('php::dev') } - it { is_expected.to contain_package('myphp-dev').with_ensure('present') } - # The -xml package is enforced via the dev class - it { is_expected.to contain_package('myphp-xml').with_ensure('present') } - it { is_expected.to contain_package('php-pear').with_ensure('present') } - it { is_expected.to contain_class('php::composer') } - when 'Debian' - it { is_expected.not_to contain_class('php::global') } - it { is_expected.to contain_class('php::fpm') } - it { is_expected.to contain_package('myphp-cli').with_ensure('present') } - it { is_expected.to contain_package('myphp-fpm').with_ensure('present') } - it { is_expected.to contain_package('myphp-dev').with_ensure('present') } - it { is_expected.to contain_package('php-pear').with_ensure('present') } - it { is_expected.to contain_class('php::composer') } - end + it { is_expected.not_to contain_class('php::global') } + it { is_expected.to contain_class('php::fpm') } + it { is_expected.to contain_package('myphp-cli').with_ensure('present') } + it { is_expected.to contain_package('myphp-fpm').with_ensure('present') } + it { is_expected.to contain_package('myphp-dev').with_ensure('present') } + it { is_expected.to contain_package('php-pear').with_ensure('present') } + it { is_expected.to contain_class('php::composer') } when 'Suse' it { is_expected.to contain_class('php::global') } it { is_expected.to contain_package('php5').with_ensure('present') } From 7d9c5eebe39d9d39bf86d7fa621ed490710adc09 Mon Sep 17 00:00:00 2001 From: Jacky Leung Date: Fri, 30 Sep 2016 01:39:07 +1300 Subject: [PATCH 116/221] Fix: Update to use versioncmp instead --- manifests/dev.pp | 2 +- manifests/params.pp | 2 +- manifests/pear.pp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/dev.pp b/manifests/dev.pp index 0ac8c1d3..cbb77339 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -27,7 +27,7 @@ } # Default PHP come with xml module and no seperate package for it - if $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease >= '16.04' { + if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0 { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], diff --git a/manifests/params.pp b/manifests/params.pp index b474ff72..6ec2c5d1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -47,7 +47,7 @@ } 'Ubuntu': { - $manage_repos = true + $manage_repos = false } default: { diff --git a/manifests/pear.pp b/manifests/pear.pp index 423030af..9fef078e 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -44,7 +44,7 @@ validate_string($package_name) # Default PHP come with xml module and no seperate package for it - if $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease >= '16.04' { + if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0 { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], From 21454a6aa5da506a2a9ae36c7bbab10bb5c37bed Mon Sep 17 00:00:00 2001 From: Jacky Leung Date: Fri, 30 Sep 2016 01:45:24 +1300 Subject: [PATCH 117/221] Update: Style update --- spec/classes/php_fpm_spec.rb | 7 ++++++- spec/defines/extension_spec.rb | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index e2768926..e2c90e55 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -9,7 +9,12 @@ describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' - let(:params) { { package: 'php5-fpm', ensure: 'latest' } } + let(:params) do + { + package: 'php5-fpm', + ensure: 'latest' + } + end it { is_expected.to contain_package('php5-fpm').with_ensure('latest') } it { is_expected.to contain_service('php5-fpm').with_ensure('running') } else diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 12140406..a82a8eb0 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -6,10 +6,10 @@ let :facts do facts end - let(:pre_condition) { ' - include php - include php::params - ' } + + let(:pre_condition) do + 'include php::params' + end unless facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD' # FIXME: something is wrong on these etcdir = case facts[:osfamily] From 8e9fa7be4b8eb4ab14be349106ee4a554d2ff919 Mon Sep 17 00:00:00 2001 From: Ian Bissett Date: Wed, 28 Sep 2016 18:37:53 +1000 Subject: [PATCH 118/221] Fix dependency for extentions with no package source --- manifests/extension.pp | 7 ++++++- spec/defines/extension_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index 0f2fd46f..5bf7c2b4 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -88,6 +88,7 @@ } if $provider != 'none' { + if $provider == 'pecl' { $real_package = "pecl-${title}" } @@ -123,6 +124,10 @@ source => $real_source, }) } + + $package_depends = "Package[${real_package}]" + } else { + $package_depends = undef } if $provider != 'pecl' and $zend { @@ -186,7 +191,7 @@ ::php::config { $title: file => "${config_root_ini}/${lowercase_title}.ini", config => $final_settings, - require => Package[$real_package], + require => $package_depends, } # Ubuntu/Debian systems use the mods-available folder. We need to enable diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index bde97723..5e93f50a 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -43,6 +43,28 @@ end end + context 'configure extension without installing a package' do + let(:title) { 'json' } + let(:params) do + { + provider: 'none', + settings: { + 'test' => 'foo' + } + } + end + + it do + is_expected.to contain_php__config('json').with( + file: "#{etcdir}/json.ini", + require: nil, + config: { + 'test' => 'foo' + } + ) + end + end + context 'add settings prefix if requested' do let(:title) { 'json' } let(:params) do From 16b36d5b20714d6642315f92f6784a694167fa71 Mon Sep 17 00:00:00 2001 From: Vincent Deygas Date: Fri, 21 Oct 2016 22:00:27 +0100 Subject: [PATCH 119/221] Correct spec tests --- spec/defines/extension_spec.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index d49dd33f..ea1045f9 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -77,7 +77,14 @@ } end - it { is_expected.to contain_php__config('json').with_config('json.test' => 'foo') } + it do + is_expected.to contain_php__config('json').with( + config: { + 'extension' => 'json.so', + 'json.test' => 'foo' + } + ) + end end context 'use specific settings prefix if requested' do @@ -87,13 +94,19 @@ name: 'json', settings_prefix: 'bar', settings: { - 'extension' => 'json.so', - 'test' => 'foo' + 'test' => 'foo' } } end - it { is_expected.to contain_php__config('json').with_config('bar.test' => 'foo') } + it do + is_expected.to contain_php__config('json').with( + config: { + 'extension' => 'json.so', + 'bar.test' => 'foo', + } + ) + end end context 'extensions can be configured as zend' do From 2a02669b8dc8b53376409e9b61500ba025b47695 Mon Sep 17 00:00:00 2001 From: Chris Edester Date: Tue, 1 Nov 2016 14:22:00 -0400 Subject: [PATCH 120/221] Support using an http proxy for downloading composer --- manifests/composer.pp | 24 +++++++++++++++--------- manifests/composer/auto_update.pp | 13 +++++++++---- manifests/init.pp | 10 +++++++++- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/manifests/composer.pp b/manifests/composer.pp index 5b960638..606ec6df 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -8,6 +8,9 @@ # [*path*] # Holds path to the Composer executable # +# [*environment*] +# Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy +# # [*auto_update*] # Defines if composer should be auto updated # @@ -20,6 +23,7 @@ class php::composer ( $source = $::php::params::composer_source, $path = $::php::params::composer_path, + $environment = undef, $auto_update = true, $max_age = $::php::params::composer_max_age, $root_group = $::php::params::root_group, @@ -34,14 +38,15 @@ validate_bool($auto_update) validate_re("x${max_age}", '^x\d+$') - ensure_packages(['wget']) + ensure_packages(['curl']) exec { 'download composer': - command => "wget ${source} -O ${path}", - creates => $path, - path => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', - '/usr/local/bin', '/usr/local/sbin'], - require => [Class['::php::cli'],Package['wget']], + command => "curl -L ${source} -o ${path}", + environment => $environment, + creates => $path, + path => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', + '/usr/local/bin', '/usr/local/sbin'], + require => [Class['::php::cli'],Package['curl']], } -> file { $path: mode => '0555', @@ -51,9 +56,10 @@ if $auto_update { class { '::php::composer::auto_update': - max_age => $max_age, - source => $source, - path => $path, + max_age => $max_age, + source => $source, + path => $path, + environment => $environment, } } } diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index 5bb19e41..f45aaaa3 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -11,6 +11,9 @@ # [*path*] # Holds path to the Composer executable # +# [*environment*] +# Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy +# # === Examples # # include php::composer::auto_update @@ -22,6 +25,7 @@ $max_age, $source, $path, + $environment = undef, ) { if $caller_module_name != $module_name { @@ -29,9 +33,10 @@ } exec { 'update composer': - command => "wget ${source} -O ${path}", - onlyif => "test `find '${path}' -mtime +${max_age}`", - path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ], - require => File[$path], + command => "curl -L ${source} -o ${path}", + environment => $environment, + onlyif => "test `find '${path}' -mtime +${max_age}`", + path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ], + require => File[$path], } } diff --git a/manifests/init.pp b/manifests/init.pp index 8392a21d..45403dc2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -40,6 +40,11 @@ # [*phpunit*] # Install phpunit # +# [*environment*] +# Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy. +# These are passed through to the underlying exec(s), so it follows the same format +# of the exec type `environment` +# # [*extensions*] # Install PHP extensions, this is overwritten by hiera hash `php::extensions` # @@ -93,6 +98,7 @@ $pear = true, $pear_ensure = $::php::params::pear_ensure, $phpunit = false, + $environment = undef, $extensions = {}, $settings = {}, $package_prefix = $::php::params::package_prefix, @@ -188,7 +194,9 @@ } if $composer { Anchor['php::begin'] -> - class { '::php::composer': } -> + class { '::php::composer': + environment => $environment, + } -> Anchor['php::end'] } if $pear { From 380273f9da57e49831ed588edbd421c156694c16 Mon Sep 17 00:00:00 2001 From: Chris Edester Date: Tue, 1 Nov 2016 14:39:23 -0400 Subject: [PATCH 121/221] Ability to manage my own curl --- manifests/composer.pp | 6 +++++- manifests/init.pp | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/manifests/composer.pp b/manifests/composer.pp index 606ec6df..240db1fe 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -11,6 +11,9 @@ # [*environment*] # Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy # +# [*manage_curl*] +# Should we ensure curl is installed or do you want to manage that? +# # [*auto_update*] # Defines if composer should be auto updated # @@ -24,6 +27,7 @@ $source = $::php::params::composer_source, $path = $::php::params::composer_path, $environment = undef, + $manage_curl = true, $auto_update = true, $max_age = $::php::params::composer_max_age, $root_group = $::php::params::root_group, @@ -38,7 +42,7 @@ validate_bool($auto_update) validate_re("x${max_age}", '^x\d+$') - ensure_packages(['curl']) + if $manage_curl { ensure_packages(['curl']) } exec { 'download composer': command => "curl -L ${source} -o ${path}", diff --git a/manifests/init.pp b/manifests/init.pp index 45403dc2..d9626c9b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -45,6 +45,9 @@ # These are passed through to the underlying exec(s), so it follows the same format # of the exec type `environment` # +# [*manage_curl*] +# Should we ensure curl is installed or do you want to manage that? +# # [*extensions*] # Install PHP extensions, this is overwritten by hiera hash `php::extensions` # @@ -99,6 +102,7 @@ $pear_ensure = $::php::params::pear_ensure, $phpunit = false, $environment = undef, + $manage_curl = true, $extensions = {}, $settings = {}, $package_prefix = $::php::params::package_prefix, @@ -120,6 +124,7 @@ validate_bool($ext_tool_enabled) validate_string($pear_ensure) validate_bool($phpunit) + validate_bool($manage_curl) validate_hash($extensions) validate_hash($settings) validate_string($log_owner) @@ -196,6 +201,7 @@ Anchor['php::begin'] -> class { '::php::composer': environment => $environment, + manage_curl => $manage_curl, } -> Anchor['php::end'] } From f4d94efc9f3602f75bdf1d7f404e34499990ac88 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sat, 22 Oct 2016 16:36:42 +0200 Subject: [PATCH 122/221] Update based on voxpupuli/modulesync_config 0.14.1. This might fix #246, #248 and #253 --- .github/CONTRIBUTING.md | 100 ++++ .github/ISSUE_TEMPLATE.md | 23 + .github/PULL_REQUEST_TEMPLATE.md | 5 + .msync.yml | 1 + .rspec | 2 + .rubocop.yml | 512 ++++++++++++++++++ .travis.yml | 63 ++- .yardopts | 1 + Gemfile | 90 +-- Rakefile | 44 +- spec/acceptance/nodesets/centos-511-x64.yml | 15 + spec/acceptance/nodesets/centos-66-x64-pe.yml | 17 + spec/acceptance/nodesets/centos-66-x64.yml | 15 + spec/acceptance/nodesets/centos-72-x64.yml | 15 + spec/acceptance/nodesets/debian-78-x64.yml | 15 + spec/acceptance/nodesets/debian-82-x64.yml | 15 + spec/acceptance/nodesets/docker/centos-5.yml | 22 + spec/acceptance/nodesets/docker/centos-6.yml | 23 + spec/acceptance/nodesets/docker/centos-7.yml | 21 + spec/acceptance/nodesets/docker/debian-7.yml | 21 + spec/acceptance/nodesets/docker/debian-8.yml | 22 + .../nodesets/docker/ubuntu-12.04.yml | 22 + .../nodesets/docker/ubuntu-14.04.yml | 24 + .../nodesets/docker/ubuntu-16.04.yml | 22 + .../nodesets/ubuntu-server-1204-x64.yml | 15 + .../nodesets/ubuntu-server-1404-x64.yml | 15 + .../nodesets/ubuntu-server-1604-x64.yml | 15 + spec/classes/coverage_spec.rb | 4 + spec/default_facts.yml | 6 + spec/spec_helper.rb | 18 +- 30 files changed, 1118 insertions(+), 65 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .msync.yml create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 .yardopts create mode 100644 spec/acceptance/nodesets/centos-511-x64.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64.yml create mode 100644 spec/acceptance/nodesets/centos-72-x64.yml create mode 100644 spec/acceptance/nodesets/debian-78-x64.yml create mode 100644 spec/acceptance/nodesets/debian-82-x64.yml create mode 100644 spec/acceptance/nodesets/docker/centos-5.yml create mode 100644 spec/acceptance/nodesets/docker/centos-6.yml create mode 100644 spec/acceptance/nodesets/docker/centos-7.yml create mode 100644 spec/acceptance/nodesets/docker/debian-7.yml create mode 100644 spec/acceptance/nodesets/docker/debian-8.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-12.04.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-14.04.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-16.04.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml create mode 100644 spec/classes/coverage_spec.rb create mode 100644 spec/default_facts.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..e61f2650 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,100 @@ +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little quicker. + + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). + +1. Fork the repo. + +1. Create a separate branch for your change. + +1. Run the tests. We only take pull requests with passing tests, and + documentation. + +1. Add a test for your change. Only refactoring and documentation + changes require no new tests. If you are adding functionality + or fixing a bug, please add a test. + +1. Squash your commits down into logical components. Make sure to rebase + against the current master. + +1. Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review +your code. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + + export PUPPET_VERSION="~> 4.2.0" + +Install the dependencies like so... + + bundle install + +## Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + + bundle exec rake lint + bundle exec rake validate + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + + bundle exec rake rubocop + +## Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run your all the unit tests + + bundle exec rake spec SPEC_OPTS='--format documentation' + +To run a specific spec test set the `SPEC` variable: + + bundle exec rake spec SPEC=spec/foo_spec.rb + +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + + +## Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + + bundle exec rake acceptance + +This will run the tests on an Ubuntu 12.04 virtual machine. You can also +run the integration tests against Centos 6.6 with. + + BEAKER_set=centos-66-x64 bundle exec rake acceptances + +If you don't want to have to recreate the virtual machine every time you +can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will +at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile +for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..9ac4a2b0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,23 @@ + + +### Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +### How to reproduce (e.g Puppet code you use) + +### What are you seeing + +### What behaviour did you expect instead + +### Output log + +### Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..79272bf6 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ + diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 00000000..fc9aad75 --- /dev/null +++ b/.msync.yml @@ -0,0 +1 @@ +modulesync_config_version: '0.14.1' diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..8c18f1ab --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..e1e0276b --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,512 @@ +require: rubocop-rspec +AllCops: + TargetRubyVersion: 1.9 + Include: + - ./**/*.rb + Exclude: + - files/**/* + - vendor/**/* + - .vendor/**/* + - pkg/**/* + - spec/fixtures/**/* +Lint/ConditionPosition: + Enabled: True + +Lint/ElseLayout: + Enabled: True + +Lint/UnreachableCode: + Enabled: True + +Lint/UselessComparison: + Enabled: True + +Lint/EnsureReturn: + Enabled: True + +Lint/HandleExceptions: + Enabled: True + +Lint/LiteralInCondition: + Enabled: True + +Lint/ShadowingOuterLocalVariable: + Enabled: True + +Lint/LiteralInInterpolation: + Enabled: True + +Style/HashSyntax: + Enabled: True + +Style/RedundantReturn: + Enabled: True + +Lint/AmbiguousOperator: + Enabled: True + +Lint/AssignmentInCondition: + Enabled: True + +Style/SpaceBeforeComment: + Enabled: True + +Style/AndOr: + Enabled: True + +Style/RedundantSelf: + Enabled: True + +Metric/BlockLength: + Enabled: False + +# Method length is not necessarily an indicator of code quality +Metrics/MethodLength: + Enabled: False + +# Module length is not necessarily an indicator of code quality +Metrics/ModuleLength: + Enabled: False + +Style/WhileUntilModifier: + Enabled: True + +Lint/AmbiguousRegexpLiteral: + Enabled: True + +Lint/Eval: + Enabled: True + +Lint/BlockAlignment: + Enabled: True + +Lint/DefEndAlignment: + Enabled: True + +Lint/EndAlignment: + Enabled: True + +Lint/DeprecatedClassMethods: + Enabled: True + +Lint/Loop: + Enabled: True + +Lint/ParenthesesAsGroupedExpression: + Enabled: True + +Lint/RescueException: + Enabled: True + +Lint/StringConversionInInterpolation: + Enabled: True + +Lint/UnusedBlockArgument: + Enabled: True + +Lint/UnusedMethodArgument: + Enabled: True + +Lint/UselessAccessModifier: + Enabled: True + +Lint/UselessAssignment: + Enabled: True + +Lint/Void: + Enabled: True + +Style/AccessModifierIndentation: + Enabled: True + +Style/AccessorMethodName: + Enabled: True + +Style/Alias: + Enabled: True + +Style/AlignArray: + Enabled: True + +Style/AlignHash: + Enabled: True + +Style/AlignParameters: + Enabled: True + +Metrics/BlockNesting: + Enabled: True + +Style/AsciiComments: + Enabled: True + +Style/Attr: + Enabled: True + +Style/BracesAroundHashParameters: + Enabled: True + +Style/CaseEquality: + Enabled: True + +Style/CaseIndentation: + Enabled: True + +Style/CharacterLiteral: + Enabled: True + +Style/ClassAndModuleCamelCase: + Enabled: True + +Style/ClassAndModuleChildren: + Enabled: False + +Style/ClassCheck: + Enabled: True + +# Class length is not necessarily an indicator of code quality +Metrics/ClassLength: + Enabled: False + +Style/ClassMethods: + Enabled: True + +Style/ClassVars: + Enabled: True + +Style/WhenThen: + Enabled: True + +Style/WordArray: + Enabled: True + +Style/UnneededPercentQ: + Enabled: True + +Style/Tab: + Enabled: True + +Style/SpaceBeforeSemicolon: + Enabled: True + +Style/TrailingBlankLines: + Enabled: True + +Style/SpaceInsideBlockBraces: + Enabled: True + +Style/SpaceInsideBrackets: + Enabled: True + +Style/SpaceInsideHashLiteralBraces: + Enabled: True + +Style/SpaceInsideParens: + Enabled: True + +Style/LeadingCommentSpace: + Enabled: True + +Style/SpaceBeforeFirstArg: + Enabled: True + +Style/SpaceAfterColon: + Enabled: True + +Style/SpaceAfterComma: + Enabled: True + +Style/SpaceAfterMethodName: + Enabled: True + +Style/SpaceAfterNot: + Enabled: True + +Style/SpaceAfterSemicolon: + Enabled: True + +Style/SpaceAroundEqualsInParameterDefault: + Enabled: True + +Style/SpaceAroundOperators: + Enabled: True + +Style/SpaceBeforeBlockBraces: + Enabled: True + +Style/SpaceBeforeComma: + Enabled: True + +Style/CollectionMethods: + Enabled: True + +Style/CommentIndentation: + Enabled: True + +Style/ColonMethodCall: + Enabled: True + +Style/CommentAnnotation: + Enabled: True + +# 'Complexity' is very relative +Metrics/CyclomaticComplexity: + Enabled: False + +Style/ConstantName: + Enabled: True + +Style/Documentation: + Enabled: False + +Style/DefWithParentheses: + Enabled: True + +Style/PreferredHashMethods: + Enabled: True + +Style/DotPosition: + EnforcedStyle: trailing + +Style/DoubleNegation: + Enabled: True + +Style/EachWithObject: + Enabled: True + +Style/EmptyLineBetweenDefs: + Enabled: True + +Style/IndentArray: + Enabled: True + +Style/IndentHash: + Enabled: True + +Style/IndentationConsistency: + Enabled: True + +Style/IndentationWidth: + Enabled: True + +Style/EmptyLines: + Enabled: True + +Style/EmptyLinesAroundAccessModifier: + Enabled: True + +Style/EmptyLiteral: + Enabled: True + +# Configuration parameters: AllowURI, URISchemes. +Metrics/LineLength: + Enabled: False + +Style/MethodCallParentheses: + Enabled: True + +Style/MethodDefParentheses: + Enabled: True + +Style/LineEndConcatenation: + Enabled: True + +Style/TrailingWhitespace: + Enabled: True + +Style/StringLiterals: + Enabled: True + +Style/TrailingCommaInArguments: + Enabled: True + +Style/TrailingCommaInLiteral: + Enabled: True + +Style/GlobalVars: + Enabled: True + +Style/GuardClause: + Enabled: True + +Style/IfUnlessModifier: + Enabled: True + +Style/MultilineIfThen: + Enabled: True + +Style/NegatedIf: + Enabled: True + +Style/NegatedWhile: + Enabled: True + +Style/Next: + Enabled: True + +Style/SingleLineBlockParams: + Enabled: True + +Style/SingleLineMethods: + Enabled: True + +Style/SpecialGlobalVars: + Enabled: True + +Style/TrivialAccessors: + Enabled: True + +Style/UnlessElse: + Enabled: True + +Style/VariableInterpolation: + Enabled: True + +Style/VariableName: + Enabled: True + +Style/WhileUntilDo: + Enabled: True + +Style/EvenOdd: + Enabled: True + +Style/FileName: + Enabled: True + +Style/For: + Enabled: True + +Style/Lambda: + Enabled: True + +Style/MethodName: + Enabled: True + +Style/MultilineTernaryOperator: + Enabled: True + +Style/NestedTernaryOperator: + Enabled: True + +Style/NilComparison: + Enabled: True + +Style/FormatString: + Enabled: True + +Style/MultilineBlockChain: + Enabled: True + +Style/Semicolon: + Enabled: True + +Style/SignalException: + Enabled: True + +Style/NonNilCheck: + Enabled: True + +Style/Not: + Enabled: True + +Style/NumericLiterals: + Enabled: True + +Style/OneLineConditional: + Enabled: True + +Style/OpMethod: + Enabled: True + +Style/ParenthesesAroundCondition: + Enabled: True + +Style/PercentLiteralDelimiters: + Enabled: True + +Style/PerlBackrefs: + Enabled: True + +Style/PredicateName: + Enabled: True + +Style/RedundantException: + Enabled: True + +Style/SelfAssignment: + Enabled: True + +Style/Proc: + Enabled: True + +Style/RaiseArgs: + Enabled: True + +Style/RedundantBegin: + Enabled: True + +Style/RescueModifier: + Enabled: True + +# based on https://github.com/voxpupuli/modulesync_config/issues/168 +Style/RegexpLiteral: + EnforcedStyle: percent_r + Enabled: True + +Lint/UnderscorePrefixedVariableName: + Enabled: True + +Metrics/ParameterLists: + Enabled: False + +Lint/RequireParentheses: + Enabled: True + +Style/SpaceBeforeFirstArg: + Enabled: True + +Style/ModuleFunction: + Enabled: True + +Lint/Debugger: + Enabled: True + +Style/IfWithSemicolon: + Enabled: True + +Style/Encoding: + Enabled: True + +Style/BlockDelimiters: + Enabled: True + +Style/MultilineBlockLayout: + Enabled: True + +# 'Complexity' is very relative +Metrics/AbcSize: + Enabled: False + +# 'Complexity' is very relative +Metrics/PerceivedComplexity: + Enabled: False + +Lint/UselessAssignment: + Enabled: True + +Style/ClosingParenthesisIndentation: + Enabled: True + +# RSpec + +# We don't use rspec in this way +RSpec/DescribeClass: + Enabled: False + +# Example length is not necessarily an indicator of code quality +RSpec/ExampleLength: + Enabled: False + +RSpec/NamedSubject: + Enabled: False diff --git a/.travis.yml b/.travis.yml index 32a41065..3f02a065 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,52 @@ +--- sudo: false language: ruby -rvm: -- 2.1.6 -- 2.0.0 -- 1.9.3 -env: - matrix: - - PUPPET_VERSION=4.3.2 STRICT_VARIABLES=no - - PUPPET_VERSION=3.8.7 STRICT_VARIABLES=no - - PUPPET_VERSION=3.8.7 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes STRICT_VARIABLES=no +cache: bundler +bundler_args: --without system_tests development +before_install: + - bundle -v + - rm Gemfile.lock || true + - gem update --system + - gem update bundler + - gem --version + - bundle -v +script: + - 'bundle exec rake $CHECK' matrix: + fast_finish: true include: - - rvm: 2.1.6 - env: PUPPET_VERSION=3.8.7 STRICT_VARIABLES=no - - rvm: 2.2.3 - env: PUPPET_VERSION=4.3.2 STRICT_VARIABLES=no - - rvm: 2.3.0 - env: PUPPET_VERSION=4.6.1 STRICT_VARIABLES=no + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test + - rvm: 2.1.9 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.1.9 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.2.5 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.3.1 + env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.3.1 + env: PUPPET_VERSION="~> 4.0" CHECK=rubocop + - rvm: 2.3.1 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.4.0-preview1 + env: PUPPET_VERSION="~> 4.0" CHECK=test + allow_failures: + - rvm: 2.4.0-preview1 +notifications: + email: false +deploy: + provider: puppetforge + deploy: + branch: ha-bug-puppet-forge + user: puppet + password: + secure: "" + on: + tags: true + # all_branches is required to use tags + all_branches: true + # Only publish the build marked with "DEPLOY_TO_FORGE" + condition: "$DEPLOY_TO_FORGE = yes" diff --git a/.yardopts b/.yardopts new file mode 100644 index 00000000..29c933bc --- /dev/null +++ b/.yardopts @@ -0,0 +1 @@ +--markup markdown diff --git a/Gemfile b/Gemfile index 6a5471ac..05713780 100644 --- a/Gemfile +++ b/Gemfile @@ -1,39 +1,65 @@ -source 'https://rubygems.org' - -group :development, :test do - gem 'rake' - gem 'rspec' - gem 'rspec-puppet' - gem 'rspec-puppet-facts' - gem 'puppetlabs_spec_helper' - gem 'puppet-module' - gem 'yard' - gem 'json', '~> 1.0', {"platforms"=>["ruby_18", "ruby_19"]} - gem 'json_pure', '~> 1.0', {"platforms"=>["ruby_18", "ruby_19"]} - gem 'puppet-lint', '~> 2.0' - gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-empty_string-check' - gem 'puppet-lint-file_ensure-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-param-docs' - gem 'puppet-lint-trailing_comma-check' - gem 'puppet-lint-undef_in_function-check' - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-version_comparison-check' - gem 'metadata-json-lint' - gem 'puppet-blacksmith', '>= 3.1.0' +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +def location_for(place, fake_version = nil) + if place =~ /^(git[:@][^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end end -if facterversion = ENV['FACTER_VERSION'] - gem 'facter', facterversion -else - gem 'facter' +group :test do + gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false + gem 'rspec-puppet', :require => false, :git => 'https://github.com/rodjek/rspec-puppet.git' + gem 'rspec-puppet-facts', :require => false + gem 'rspec-puppet-utils', :require => false + gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-leading_zero-check', :require => false + gem 'puppet-lint-trailing_comma-check', :require => false + gem 'puppet-lint-version_comparison-check', :require => false + gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false + gem 'puppet-lint-unquoted_string-check', :require => false + gem 'puppet-lint-variable_contains_upcase', :require => false + gem 'metadata-json-lint', :require => false + gem 'puppet-blacksmith', :require => false + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' + gem 'puppet-strings', '~> 0.99.0', :require => false + gem 'rubocop-rspec', '~> 1.6', :require => false if RUBY_VERSION >= '2.3.0' + gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' + gem 'mocha', '>= 1.2.1', :require => false + gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0' end -if puppetversion = ENV['PUPPET_VERSION'] - gem 'puppet', puppetversion +group :development do + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false +end + +group :system_tests do + if beaker_version = ENV['BEAKER_VERSION'] + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end + gem 'serverspec', :require => false + gem 'beaker-puppet_install_helper', :require => false +end + + + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else - gem 'puppet' + gem 'facter', :require => false, :groups => [:test] end -# vim:ft=ruby +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +gem 'puppet', puppetversion, :require => false, :groups => [:test] + +# vim: syntax=ruby diff --git a/Rakefile b/Rakefile index b60a6bc2..d00f2470 100644 --- a/Rakefile +++ b/Rakefile @@ -1,23 +1,33 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' +require 'puppet_blacksmith/rake_tasks' +require 'voxpupuli/release/rake_tasks' +require 'puppet-strings/tasks' -# blacksmith is broken with ruby 1.8.7 -if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('1.8.7') - # blacksmith isn't always present, e.g. on Travis with --without development - begin - require 'puppet_blacksmith/rake_tasks' - Blacksmith::RakeTask.new do |t| - t.tag_pattern = "%s" - end - rescue LoadError - end -end +PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_140chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') -Rake::Task['lint'].clear +exclude_paths = %w( + pkg/**/* + vendor/**/* + .vendor/**/* + spec/**/* +) +PuppetLint.configuration.ignore_paths = exclude_paths +PuppetSyntax.exclude_paths = exclude_paths -PuppetLint::RakeTask.new :lint do |config| - config.pattern = 'manifests/**/*.pp' - config.fail_on_warnings = true +desc 'Run acceptance tests' +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' end -task :default => [:validate, :lint, :spec] \ No newline at end of file +desc 'Run tests metadata_lint, release_checks' +task test: [ + :metadata_lint, + :release_checks, +] +# vim: syntax=ruby diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml new file mode 100644 index 00000000..089d646a --- /dev/null +++ b/spec/acceptance/nodesets/centos-511-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-511-x64: + roles: + - master + platform: el-5-x86_64 + box: puppetlabs/centos-5.11-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml new file mode 100644 index 00000000..1e7aea6d --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64-pe.yml @@ -0,0 +1,17 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-66-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-puppet-enterprise + hypervisor: vagrant +CONFIG: + type: pe +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64.yml b/spec/acceptance/nodesets/centos-66-x64.yml new file mode 100644 index 00000000..42455e7a --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-66-x64: + roles: + - master + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-72-x64.yml b/spec/acceptance/nodesets/centos-72-x64.yml new file mode 100644 index 00000000..85af89d3 --- /dev/null +++ b/spec/acceptance/nodesets/centos-72-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-72-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml new file mode 100644 index 00000000..6ef6de8c --- /dev/null +++ b/spec/acceptance/nodesets/debian-78-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-78-x64: + roles: + - master + platform: debian-7-amd64 + box: puppetlabs/debian-7.8-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml new file mode 100644 index 00000000..9897a8fc --- /dev/null +++ b/spec/acceptance/nodesets/debian-82-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-82-x64: + roles: + - master + platform: debian-8-amd64 + box: puppetlabs/debian-8.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-5.yml b/spec/acceptance/nodesets/docker/centos-5.yml new file mode 100644 index 00000000..33e6d2eb --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-5.yml @@ -0,0 +1,22 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-5-x64: + default_apply_opts: + order: random + strict_variables: + platform: el-5-x86_64 + hypervisor : docker + image: tianon/centos:5.10 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs tar wget which' + - 'sed -i -e "/mingetty/d" /etc/inittab' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-6.yml b/spec/acceptance/nodesets/docker/centos-6.yml new file mode 100644 index 00000000..235b050d --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-6.yml @@ -0,0 +1,23 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-6-x64: + default_apply_opts: + order: random + strict_variables: + platform: el-6-x86_64 + hypervisor : docker + image: centos:6 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm -rf /var/run/network/*' + - 'yum install -y crontabs tar wget' + - 'rm /etc/init/tty.conf' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml new file mode 100644 index 00000000..634a4327 --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -0,0 +1,21 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-7-x64: + default_apply_opts: + order: random + strict_variables: + platform: el-7-x86_64 + hypervisor : docker + image: centos:7 + docker_preserve_image: true + docker_cmd: '["/usr/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs tar wget iproute' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-7.yml b/spec/acceptance/nodesets/docker/debian-7.yml new file mode 100644 index 00000000..75a71fa6 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-7.yml @@ -0,0 +1,21 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-7-x64: + default_apply_opts: + order: random + strict_variables: + platform: debian-7-amd64 + hypervisor : docker + image: debian:7 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y cron locales-all net-tools wget' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml new file mode 100644 index 00000000..9de31382 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -0,0 +1,22 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-8-x64: + default_apply_opts: + order: random + strict_variables: + platform: debian-8-amd64 + hypervisor : docker + image: debian:8 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y cron locales-all net-tools wget' + - 'rm -f /usr/sbin/policy-rc.d' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-12.04.yml b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml new file mode 100644 index 00000000..e06e7bba --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml @@ -0,0 +1,22 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1204-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-12.04-amd64 + hypervisor : docker + image: ubuntu:12.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml new file mode 100644 index 00000000..1849f988 --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml @@ -0,0 +1,24 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1404-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-14.04-amd64 + hypervisor : docker + image: ubuntu:14.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm /usr/sbin/policy-rc.d' + - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml new file mode 100644 index 00000000..ac507a65 --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -0,0 +1,22 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1604-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-16.04-amd64 + hypervisor : docker + image: ubuntu:16.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml new file mode 100644 index 00000000..29102c56 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1204-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box: puppetlabs/ubuntu-12.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 00000000..054e6588 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml new file mode 100644 index 00000000..bc85e0e8 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1604-x64: + roles: + - master + platform: ubuntu-16.04-amd64 + box: puppetlabs/ubuntu-16.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb new file mode 100644 index 00000000..de446548 --- /dev/null +++ b/spec/classes/coverage_spec.rb @@ -0,0 +1,4 @@ +require 'rspec-puppet' + +at_exit { RSpec::Puppet::Coverage.report! } +# vim: syntax=ruby diff --git a/spec/default_facts.yml b/spec/default_facts.yml new file mode 100644 index 00000000..a3f52bfd --- /dev/null +++ b/spec/default_facts.yml @@ -0,0 +1,6 @@ +--- +concat_basedir: "/tmp" +ipaddress: "172.16.254.254" +is_pe: false +macaddress: "AA:AA:AA:AA:AA:AA" +selinux_config_mode: "disabled" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9c71c49e..623b3a6e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,20 @@ require 'puppetlabs_spec_helper/module_spec_helper' - require 'rspec-puppet-facts' include RspecPuppetFacts + +unless RUBY_VERSION =~ %r{^1.9} + require 'coveralls' + Coveralls.wear! +end + +RSpec.configure do |c| + default_facts = { + puppetversion: Puppet.version, + facterversion: Facter.version + } + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) + c.default_facts = default_facts +end + +# vim: syntax=ruby From 4a57db7a90590ab853a9bcab3ae2a118a9c18865 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sat, 22 Oct 2016 17:50:09 +0200 Subject: [PATCH 123/221] Refactor classes php::fpm and php::fpm:service --- manifests/fpm.pp | 62 ++++++++++++----------- manifests/fpm/config.pp | 2 - manifests/fpm/pool.pp | 5 +- manifests/fpm/service.pp | 12 ++--- manifests/init.pp | 92 ++++++++++++++++++++--------------- spec/classes/php_fpm_spec.rb | 20 +++++--- spec/defines/fpm_pool_spec.rb | 1 + 7 files changed, 108 insertions(+), 86 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 84bcc0df..0743b052 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -45,20 +45,20 @@ # class php::fpm ( $ensure = $::php::ensure, - $service_ensure = $::php::params::fpm_service_ensure, - $service_enable = $::php::params::fpm_service_enable, - $service_name = $::php::params::fpm_service_name, - $service_provider = undef, - $package = "${::php::package_prefix}${::php::params::fpm_package_suffix}", - $inifile = $::php::params::fpm_inifile, - $settings = {}, - $global_pool_settings = {}, - $pools = { 'www' => {} }, - $log_owner = $::php::params::fpm_user, - $log_group = $::php::params::fpm_group, -) inherits ::php::params { + $service_ensure = $::php::fpm_service_ensure, + $service_enable = $::php::fpm_service_enable, + $service_name = $::php::fpm_service_name, + $service_provider = $::php::fpm_service_provider, + $package = $::php::real_fpm_package, + $inifile = $::php::fpm_inifile, + $settings = $::php::real_settings, + $global_pool_settings = $::php::real_fpm_global_pool_settings, + $pools = $::php::real_fpm_pools, + $log_owner = $::php::log_owner, + $log_group = $::php::log_group, +) { - if $caller_module_name != $module_name { + if ! defined(Class['php']) { warning('php::fpm is private') } @@ -77,27 +77,25 @@ default => $package, } - anchor { '::php::fpm::begin': } -> - package { $real_package: - ensure => $ensure, - require => Class['::php::packages'], - } -> - class { '::php::fpm::config': - inifile => $inifile, - settings => $real_settings, - log_owner => $log_owner, - log_group => $log_group, - } -> - class { '::php::fpm::service': - ensure => $service_ensure, - enable => $service_enable, - service_name => $service_name, - provider => $service_provider, - } -> - anchor { '::php::fpm::end': } + package { $real_package: + ensure => $ensure, + require => Class['::php::packages'], + } + + class { '::php::fpm::config': + inifile => $inifile, + settings => $real_settings, + log_owner => $log_owner, + log_group => $log_group, + require => Package[$real_package], + } + contain '::php::fpm::config' + contain '::php::fpm::service' + + Class['php::fpm::config'] ~> Class['php::fpm::service'] $real_global_pool_settings = hiera_hash('php::fpm::global_pool_settings', $global_pool_settings) - $real_pools = hiera_hash('php::fpm::pools', $pools) + $real_pools = hiera_hash('php::fpm::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 diff --git a/manifests/fpm/config.pp b/manifests/fpm/config.pp index 0b226869..636706b3 100644 --- a/manifests/fpm/config.pp +++ b/manifests/fpm/config.pp @@ -131,7 +131,6 @@ file { $config_file: ensure => file, - notify => Class['::php::fpm::service'], content => template('php/fpm/php-fpm.conf.erb'), owner => root, group => $root_group, @@ -155,6 +154,5 @@ ::php::config { 'fpm': file => $inifile, config => $settings, - notify => Class['::php::fpm::service'], } } diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index 39665ef6..e17faec8 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -156,7 +156,10 @@ $base_dir = undef, ) { - include ::php::params + # The base class must be included first because it is used by parameter defaults + if ! defined(Class['php']) { + warning('You must include the php base class before using any php defined resources') + } if $base_dir != undef { validate_absolute_path($base_dir) diff --git a/manifests/fpm/service.pp b/manifests/fpm/service.pp index d8bcecd7..8f7d150a 100644 --- a/manifests/fpm/service.pp +++ b/manifests/fpm/service.pp @@ -15,13 +15,13 @@ # Defines if the service provider to use # class php::fpm::service( - $service_name = $::php::params::fpm_service_name, - $ensure = $::php::params::fpm_service_ensure, - $enable = $::php::params::fpm_service_enable, - $provider = undef, -) inherits ::php::params { + $service_name = $::php::fpm::service_name, + $ensure = $::php::fpm::service_ensure, + $enable = $::php::fpm::service_enable, + $provider = $::php::fpm::service_provider, +) { - if $caller_module_name != $module_name { + if ! defined(Class['php::fpm']) { warning('php::fpm::service is private') } diff --git a/manifests/init.pp b/manifests/init.pp index d9626c9b..d26d2269 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,11 +23,25 @@ # This is the name of the php-fpm service. It defaults to reasonable OS # defaults but can be different in case of using php7.0/other OS/custom fpm service # -# [*fpm_service_provider*] +# [*fpm_service_provider*] # This is the name of the service provider, in case there is a non # OS default service provider used to start FPM. # Defaults to 'undef', pick system defaults. # +# [*fpm_pools*] +# Hash of php::fpm::pool resources that will be created. Defaults +# to a single php::fpm::pool named www with default parameters. +# +# [*fpm_global_pool_settings*] +# Hash of defaults params php::fpm::pool resources that will be created. +# Defaults to empty hash. +# +# [*fpm_inifile*] +# Path to php.ini for fpm +# +# [*fpm_package*] +# Name of fpm package to install +# # [*dev*] # Install php header files, needed to install pecl modules # @@ -88,30 +102,34 @@ # [*settings*] # class php ( - $ensure = $::php::params::ensure, - $manage_repos = $::php::params::manage_repos, - $fpm = true, - $fpm_service_enable = $::php::params::fpm_service_enable, - $fpm_service_ensure = $::php::params::fpm_service_ensure, - $fpm_service_name = $::php::params::fpm_service_name, - $fpm_service_provider = undef, - $embedded = false, - $dev = true, - $composer = true, - $pear = true, - $pear_ensure = $::php::params::pear_ensure, - $phpunit = false, - $environment = undef, - $manage_curl = true, - $extensions = {}, - $settings = {}, - $package_prefix = $::php::params::package_prefix, - $config_root_ini = $::php::params::config_root_ini, - $ext_tool_enable = $::php::params::ext_tool_enable, - $ext_tool_query = $::php::params::ext_tool_query, - $ext_tool_enabled = $::php::params::ext_tool_enabled, - $log_owner = $::php::params::fpm_user, - $log_group = $::php::params::fpm_group, + $ensure = $::php::params::ensure, + $manage_repos = $::php::params::manage_repos, + $fpm = true, + $fpm_service_enable = $::php::params::fpm_service_enable, + $fpm_service_ensure = $::php::params::fpm_service_ensure, + $fpm_service_name = $::php::params::fpm_service_name, + $fpm_service_provider = undef, + $fpm_pools = { 'www' => {} }, + $fpm_global_pool_settings = {}, + $fpm_inifile = $::php::params::fpm_inifile, + $fpm_package = undef, + $embedded = false, + $dev = true, + $composer = true, + $pear = true, + $pear_ensure = $::php::params::pear_ensure, + $phpunit = false, + $environment = undef, + $manage_curl = true, + $extensions = {}, + $settings = {}, + $package_prefix = $::php::params::package_prefix, + $config_root_ini = $::php::params::config_root_ini, + $ext_tool_enable = $::php::params::ext_tool_enable, + $ext_tool_query = $::php::params::ext_tool_query, + $ext_tool_enabled = $::php::params::ext_tool_enabled, + $log_owner = $::php::params::fpm_user, + $log_group = $::php::params::fpm_group, ) inherits ::php::params { validate_string($ensure) @@ -127,6 +145,8 @@ validate_bool($manage_curl) validate_hash($extensions) validate_hash($settings) + validate_hash($fpm_pools) + validate_hash($fpm_global_pool_settings) validate_string($log_owner) validate_string($log_group) @@ -140,12 +160,20 @@ validate_absolute_path($ext_tool_query) } + $real_fpm_package = pick($fpm_package, "${package_prefix}${::php::params::fpm_package_suffix}") + # Deep merge global php settings $real_settings = deep_merge($settings, hiera_hash('php::settings', {})) # Deep merge global php extensions $real_extensions = deep_merge($extensions, hiera_hash('php::extensions', {})) + # Deep merge fpm_pools + $real_fpm_pools = deep_merge($fpm_pools, hiera_hash('php::fpm_pools', {})) + + # Deep merge fpm_global_pool_settings + $real_fpm_global_pool_settings = deep_merge($fpm_global_pool_settings, hiera_hash('php::fpm_global_pool_settings', {})) + if $manage_repos { class { '::php::repo': } -> Anchor['php::begin'] @@ -167,19 +195,7 @@ Anchor['php::end'] } - if $fpm { - Anchor['php::begin'] -> - class { '::php::fpm': - service_enable => $fpm_service_enable, - service_ensure => $fpm_service_ensure, - service_name => $fpm_service_name, - service_provider => $fpm_service_provider, - settings => $real_settings, - log_owner => $log_owner, - log_group => $log_group, - } -> - Anchor['php::end'] - } + if $fpm { contain '::php::fpm' } if $embedded { if $::osfamily == 'RedHat' and $fpm { # Both fpm and embeded SAPIs are using same php.ini diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index e2c90e55..bd98113c 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -6,20 +6,26 @@ let :facts do facts end + let(:pre_condition) { 'class {"php": fpm => false}' } describe 'when called with no parameters' do case facts[:osfamily] when 'Debian' - let(:params) do - { - package: 'php5-fpm', - ensure: 'latest' - } - end - it { is_expected.to contain_package('php5-fpm').with_ensure('latest') } + it { is_expected.to contain_package('php5-fpm').with_ensure('present') } it { is_expected.to contain_service('php5-fpm').with_ensure('running') } + when 'Suse' + it { is_expected.to contain_package('php5-fpm').with_ensure('present') } + it { is_expected.to contain_service('php-fpm').with_ensure('running') } + when 'FreeBSD' + it { is_expected.not_to contain_package('php56-') } + it { is_expected.not_to contain_package('php5-fpm') } + it { is_expected.not_to contain_package('php-fpm') } + it { is_expected.to contain_service('php-fpm').with_ensure('running') } else + it { is_expected.to contain_package('php-fpm').with_ensure('present') } it { is_expected.to contain_service('php-fpm').with_ensure('running') } end + it { is_expected.to contain_class('php::fpm::config').that_notifies('Class[php::fpm::service]') } + it { is_expected.to contain_class('php::fpm::service') } end end end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index eb807645..c423306c 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -6,6 +6,7 @@ let :facts do facts end + let(:pre_condition) { 'include php' } case facts[:osfamily] when 'Debian' case facts[:operatingsystem] From d7e7cad970368e39c9fbc10e32d3d4a9611fb6c8 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sat, 22 Oct 2016 17:50:33 +0200 Subject: [PATCH 124/221] Fix several Rubocop issues --- lib/puppet/parser/functions/ensure_prefix.rb | 6 +++-- spec/classes/php_fpm_config_spec.rb | 24 ++++++++++---------- spec/defines/extension_spec.rb | 2 +- spec/functions/to_hash_settings_spec.rb | 6 ++--- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index 58bf4135..c6ca6cb4 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -20,8 +20,10 @@ module Puppet::Parser::Functions ['p.a', 'p.b', 'p.c'] EOS ) do |arguments| - raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' \ - "given (#{arguments.size} for 2)") if arguments.size < 2 + if arguments.size < 2 + raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' \ + "given (#{arguments.size} for 2)") + end enumerable = arguments[0] diff --git a/spec/classes/php_fpm_config_spec.rb b/spec/classes/php_fpm_config_spec.rb index 538c7222..bf78b3ce 100644 --- a/spec/classes/php_fpm_config_spec.rb +++ b/spec/classes/php_fpm_config_spec.rb @@ -10,28 +10,28 @@ describe 'creates config file' do let(:params) do { - inifile: '/etc/php5/conf.d/unique-name.ini', - settings: { - 'apc.enabled' => 1 - } + inifile: '/etc/php5/conf.d/unique-name.ini', + settings: { + 'apc.enabled' => 1 + } } end it do is_expected.to contain_class('php::fpm::config').with( - inifile: '/etc/php5/conf.d/unique-name.ini', - settings: { - 'apc.enabled' => 1 - } + inifile: '/etc/php5/conf.d/unique-name.ini', + settings: { + 'apc.enabled' => 1 + } ) end it do is_expected.to contain_php__config('fpm').with( - file: '/etc/php5/conf.d/unique-name.ini', - config: { - 'apc.enabled' => 1 - } + file: '/etc/php5/conf.d/unique-name.ini', + config: { + 'apc.enabled' => 1 + } ) end end diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index ea1045f9..55fa4b44 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -103,7 +103,7 @@ is_expected.to contain_php__config('json').with( config: { 'extension' => 'json.so', - 'bar.test' => 'foo', + 'bar.test' => 'foo' } ) end diff --git a/spec/functions/to_hash_settings_spec.rb b/spec/functions/to_hash_settings_spec.rb index bc4b7ef4..de70a8a5 100644 --- a/spec/functions/to_hash_settings_spec.rb +++ b/spec/functions/to_hash_settings_spec.rb @@ -14,11 +14,11 @@ ] describe 'when first parameter is not a hash' do - it { should run.with_params('baz', input).and_raise_error(Puppet::ParseError) } + it { is_expected.to run.with_params('baz', input).and_raise_error(Puppet::ParseError) } end describe 'when used with proper parameters' do - it { should run.with_params(input).and_return(results[0]) } - it { should run.with_params(input, 'foo').and_return(results[1]) } + it { is_expected.to run.with_params(input).and_return(results[0]) } + it { is_expected.to run.with_params(input, 'foo').and_return(results[1]) } end end From ed17e6df5d2b2acf0fdb7fb688ad6521483ce2d0 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sat, 22 Oct 2016 18:02:41 +0200 Subject: [PATCH 125/221] Add missing parameters for Suse, RedHat and FreeBSD --- manifests/params.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/params.pp b/manifests/params.pp index 6ec2c5d1..dc31c681 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -84,6 +84,8 @@ $package_prefix = $php::globals::package_prefix $manage_repos = true $root_group = 'root' + $ext_tool_enable = undef + $ext_tool_query = undef $ext_tool_enabled = false case $::operatingsystem { 'SLES': { @@ -119,6 +121,8 @@ $compiler_packages = ['gcc', 'gcc-c++', 'make'] $manage_repos = false $root_group = 'root' + $ext_tool_enable = undef + $ext_tool_query = undef $ext_tool_enabled = false } 'FreeBSD': { @@ -147,6 +151,8 @@ $compiler_packages = ['gcc'] $manage_repos = false $root_group = 'wheel' + $ext_tool_enable = undef + $ext_tool_query = undef $ext_tool_enabled = false } default: { From 305c3520fe1202e69564f00267629173f8ef9528 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sat, 22 Oct 2016 18:40:29 +0200 Subject: [PATCH 126/221] Fix pre_condition for extensions --- manifests/extension.pp | 6 +++++- spec/defines/extension_spec.rb | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index 4e60e265..36462d06 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -52,7 +52,7 @@ # String parameter, whether to specify ALL sapi or a specific sapi. # Defaults to ALL. # -define php::extension( +define php::extension ( $ensure = 'installed', $provider = undef, $source = undef, @@ -68,6 +68,10 @@ $sapi = 'ALL', ) { + if ! defined(Class['php']) { + warning('php::extension is private') + } + validate_string($ensure) validate_string($package_prefix) validate_string($so_name) diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 55fa4b44..cc5ae19a 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -7,9 +7,7 @@ facts end - let(:pre_condition) do - 'include php::params' - end + let(:pre_condition) { 'include php' } unless facts[:osfamily] == 'Suse' || facts[:osfamily] == 'FreeBSD' # FIXME: something is wrong on these etcdir = case facts[:osfamily] From 232f2300e30d5f180ca9d8859bc626cdc6c8a701 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Mon, 7 Nov 2016 09:31:59 +0100 Subject: [PATCH 127/221] Update based on voxpupuli/modulesync_config 0.15.0 --- .gitignore | 1 + .msync.yml | 2 +- .rubocop.yml | 2 +- Gemfile | 3 ++- spec/acceptance/nodesets/docker/centos-5.yml | 13 +++++-------- spec/acceptance/nodesets/docker/centos-6.yml | 11 ++++------- spec/acceptance/nodesets/docker/centos-7.yml | 11 ++++------- spec/acceptance/nodesets/docker/debian-7.yml | 12 +++++------- spec/acceptance/nodesets/docker/debian-8.yml | 12 +++++------- spec/acceptance/nodesets/docker/ubuntu-12.04.yml | 9 +++------ spec/acceptance/nodesets/docker/ubuntu-14.04.yml | 9 +++------ spec/acceptance/nodesets/docker/ubuntu-16.04.yml | 9 +++------ spec/spec_helper.rb | 11 ++++++++++- 13 files changed, 47 insertions(+), 58 deletions(-) diff --git a/.gitignore b/.gitignore index 3c1af2d4..aa3993d3 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ log/ .idea/ *.iml .*.sw +.yardoc/ diff --git a/.msync.yml b/.msync.yml index fc9aad75..e24f9086 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.14.1' +modulesync_config_version: '0.15.0' diff --git a/.rubocop.yml b/.rubocop.yml index e1e0276b..f703c727 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -57,7 +57,7 @@ Style/AndOr: Style/RedundantSelf: Enabled: True -Metric/BlockLength: +Metrics/BlockLength: Enabled: False # Method length is not necessarily an indicator of code quality diff --git a/Gemfile b/Gemfile index 05713780..da262185 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ end group :test do gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false - gem 'rspec-puppet', :require => false, :git => 'https://github.com/rodjek/rspec-puppet.git' + gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-absolute_classname-check', :require => false @@ -30,6 +30,7 @@ group :test do gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0' + gem 'simplecov-console', :require => false if RUBY_VERSION >= '2.0.0' end group :development do diff --git a/spec/acceptance/nodesets/docker/centos-5.yml b/spec/acceptance/nodesets/docker/centos-5.yml index 33e6d2eb..c17bc3d0 100644 --- a/spec/acceptance/nodesets/docker/centos-5.yml +++ b/spec/acceptance/nodesets/docker/centos-5.yml @@ -4,19 +4,16 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: centos-5-x64: - default_apply_opts: - order: random - strict_variables: platform: el-5-x86_64 - hypervisor : docker - image: tianon/centos:5.10 + hypervisor: docker + image: centos:5 docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'yum install -y crontabs tar wget which' + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' - 'sed -i -e "/mingetty/d" /etc/inittab' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-6.yml b/spec/acceptance/nodesets/docker/centos-6.yml index 235b050d..d93f884c 100644 --- a/spec/acceptance/nodesets/docker/centos-6.yml +++ b/spec/acceptance/nodesets/docker/centos-6.yml @@ -4,20 +4,17 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: centos-6-x64: - default_apply_opts: - order: random - strict_variables: platform: el-6-x86_64 - hypervisor : docker + hypervisor: docker image: centos:6 docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - 'rm -rf /var/run/network/*' - - 'yum install -y crontabs tar wget' + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' - 'rm /etc/init/tty.conf' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml index 634a4327..886b1eeb 100644 --- a/spec/acceptance/nodesets/docker/centos-7.yml +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -4,18 +4,15 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: centos-7-x64: - default_apply_opts: - order: random - strict_variables: platform: el-7-x86_64 - hypervisor : docker + hypervisor: docker image: centos:7 docker_preserve_image: true docker_cmd: '["/usr/sbin/init"]' docker_image_commands: - - 'yum install -y crontabs tar wget iproute' + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-7.yml b/spec/acceptance/nodesets/docker/debian-7.yml index 75a71fa6..071acbf9 100644 --- a/spec/acceptance/nodesets/docker/debian-7.yml +++ b/spec/acceptance/nodesets/docker/debian-7.yml @@ -4,18 +4,16 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: debian-7-x64: - default_apply_opts: - order: random - strict_variables: platform: debian-7-amd64 - hypervisor : docker + hypervisor: docker image: debian:7 docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'apt-get install -y cron locales-all net-tools wget' + - 'echo deb http://ftp.debian.org/debian wheezy-backports main >> /etc/apt/sources.list' + - 'apt-get update && apt-get install -y cron locales-all net-tools wget' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml index 9de31382..500bee52 100644 --- a/spec/acceptance/nodesets/docker/debian-8.yml +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -4,19 +4,17 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: debian-8-x64: - default_apply_opts: - order: random - strict_variables: platform: debian-8-amd64 - hypervisor : docker + hypervisor: docker image: debian:8 docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'apt-get install -y cron locales-all net-tools wget' + - 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list' + - 'apt-get update && apt-get install -y cron locales-all net-tools wget' - 'rm -f /usr/sbin/policy-rc.d' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-12.04.yml b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml index e06e7bba..ab77cda4 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-12.04.yml +++ b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml @@ -4,11 +4,8 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: ubuntu-1204-x64: - default_apply_opts: - order: random - strict_variables: platform: ubuntu-12.04-amd64 - hypervisor : docker + hypervisor: docker image: ubuntu:12.04 docker_preserve_image: true docker_cmd: '["/sbin/init"]' @@ -16,7 +13,7 @@ HOSTS: - 'apt-get install -y net-tools wget' - 'locale-gen en_US.UTF-8' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml index 1849f988..54d5e5a5 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml +++ b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml @@ -4,11 +4,8 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: ubuntu-1404-x64: - default_apply_opts: - order: random - strict_variables: platform: ubuntu-14.04-amd64 - hypervisor : docker + hypervisor: docker image: ubuntu:14.04 docker_preserve_image: true docker_cmd: '["/sbin/init"]' @@ -18,7 +15,7 @@ HOSTS: - 'apt-get install -y net-tools wget' - 'locale-gen en_US.UTF-8' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml index ac507a65..92a93cb7 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml +++ b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -4,11 +4,8 @@ # https://github.com/voxpupuli/modulesync_config HOSTS: ubuntu-1604-x64: - default_apply_opts: - order: random - strict_variables: platform: ubuntu-16.04-amd64 - hypervisor : docker + hypervisor: docker image: ubuntu:16.04 docker_preserve_image: true docker_cmd: '["/sbin/init"]' @@ -16,7 +13,7 @@ HOSTS: - 'apt-get install -y net-tools wget' - 'locale-gen en_US.UTF-8' CONFIG: - type: aio - log_level: debug + trace_limit: 200 + masterless: true ... # vim: syntax=yaml diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 623b3a6e..cd45c0e8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,7 +4,16 @@ unless RUBY_VERSION =~ %r{^1.9} require 'coveralls' - Coveralls.wear! + require 'simplecov' + require 'simplecov-console' + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console, + Coveralls::SimpleCov::Formatter + ] + SimpleCov.start do + add_filter '/spec' + end end RSpec.configure do |c| From 435443dfe8c30b96c016ab75ce55bb601edb421e Mon Sep 17 00:00:00 2001 From: Phil Fenstermacher Date: Mon, 7 Nov 2016 23:14:46 -0500 Subject: [PATCH 128/221] Manage apache/PHP configurations on Debian and RHEL systems --- manifests/apache_config.pp | 29 +++++++++++++++++++++++++++++ manifests/init.pp | 12 ++++++++++++ manifests/params.pp | 2 ++ 3 files changed, 43 insertions(+) create mode 100644 manifests/apache_config.pp diff --git a/manifests/apache_config.pp b/manifests/apache_config.pp new file mode 100644 index 00000000..291c9407 --- /dev/null +++ b/manifests/apache_config.pp @@ -0,0 +1,29 @@ +# Install and configure php apache settings +# +# === Parameters +# +# [*inifile*] +# The path to the ini php-apache ini file +# +# [*settings*] +# Hash with nested hash of key => value to set in inifile +# +class php::apache_config( + $inifile = $::php::params::apache_inifile, + $settings = {} +) inherits ::php::params { + + if $caller_module_name != $module_name { + warning('php::apache_config is private') + } + + validate_absolute_path($inifile) + validate_hash($settings) + + $real_settings = deep_merge($settings, hiera_hash('php::apache::settings', {})) + + ::php::config { 'apache': + file => $inifile, + config => $real_settings, + } +} diff --git a/manifests/init.pp b/manifests/init.pp index d26d2269..9bc9c701 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -54,6 +54,9 @@ # [*phpunit*] # Install phpunit # +# [*apache_config*] +# Manage apache's mod_php configuration +# # [*environment*] # Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy. # These are passed through to the underlying exec(s), so it follows the same format @@ -119,6 +122,7 @@ $pear = true, $pear_ensure = $::php::params::pear_ensure, $phpunit = false, + $apache_config = false, $environment = undef, $manage_curl = true, $extensions = {}, @@ -142,6 +146,7 @@ validate_bool($ext_tool_enabled) validate_string($pear_ensure) validate_bool($phpunit) + validate_bool($apache_config) validate_bool($manage_curl) validate_hash($extensions) validate_hash($settings) @@ -233,6 +238,13 @@ class { '::php::phpunit': } -> Anchor['php::end'] } + if $apache_config { + Anchor['php::begin'] -> + class { '::php::apache_config': + settings => $real_settings, + } -> + Anchor['php::end'] + } create_resources('::php::extension', $real_extensions, { require => Class['::php::cli'], diff --git a/manifests/params.pp b/manifests/params.pp index dc31c681..df29edd9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -32,6 +32,7 @@ $fpm_service_name = $php::globals::fpm_service_name $fpm_user = 'www-data' $fpm_group = 'www-data' + $apache_inifile = "${config_root}/apache2/php.ini" $embedded_package_suffix = 'embed' $embedded_inifile = "${config_root}/embed/php.ini" $package_prefix = $php::globals::package_prefix @@ -115,6 +116,7 @@ $fpm_service_name = 'php-fpm' $fpm_user = 'apache' $fpm_group = 'apache' + $apache_inifile = '/etc/php.ini' $embedded_package_suffix = 'embedded' $embedded_inifile = '/etc/php.ini' $package_prefix = 'php-' From aaf802ecc3784076a15199ff7298ba9e256ea4fa Mon Sep 17 00:00:00 2001 From: Jesse Cotton Date: Thu, 17 Nov 2016 11:43:56 -0800 Subject: [PATCH 129/221] Expose global inifile variable --- manifests/global.pp | 4 ++-- manifests/init.pp | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/manifests/global.pp b/manifests/global.pp index f172aa79..76789943 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -12,9 +12,9 @@ # class php::global( - $inifile = $::php::params::config_root_inifile, + $inifile = $::php::config_root_inifile, $settings = {} -) inherits ::php::params { +) inherits ::php { if $caller_module_name != $module_name { warning('php::global is private') diff --git a/manifests/init.pp b/manifests/init.pp index 9bc9c701..3a265533 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -78,6 +78,10 @@ # to a sensible default depending on your operating system, like # '/etc/php5/mods-available' or '/etc/php5/conf.d'. # +# [*config_root_inifile*] +# The path to the global php.ini file. This defaults to a sensible default +# depending on your operating system. +# # [*ext_tool_enable*] # Absolute path to php tool for enabling extensions in debian/ubuntu systems. # This defaults to '/usr/sbin/php5enmod'. @@ -129,6 +133,7 @@ $settings = {}, $package_prefix = $::php::params::package_prefix, $config_root_ini = $::php::params::config_root_ini, + $config_root_inifile = $::php::params::config_root_inifile, $ext_tool_enable = $::php::params::ext_tool_enable, $ext_tool_query = $::php::params::ext_tool_query, $ext_tool_enabled = $::php::params::ext_tool_enabled, @@ -154,10 +159,9 @@ validate_hash($fpm_global_pool_settings) validate_string($log_owner) validate_string($log_group) + validate_absolute_path($config_root_ini) + validate_absolute_path($config_root_inifile) - if $config_root_ini != undef { - validate_absolute_path($config_root_ini) - } if $ext_tool_enable != undef { validate_absolute_path($ext_tool_enable) } From 30410e38f12862a9598578a4767569f77fdeea74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Tue, 29 Nov 2016 16:39:31 +0100 Subject: [PATCH 130/221] use voxpupuli/archive to download composer rather than using a hand-crafted curl call, we use voxpupuli/archive to download composer. This has the benefit that it doesn't require us to $manage_curl. But we also remove `$environment`! This variable name is poorly chosen. Overriding it (or even just setting it to `undef`), could mean that someone's `hiera()` lookups are failing, as soon as they enter our module! This pull-request addresses #273. --- .fixtures.yml | 1 + manifests/composer.pp | 45 +++++++++++++++---------------- manifests/composer/auto_update.pp | 23 +++++++++++----- manifests/init.pp | 19 ++++++------- metadata.json | 1 + 5 files changed, 48 insertions(+), 41 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 475e69b3..ff58632c 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -4,5 +4,6 @@ fixtures: apt: "git://github.com/puppetlabs/puppetlabs-apt.git" zypprepo: "git://github.com/deadpoint/puppet-zypprepo.git" inifile: "git://github.com/puppetlabs/puppetlabs-inifile.git" + archive: "git://github.com/voxpupuli/puppet-archive.git" symlinks: php: "#{source_dir}" diff --git a/manifests/composer.pp b/manifests/composer.pp index 240db1fe..a3bb9b4e 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -8,11 +8,11 @@ # [*path*] # Holds path to the Composer executable # -# [*environment*] -# Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy +# [*proxy_type*] +# proxy server type (none|http|https|ftp) # -# [*manage_curl*] -# Should we ensure curl is installed or do you want to manage that? +# [*proxy_server*] +# specify a proxy server, with port number if needed. ie: https://example.com:8080. # # [*auto_update*] # Defines if composer should be auto updated @@ -24,13 +24,13 @@ # UNIX group of the root user # class php::composer ( - $source = $::php::params::composer_source, - $path = $::php::params::composer_path, - $environment = undef, - $manage_curl = true, - $auto_update = true, - $max_age = $::php::params::composer_max_age, - $root_group = $::php::params::root_group, + $source = $::php::params::composer_source, + $path = $::php::params::composer_path, + $proxy_type = undef, + $proxy_server = undef, + $auto_update = true, + $max_age = $::php::params::composer_max_age, + $root_group = $::php::params::root_group, ) inherits ::php::params { if $caller_module_name != $module_name { @@ -42,15 +42,11 @@ validate_bool($auto_update) validate_re("x${max_age}", '^x\d+$') - if $manage_curl { ensure_packages(['curl']) } - - exec { 'download composer': - command => "curl -L ${source} -o ${path}", - environment => $environment, - creates => $path, - path => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', - '/usr/local/bin', '/usr/local/sbin'], - require => [Class['::php::cli'],Package['curl']], + archive { 'download composer': + source => $source, + creates => $path, + proxy_type => $proxy_type, + proxy_server => $proxy_server, } -> file { $path: mode => '0555', @@ -60,10 +56,11 @@ if $auto_update { class { '::php::composer::auto_update': - max_age => $max_age, - source => $source, - path => $path, - environment => $environment, + max_age => $max_age, + source => $source, + path => $path, + proxy_type => $proxy_type, + proxy_server => $proxy_server, } } } diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index f45aaaa3..1dc29300 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -11,8 +11,12 @@ # [*path*] # Holds path to the Composer executable # -# [*environment*] -# Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy +# [*proxy_type*] +# proxy server type (none|http|https|ftp) +# +# [*proxy_server*] +# specify a proxy server, with port number if needed. ie: https://example.com:8080. +# # # === Examples # @@ -25,18 +29,25 @@ $max_age, $source, $path, - $environment = undef, + $proxy_type = undef, + $proxy_server = undef, ) { if $caller_module_name != $module_name { warning('php::composer::auto_update is private') } + if $proxy_type and $proxy_server { + $env = {"${proxy_type}_proxy" => $proxy_server} + } else { + $env = {} + } + exec { 'update composer': - command => "curl -L ${source} -o ${path}", - environment => $environment, + command => "${path} self-update", + environment => $env, onlyif => "test `find '${path}' -mtime +${max_age}`", path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ], - require => File[$path], + require => [File[$path], Class['::php::cli']], } } diff --git a/manifests/init.pp b/manifests/init.pp index 9bc9c701..6d7ce149 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -57,13 +57,11 @@ # [*apache_config*] # Manage apache's mod_php configuration # -# [*environment*] -# Environment variables for settings such as http_proxy, https_proxy, or ftp_proxy. -# These are passed through to the underlying exec(s), so it follows the same format -# of the exec type `environment` +# [*proxy_type*] +# proxy server type (none|http|https|ftp) # -# [*manage_curl*] -# Should we ensure curl is installed or do you want to manage that? +# [*proxy_server*] +# specify a proxy server, with port number if needed. ie: https://example.com:8080. # # [*extensions*] # Install PHP extensions, this is overwritten by hiera hash `php::extensions` @@ -123,8 +121,8 @@ $pear_ensure = $::php::params::pear_ensure, $phpunit = false, $apache_config = false, - $environment = undef, - $manage_curl = true, + $proxy_type = undef, + $proxy_server = undef, $extensions = {}, $settings = {}, $package_prefix = $::php::params::package_prefix, @@ -147,7 +145,6 @@ validate_string($pear_ensure) validate_bool($phpunit) validate_bool($apache_config) - validate_bool($manage_curl) validate_hash($extensions) validate_hash($settings) validate_hash($fpm_pools) @@ -221,8 +218,8 @@ if $composer { Anchor['php::begin'] -> class { '::php::composer': - environment => $environment, - manage_curl => $manage_curl, + proxy_type => $proxy_type, + proxy_server => $proxy_server, } -> Anchor['php::end'] } diff --git a/metadata.json b/metadata.json index 8489961a..c02e3e5c 100644 --- a/metadata.json +++ b/metadata.json @@ -13,6 +13,7 @@ { "name": "puppetlabs/apt", "version_requirement": ">= 1.8.0 < 3.0.0" }, { "name": "puppetlabs/inifile", "version_requirement": "1.x" }, { "name": "darin/zypprepo", "version_requirement": "1.x" }, + { "name": "puppet/archive", "version_requirement": "1.x" }, { "name": "example42/yum", "version_requirement": "2.x" } ], "requirements": [ From a7bf58066903300905a2d04755e6c141c1cb3145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Thu, 1 Dec 2016 13:05:52 +0100 Subject: [PATCH 131/221] *correctly* use voxpupuli/archive additionally, we fix an issue with passing the environment. --- manifests/composer.pp | 2 +- manifests/composer/auto_update.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/composer.pp b/manifests/composer.pp index a3bb9b4e..ba1ec389 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -43,8 +43,8 @@ validate_re("x${max_age}", '^x\d+$') archive { 'download composer': + path => $path, source => $source, - creates => $path, proxy_type => $proxy_type, proxy_server => $proxy_server, } -> diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index 1dc29300..be8b6348 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -40,11 +40,11 @@ if $proxy_type and $proxy_server { $env = {"${proxy_type}_proxy" => $proxy_server} } else { - $env = {} + $env = undef } exec { 'update composer': - command => "${path} self-update", + command => "${path} --no-interaction --quiet self-update", environment => $env, onlyif => "test `find '${path}' -mtime +${max_age}`", path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ], From a981df373d8a25c3c8b0c350d7af1d1a37fe46f6 Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Tue, 6 Dec 2016 18:31:49 +0100 Subject: [PATCH 132/221] respect $manage_repos, do not include ::apt if set to false --- manifests/packages.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifests/packages.pp b/manifests/packages.pp index 0f827513..e6c3d321 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -14,6 +14,7 @@ # class php::packages ( $ensure = $::php::ensure, + $manage_repos = $::php::manage_repos, $names_to_prefix = prefix( $::php::params::common_package_suffixes, $::php::package_prefix # lint:ignore:parameter_documentation ), @@ -30,7 +31,9 @@ $real_names = union($names, $names_to_prefix) if $::osfamily == 'debian' { - include ::apt + if $manage_repos { + include ::apt + } package { $real_names: ensure => $ensure, require => Class['::apt::update'], From 32707dcc68b1894d6fec5cb01fb6dcf1646a3380 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 21 Dec 2016 14:40:29 +0100 Subject: [PATCH 133/221] modulesync 0.16.4 --- .github/CONTRIBUTING.md | 6 +++--- .github/ISSUE_TEMPLATE.md | 15 +++++++++------ .github/PULL_REQUEST_TEMPLATE.md | 3 +++ .gitignore | 2 +- .msync.yml | 2 +- .travis.yml | 17 +++++++++-------- spec/default_facts.yml | 1 - spec/spec_helper.rb | 5 ++++- 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e61f2650..5574191a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,10 +2,11 @@ This module has grown over time based on a range of contributions from people using it. If you follow these contributing guidelines your patch will likely make it into a release a little quicker. - ## Contributing -Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). 1. Fork the repo. @@ -76,7 +77,6 @@ To run the linter, the syntax checker and the unit tests: bundle exec rake test - ## Integration tests The unit tests just check the code runs, not that it does exactly what diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 9ac4a2b0..593e7aa8 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,23 +1,26 @@ -### Affected Puppet, Ruby, OS and module versions/distributions +## Affected Puppet, Ruby, OS and module versions/distributions - Puppet: - Ruby: - Distribution: - Module version: -### How to reproduce (e.g Puppet code you use) +## How to reproduce (e.g Puppet code you use) -### What are you seeing +## What are you seeing -### What behaviour did you expect instead +## What behaviour did you expect instead -### Output log +## Output log -### Any additional information you'd like to impart +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 79272bf6..66f80444 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,8 @@ diff --git a/.gitignore b/.gitignore index aa3993d3..82426da6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,5 @@ coverage/ log/ .idea/ *.iml -.*.sw +.*.sw? .yardoc/ diff --git a/.msync.yml b/.msync.yml index e24f9086..f0107335 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.15.0' +modulesync_config_version: '0.16.4' diff --git a/.travis.yml b/.travis.yml index 3f02a065..6e80237a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,24 +23,25 @@ matrix: env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - rvm: 2.1.9 env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.2.5 + - rvm: 2.2.6 env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.1 + - rvm: 2.3.3 env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.3.1 + - rvm: 2.3.3 env: PUPPET_VERSION="~> 4.0" CHECK=rubocop - - rvm: 2.3.1 + - rvm: 2.3.3 env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0-preview1 + - rvm: 2.4.0-rc1 env: PUPPET_VERSION="~> 4.0" CHECK=test allow_failures: - - rvm: 2.4.0-preview1 + - rvm: 2.4.0-rc1 +branches: + only: + - master notifications: email: false deploy: provider: puppetforge - deploy: - branch: ha-bug-puppet-forge user: puppet password: secure: "" diff --git a/spec/default_facts.yml b/spec/default_facts.yml index a3f52bfd..4f365061 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -3,4 +3,3 @@ concat_basedir: "/tmp" ipaddress: "172.16.254.254" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" -selinux_config_mode: "disabled" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cd45c0e8..32709c81 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ require 'rspec-puppet-facts' include RspecPuppetFacts -unless RUBY_VERSION =~ %r{^1.9} +if Dir.exist?(File.expand_path('../../lib', __FILE__)) && RUBY_VERSION !~ %r{^1.9} require 'coveralls' require 'simplecov' require 'simplecov-console' @@ -12,7 +12,10 @@ Coveralls::SimpleCov::Formatter ] SimpleCov.start do + track_files 'lib/**/*.rb' add_filter '/spec' + add_filter '/vendor' + add_filter '/.vendor' end end From 81a44252d2426a345e736a8a23e60a894e265146 Mon Sep 17 00:00:00 2001 From: Derk Gortemaker Date: Fri, 23 Dec 2016 22:23:21 +0100 Subject: [PATCH 134/221] add configoption for pm=ondemand --- manifests/fpm/pool.pp | 3 +++ templates/fpm/pool.conf.erb | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index e17faec8..e3437314 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -42,6 +42,8 @@ # # [*pm_max_requests*] # +# [*pm_process_idle_timeout*] +# # [*pm_status_path*] # # [*ping_path*] @@ -128,6 +130,7 @@ $pm_min_spare_servers = '5', $pm_max_spare_servers = '35', $pm_max_requests = '0', + $pm_process_idle_timeout = '10s', $pm_status_path = undef, $ping_path = undef, $ping_response = 'pong', diff --git a/templates/fpm/pool.conf.erb b/templates/fpm/pool.conf.erb index 9309f303..9f53b43f 100644 --- a/templates/fpm/pool.conf.erb +++ b/templates/fpm/pool.conf.erb @@ -63,6 +63,12 @@ group = <%= @group_final %> ; state (waiting to process). If the number ; of 'idle' processes is greater than this ; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. ; Note: This value is mandatory. pm = <%= @pm %> @@ -91,6 +97,11 @@ pm.min_spare_servers = <%= @pm_min_spare_servers %> ; Note: Mandatory when pm is set to 'dynamic' pm.max_spare_servers = <%= @pm_max_spare_servers %> +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +pm.process_idle_timeout = <%= @pm_process_idle_timeout %> + ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. From a43e81965d8b9b791e773e5d6f019b0779522e09 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 25 Dec 2016 01:31:17 +0100 Subject: [PATCH 135/221] modulesync 0.16.6 --- .msync.yml | 2 +- .travis.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.msync.yml b/.msync.yml index f0107335..0f438ad5 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.16.4' +modulesync_config_version: '0.16.6' diff --git a/.travis.yml b/.travis.yml index 6e80237a..6af62ed8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,7 @@ matrix: branches: only: - master + - /^v\d/ notifications: email: false deploy: From 98987213570ab2bfeb98c40f41fb0b44ed1b8acc Mon Sep 17 00:00:00 2001 From: juniorsysadmin Date: Sun, 25 Dec 2016 15:38:44 +1100 Subject: [PATCH 136/221] Bump min version_requirement for Puppet + deps We currently only run automated tests against Puppet 3 latest and therefore cannot guarantee that this module works as is expected with earlier Puppet versions Bump dependencies to the minimum version that should work under Puppet 4, based on the metadata Also remove deprecated pe version_requirement field --- metadata.json | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/metadata.json b/metadata.json index c02e3e5c..8b8bddd3 100644 --- a/metadata.json +++ b/metadata.json @@ -9,16 +9,15 @@ "issues_url": "https://github.com/mayflower/puppet-php/issues", "description": "Puppet module that aims to manage PHP and extensions in a generic way on many platforms with sane defaults and easy configuration", "dependencies": [ - { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.2.0 < 5.0.0" }, - { "name": "puppetlabs/apt", "version_requirement": ">= 1.8.0 < 3.0.0" }, - { "name": "puppetlabs/inifile", "version_requirement": "1.x" }, - { "name": "darin/zypprepo", "version_requirement": "1.x" }, - { "name": "puppet/archive", "version_requirement": "1.x" }, - { "name": "example42/yum", "version_requirement": "2.x" } + { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0 < 5.0.0" }, + { "name": "puppetlabs/apt", "version_requirement": ">= 2.1.0 < 3.0.0" }, + { "name": "puppetlabs/inifile", "version_requirement": ">=1.4.1 < 2.0.0" }, + { "name": "darin/zypprepo", "version_requirement": ">=1.0.2 < 2.0.0" }, + { "name": "puppet/archive", "version_requirement": ">= 1.0.0 < 2.0.0" }, + { "name": "example42/yum", "version_requirement": ">= 2.1.28 < 3.0.0" } ], "requirements": [ - { "name": "puppet", "version_requirement": ">= 3.3.0 < 5.0.0" }, - { "name": "pe", "version_requirement": ">= 3.3.0" } + { "name": "puppet", "version_requirement": ">= 3.8.7 < 5.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "Ubuntu", From 4514824e7208981e00eeb4e98766bbe0e82081f9 Mon Sep 17 00:00:00 2001 From: juniorsysadmin Date: Tue, 27 Dec 2016 20:46:52 +1100 Subject: [PATCH 137/221] Put Vox Pupuli information in metadata.json --- metadata.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/metadata.json b/metadata.json index 8b8bddd3..f6d2bd20 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { - "name": "mayflower-php", + "name": "puppet-php", "version": "4.0.0-beta1", - "author": "mayflower", + "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", - "source": "https://github.com/mayflower/puppet-php", - "project_page": "http://php.puppet.mayflower.de/", - "issues_url": "https://github.com/mayflower/puppet-php/issues", + "source": "https://github.com/voxpupuli/puppet-php", + "project_page": "https://github.com/voxpupuli/puppet-php", + "issues_url": "https://github.com/voxpupuli/puppet-php/issues", "description": "Puppet module that aims to manage PHP and extensions in a generic way on many platforms with sane defaults and easy configuration", "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0 < 5.0.0" }, From 945807a36d0eb730030fb6a9235f206040f2bfcd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 4 Jan 2017 18:55:10 +0100 Subject: [PATCH 138/221] modulesync 0.16.7 --- .msync.yml | 2 +- .rubocop.yml | 8 ++++++++ .travis.yml | 4 ++-- Gemfile | 4 ++-- spec/acceptance/nodesets/fedora-24-x64.yml | 15 +++++++++++++++ spec/acceptance/nodesets/fedora-25-x64.yml | 18 ++++++++++++++++++ spec/default_facts.yml | 9 +++++++++ 7 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 spec/acceptance/nodesets/fedora-24-x64.yml create mode 100644 spec/acceptance/nodesets/fedora-25-x64.yml diff --git a/.msync.yml b/.msync.yml index 0f438ad5..d505802e 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.16.6' +modulesync_config_version: '0.16.7' diff --git a/.rubocop.yml b/.rubocop.yml index f703c727..0e286670 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -510,3 +510,11 @@ RSpec/ExampleLength: RSpec/NamedSubject: Enabled: False + +# disabled for now since they cause a lot of issues +# these issues aren't easy to fix +RSpec/RepeatedDescription: + Enabled: False + +RSpec/NestedGroups: + Enabled: False diff --git a/.travis.yml b/.travis.yml index 6af62ed8..6214a554 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,10 +31,10 @@ matrix: env: PUPPET_VERSION="~> 4.0" CHECK=rubocop - rvm: 2.3.3 env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0-rc1 + - rvm: 2.4.0 env: PUPPET_VERSION="~> 4.0" CHECK=test allow_failures: - - rvm: 2.4.0-rc1 + - rvm: 2.4.0 branches: only: - master diff --git a/Gemfile b/Gemfile index da262185..0fa24c66 100644 --- a/Gemfile +++ b/Gemfile @@ -25,8 +25,8 @@ group :test do gem 'metadata-json-lint', :require => false gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' - gem 'puppet-strings', '~> 0.99.0', :require => false - gem 'rubocop-rspec', '~> 1.6', :require => false if RUBY_VERSION >= '2.3.0' + gem 'puppet-strings', '~> 1.0.0', :require => false + gem 'rubocop-rspec', '~> 1.9.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0' diff --git a/spec/acceptance/nodesets/fedora-24-x64.yml b/spec/acceptance/nodesets/fedora-24-x64.yml new file mode 100644 index 00000000..820b62d2 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-24-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + fedora-24-x64: + roles: + - master + platform: fedora-24-x86_64 + box: fedora/24-cloud-base + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml new file mode 100644 index 00000000..c3a3cbf5 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-25-x64.yml @@ -0,0 +1,18 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# platform is fedora 24 because there is no +# puppet-agent for fedora 25 by 2016-12-30 +HOSTS: + fedora-25-x64: + roles: + - master + platform: fedora-24-x86_64 + box: fedora/25-cloud-base + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/default_facts.yml b/spec/default_facts.yml index 4f365061..13c41657 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -1,3 +1,12 @@ +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# use default_module_facts.yaml for module specific +# facts. +# +# Hint if using with rspec-puppet-facts ("on_supported_os.each"): +# if a same named fact exists in facterdb it will be overridden. --- concat_basedir: "/tmp" ipaddress: "172.16.254.254" From d950ff7623d0e07fba8e7667810e890c9a2da032 Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Tue, 17 Jan 2017 20:20:15 -0800 Subject: [PATCH 139/221] modulesync 0.16.8 --- .msync.yml | 2 +- .rubocop.yml | 4 ++-- Gemfile | 4 +++- spec/spec_helper.rb | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.msync.yml b/.msync.yml index d505802e..1bc592bd 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.16.7' +modulesync_config_version: '0.16.8' diff --git a/.rubocop.yml b/.rubocop.yml index 0e286670..37416918 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -74,7 +74,7 @@ Style/WhileUntilModifier: Lint/AmbiguousRegexpLiteral: Enabled: True -Lint/Eval: +Security/Eval: Enabled: True Lint/BlockAlignment: @@ -302,7 +302,7 @@ Style/EmptyLiteral: Metrics/LineLength: Enabled: False -Style/MethodCallParentheses: +Style/MethodCallWithoutArgsParentheses: Enabled: True Style/MethodDefParentheses: diff --git a/Gemfile b/Gemfile index 0fa24c66..e8db724e 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,9 @@ group :test do gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' gem 'puppet-strings', '~> 1.0.0', :require => false - gem 'rubocop-rspec', '~> 1.9.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'redcarpet', :require => false + gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 32709c81..ec02c1a6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,8 +24,8 @@ puppetversion: Puppet.version, facterversion: Facter.version } - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) + default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) + default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) c.default_facts = default_facts end From 92cdbd9e9c2a35866231d948d36171b235d959ce Mon Sep 17 00:00:00 2001 From: Rob Nelson Date: Thu, 19 Jan 2017 12:47:25 +0000 Subject: [PATCH 140/221] Modulesync 0.16.10 --- .msync.yml | 2 +- .rubocop.yml | 4 ++++ spec/spec_helper.rb | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.msync.yml b/.msync.yml index 1bc592bd..e911d18c 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.16.8' +modulesync_config_version: '0.16.10' diff --git a/.rubocop.yml b/.rubocop.yml index 37416918..ef85ceb4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -518,3 +518,7 @@ RSpec/RepeatedDescription: RSpec/NestedGroups: Enabled: False + +# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs +Security/YAMLLoad: + Enabled: false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ec02c1a6..32709c81 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,8 +24,8 @@ puppetversion: Puppet.version, facterversion: Facter.version } - default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) c.default_facts = default_facts end From 5d8b2d79ecf64c5be0b68224aa21e966f6166e98 Mon Sep 17 00:00:00 2001 From: Rob Nelson Date: Thu, 19 Jan 2017 12:53:23 +0000 Subject: [PATCH 141/221] Silence RepeatedExample rubocop --- spec/classes/php_fpm_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index bd98113c..eb1621c1 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -8,6 +8,7 @@ end let(:pre_condition) { 'class {"php": fpm => false}' } describe 'when called with no parameters' do + # rubocop:disable RSpec/RepeatedExample case facts[:osfamily] when 'Debian' it { is_expected.to contain_package('php5-fpm').with_ensure('present') } @@ -24,6 +25,7 @@ it { is_expected.to contain_package('php-fpm').with_ensure('present') } it { is_expected.to contain_service('php-fpm').with_ensure('running') } end + # rubocop:enable RSpec/RepeatedExample it { is_expected.to contain_class('php::fpm::config').that_notifies('Class[php::fpm::service]') } it { is_expected.to contain_class('php::fpm::service') } end From 2d8a196194523b1c8dff9b0678e7bcfc067a1825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Thu, 19 Jan 2017 12:44:30 +0100 Subject: [PATCH 142/221] allow pipe param for pecl extensions --- manifests/extension.pp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/manifests/extension.pp b/manifests/extension.pp index 36462d06..d171384f 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -52,6 +52,10 @@ # String parameter, whether to specify ALL sapi or a specific sapi. # Defaults to ALL. # +# [*pipe*] +# String parameter to input answers during extension setup. Supported +# *provider*: pecl. +# define php::extension ( $ensure = 'installed', $provider = undef, @@ -66,6 +70,7 @@ $settings = {}, $settings_prefix = false, $sapi = 'ALL', + $pipe = undef, ) { if ! defined(Class['php']) { @@ -110,6 +115,7 @@ ensure => $ensure, provider => $provider, source => $real_source, + pipe => $pipe, require => [ Class['::php::pear'], Class['::php::dev'], @@ -122,6 +128,10 @@ } } else { + if $pipe != undef { + warning("pipe param is not supported by php::extension provider ${provider}") + } + ensure_packages( [ $real_package ], { ensure => $ensure, provider => $provider, From 47c995e98ca16299b43425dd54e8fc32205ea5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Thu, 19 Jan 2017 11:52:08 +0100 Subject: [PATCH 143/221] update deprecated apt::key parameters fixes #267 --- manifests/repo/debian.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/repo/debian.pp b/manifests/repo/debian.pp index f8992050..760f5a4c 100644 --- a/manifests/repo/debian.pp +++ b/manifests/repo/debian.pp @@ -39,7 +39,8 @@ include '::apt' create_resources(::apt::key, { 'php::repo::debian' => { - key => $key['id'], key_source => $key['source'], + id => $key['id'], + source => $key['source'], }}) ::apt::source { "source_php_${release}": From 2608158286085ae10e2ba1d8f6662c8d7bc3e37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Fri, 27 Jan 2017 16:44:10 +0100 Subject: [PATCH 144/221] fix pecl/pear package providers query method could return info about another package example: pry> @resource => Package[pecl-mongo] pry> self.class.pecllist(justme: peclname) => {:name=>"pecl-apcu", :ensure=>"4.0.7", :provider=>:peclcmd} this wrongly results in pecl-mongo not being installed although it is needed fixes #255 as well by returning the correct version for installed packages add pecl_spec and pear_spec too pecl is now a simple wrapper to pear, which can handle both kind of packages --- lib/puppet/provider/package/pear.rb | 127 ++++++++-------- lib/puppet/provider/package/pecl.rb | 107 ++------------ manifests/extension.pp | 34 ++--- spec/defines/extension_spec.rb | 2 +- .../unit/provider/package/pear/list_a | 22 +++ .../package/pear/remote-info_benchmark | 11 ++ .../provider/package/pear/remote-info_zip | 10 ++ spec/unit/provider/package/pear_spec.rb | 137 ++++++++++++++++++ spec/unit/provider/package/pecl_spec.rb | 77 ++++++++++ 9 files changed, 349 insertions(+), 178 deletions(-) create mode 100644 spec/fixtures/unit/provider/package/pear/list_a create mode 100644 spec/fixtures/unit/provider/package/pear/remote-info_benchmark create mode 100644 spec/fixtures/unit/provider/package/pear/remote-info_zip create mode 100644 spec/unit/provider/package/pear_spec.rb create mode 100644 spec/unit/provider/package/pecl_spec.rb diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package/pear.rb index dbbf8e9c..94d5b558 100644 --- a/lib/puppet/provider/package/pear.rb +++ b/lib/puppet/provider/package/pear.rb @@ -1,112 +1,105 @@ require 'puppet/provider/package' -# PHP PEAR support. Puppet::Type.type(:package).provide :pear, parent: Puppet::Provider::Package do - desc 'PHP PEAR support. By default uses the installed channels, but you can specify the path to a pear package via ``source``.' + desc 'Package management via `pear`.' has_feature :versionable has_feature :upgradeable has_feature :install_options - case Facter.value(:operatingsystem) - when 'Solaris' - commands pearcmd: '/opt/coolstack/php5/bin/pear' - else - commands pearcmd: 'pear' - end + commands pear: 'pear' - def self.pearlist(hash) - command = [command(:pearcmd), 'list', '-a'] - channel = 'pear' - - begin - list = execute(command).split("\n") - list = list.map do |set| - %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(set) { |m| channel = m[1].downcase } - - if hash[:justme] && set =~ %r{^#{hash[:justme]}} - pearhash = pearsplit(set, channel) - pearhash[:provider] = :pear - pearhash - elsif (pearhash = pearsplit(set, channel)) - pearhash[:provider] = :pear - pearhash - end - end.compact - - rescue Puppet::ExecutionFailure => detail - raise Puppet::Error, format('Could not list pears: %s', detail) - end + ENV['TERM'] = 'dumb' # remove colors + + def self.pearlist(only = nil) + channel = nil + + packages = pear('list', '-a').split("\n").map do |line| + # current channel + %r{INSTALLED PACKAGES, CHANNEL (.*):}i.match(line) { |m| channel = m[1].downcase } + + # parse one package + pearsplit(line, channel) + end.compact - return list.shift if hash[:justme] - list + return packages unless only + + packages.find do |pkg| + pkg[:name].casecmp(only[:name].downcase).zero? + end end def self.pearsplit(desc, channel) desc.strip! case desc - when %r{^$} then return nil - when %r{^INSTALLED}i then return nil - when %r{no packages installed}i then return nil - when %r{^=} then return nil - when %r{^PACKAGE}i then return nil + when '' then nil + when %r{^installed}i then nil + when %r{no packages installed}i then nil + when %r{^=} then nil + when %r{^package}i then nil when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} then name = Regexp.last_match(1) version = Regexp.last_match(2) state = Regexp.last_match(3) - return { - name: "#{channel}/#{name}", - ensure: state == 'stable' ? version : state + + { + name: name, + vendor: channel, + ensure: state == 'stable' ? version : state, + provider: self.name } else - Puppet.debug format("Could not match '%s'", desc) + Puppet.warning format('Could not match %s', desc) nil end end def self.instances - pearlist(local: true).map do |hash| + pearlist.map do |hash| new(hash) end end def install(useversion = true) command = ['-D', 'auto_discover=1', 'upgrade'] - command << if @resource[:install_options] - @resource[:install_options] - else - '--alldeps' - end - - command << if @resource[:source] - @resource[:source] - elsif (!@resource.should(:ensure).is_a? Symbol) && useversion - "#{@resource[:name]}-#{@resource.should(:ensure)}" - else - @resource[:name] - end - - pearcmd(*command) - end - def latest - # This always gets the latest version available. - version = '' - command = [command(:pearcmd), 'remote-info', @resource[:name]] - execute(command).each_line do |set| - version = set.split[1] if set =~ %r{^Latest} + if @resource[:install_options] + command += join_options(@resource[:install_options]) + else + command << '--alldeps' end - version + pear_pkg = @resource[:source] || @resource[:name] + if !@resource[:ensure].is_a?(Symbol) && useversion + command << '-f' + pear_pkg << "-#{@resource[:ensure]}" + end + command << pear_pkg + + if @resource[:responsefile] + Puppet::Util::Execution.execute( + [command(:pear)] + command, + stdinfile: @resource[:responsefile] + ) + else + pear(*command) + end + end + + def latest + target = @resource[:source] || @resource[:name] + pear('remote-info', target).lines.find do |set| + set =~ %r{^Latest} + end.split[1] end def query - self.class.pearlist(justme: @resource[:name]) + self.class.pearlist(@resource) end def uninstall - output = pearcmd 'uninstall', @resource[:name] + output = pear 'uninstall', @resource[:name] raise Puppet::Error, output unless output =~ %r{^uninstall ok} end diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index f459ef61..562656ed 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -1,113 +1,36 @@ require 'puppet/provider/package' -Puppet::Type.type(:package).newparam(:pipe) -Puppet::Type.type(:package).provide :pecl, parent: Puppet::Provider::Package do - desc 'PHP pecl support. By default uses the installed channels, but you can specify the path to a pecl package via ``source``.' +Puppet::Type.type(:package).provide :pecl, parent: :pear do + desc 'Package management via `pecl`.' has_feature :versionable has_feature :upgradeable - - case Facter.value(:operatingsystem) - when 'Solaris' - commands peclcmd: '/opt/coolstack/php5/bin/pecl' - else - commands peclcmd: 'pecl' - end - - def self.pecllist(hash) - command = [command(:peclcmd), 'list'] - - begin - list = execute(command).split("\n").map do |set| - if hash[:justme] && %r{^#{hash[:justme]}$}i =~ set && (peclhash = peclsplit(set)) - peclhash[:provider] = :peclcmd - peclhash - elsif (peclhash = peclsplit(set)) - peclhash[:provider] = :peclcmd - peclhash - end - end.compact - rescue Puppet::ExecutionFailure => detail - raise Puppet::Error, format('Could not list pecls: %s', detail) - end - - return list.shift if hash[:justme] - list - end - - def self.peclsplit(desc) - desc.strip! - - case desc - when %r{^INSTALLED} then return nil - when %r{No packages installed from channel}i then return nil - when %r{^=} then return nil - when %r{^PACKAGE} then return nil - when %r{\[1m} then return nil # Newer versions of PEAR use colorized output - when %r{^(\S+)\s+(\S+)\s+\S+} then - name = Regexp.last_match(1) - version = Regexp.last_match(2) - - return { - name: "pecl-#{name.downcase}", - ensure: version - } - else - Puppet.warning format('Could not match %s', desc) - nil - end - end + has_feature :install_options def self.instances - pecllist(local: true).map do |hash| - new(hash) + pear_packages = super + + pear_packages.select do |pkg| + pkg.properties[:vendor] == 'pecl.php.net' end end - def peclname - name.sub('pecl-', '').downcase + def convert_to_pear + @resource[:source] = "pecl.php.net/#{@resource[:name]}" end def install(useversion = true) - command = ['upgrade'] - - if @resource[:source] - command << @resource[:source] - elsif (!@resource.should(:ensure).is_a? Symbol) && useversion - command << '-f' - command << "#{peclname}-#{@resource.should(:ensure)}" - else - command << peclname - end - - if @resource[:pipe] - command << '<<<' - command << @resource[:pipe] - end - - peclcmd(*command) + convert_to_pear + super(useversion) end def latest - version = '' - command = [command(:peclcmd), 'remote-info', peclname] - execute(command).each_line do |set| - version = set.split[1] if set =~ %r{^Latest} - end - - version - end - - def query - self.class.pecllist(justme: peclname) + convert_to_pear + super end def uninstall - output = peclcmd 'uninstall', peclname - raise Puppet::Error, output unless output =~ %r{^uninstall ok} - end - - def update - install(false) + convert_to_pear + super end end diff --git a/manifests/extension.pp b/manifests/extension.pp index d171384f..b3e6624d 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -52,9 +52,9 @@ # String parameter, whether to specify ALL sapi or a specific sapi. # Defaults to ALL. # -# [*pipe*] -# String parameter to input answers during extension setup. Supported -# *provider*: pecl. +# [*responsefile*] +# File containing answers for interactive extension setup. Supported +# *providers*: pear, pecl. # define php::extension ( $ensure = 'installed', @@ -70,7 +70,7 @@ $settings = {}, $settings_prefix = false, $sapi = 'ALL', - $pipe = undef, + $responsefile = undef, ) { if ! defined(Class['php']) { @@ -97,12 +97,10 @@ } if $provider != 'none' { - - if $provider == 'pecl' { - $real_package = "pecl-${title}" - } - else { - $real_package = "${package_prefix}${title}" + case $provider { + 'pecl': { $real_package = $title } + 'pear': { $real_package = $title } + default: { $real_package = "${package_prefix}${title}" } } unless empty($header_packages) { @@ -110,13 +108,13 @@ Package[$header_packages] -> Package[$real_package] } - if $provider == 'pecl' { + if $provider == 'pecl' or $provider == 'pear' { ensure_packages( [ $real_package ], { - ensure => $ensure, - provider => $provider, - source => $real_source, - pipe => $pipe, - require => [ + ensure => $ensure, + provider => $provider, + source => $real_source, + responsefile => $responsefile, + require => [ Class['::php::pear'], Class['::php::dev'], ], @@ -128,8 +126,8 @@ } } else { - if $pipe != undef { - warning("pipe param is not supported by php::extension provider ${provider}") + if $responsefile != undef { + warning("responsefile param is not supported by php::extension provider ${provider}") } ensure_packages( [ $real_package ], { diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index cc5ae19a..442f4db3 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -170,7 +170,7 @@ } end - it { is_expected.to contain_package('pecl-json') } + it { is_expected.to contain_package('json') } it { is_expected.to contain_package('libmemcached-dev') } it { is_expected.to contain_package('build-essential') } it do diff --git a/spec/fixtures/unit/provider/package/pear/list_a b/spec/fixtures/unit/provider/package/pear/list_a new file mode 100644 index 00000000..6b707b6d --- /dev/null +++ b/spec/fixtures/unit/provider/package/pear/list_a @@ -0,0 +1,22 @@ +INSTALLED PACKAGES, CHANNEL __URI: +================================== +(no packages installed) + +INSTALLED PACKAGES, CHANNEL DOC.PHP.NET: +======================================== +(no packages installed) + +INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET: +========================================= +PACKAGE VERSION STATE +Archive_Tar 1.4.0 stable +Console_Getopt 1.4.1 stable +PEAR 1.10.1 stable +Structures_Graph 1.1.1 stable +XML_Util 1.3.0 stable + +INSTALLED PACKAGES, CHANNEL PECL.PHP.NET: +========================================= +PACKAGE VERSION STATE +zip 1.13.5 stable + diff --git a/spec/fixtures/unit/provider/package/pear/remote-info_benchmark b/spec/fixtures/unit/provider/package/pear/remote-info_benchmark new file mode 100644 index 00000000..0c1c32ad --- /dev/null +++ b/spec/fixtures/unit/provider/package/pear/remote-info_benchmark @@ -0,0 +1,11 @@ +PACKAGE DETAILS: +================ +Latest 1.2.9 +Installed - no - +Package Benchmark +License New BSD +Category Benchmarking +Summary Framework to benchmark PHP scripts or function + calls. +Description Framework to benchmark PHP scripts or function + calls. diff --git a/spec/fixtures/unit/provider/package/pear/remote-info_zip b/spec/fixtures/unit/provider/package/pear/remote-info_zip new file mode 100644 index 00000000..8fc731ae --- /dev/null +++ b/spec/fixtures/unit/provider/package/pear/remote-info_zip @@ -0,0 +1,10 @@ +PACKAGE DETAILS: +================ +Latest 1.13.5 +Installed 1.13.5 +Package zip +License PHP 3.01 +Category File Formats +Summary A zip management extension +Description Zip is an extension to create, modify and read + zip files. diff --git a/spec/unit/provider/package/pear_spec.rb b/spec/unit/provider/package/pear_spec.rb new file mode 100644 index 00000000..d5b2a6c9 --- /dev/null +++ b/spec/unit/provider/package/pear_spec.rb @@ -0,0 +1,137 @@ +require 'spec_helper' + +describe Puppet::Type.type(:package).provider(:pear) do + let(:resource) do + Puppet::Type.type(:package).new name: 'dummy', ensure: :installed + end + + let(:provider) do + described_class.new(resource) + end + + before do + described_class.stubs(:command).with(:pear).returns '/fake/pear' + end + + describe '.instances' do + it 'returns an array of installed packages' do + described_class.expects(:pear). + with('list', '-a'). + returns File.read(my_fixture('list_a')) + + expect(described_class.instances.map(&:properties)).to eq [ + { name: 'Archive_Tar', vendor: 'pear.php.net', ensure: '1.4.0', provider: :pear }, + { name: 'Console_Getopt', vendor: 'pear.php.net', ensure: '1.4.1', provider: :pear }, + { name: 'PEAR', vendor: 'pear.php.net', ensure: '1.10.1', provider: :pear }, + { name: 'Structures_Graph', vendor: 'pear.php.net', ensure: '1.1.1', provider: :pear }, + { name: 'XML_Util', vendor: 'pear.php.net', ensure: '1.3.0', provider: :pear }, + { name: 'zip', vendor: 'pecl.php.net', ensure: '1.13.5', provider: :pear } + ] + end + + it 'ignores malformed lines' do + described_class.expects(:pear). + with('list', '-a'). + returns 'aaa2.1' + Puppet.expects(:warning).with('Could not match aaa2.1') + expect(described_class.instances).to eq [] + end + end + + describe '#install' do + it 'installs a package' do + described_class.expects(:pear). + with('-D', 'auto_discover=1', 'upgrade', '--alldeps', 'dummy') + provider.install + end + + it 'installs a specific version' do + resource[:ensure] = '0.2' + described_class.expects(:pear). + with('-D', 'auto_discover=1', 'upgrade', '--alldeps', '-f', 'dummy-0.2') + provider.install + end + + it 'installs from a specific source' do + resource[:source] = 'pear.php.net/dummy' + described_class.expects(:pear). + with('-D', 'auto_discover=1', 'upgrade', '--alldeps', 'pear.php.net/dummy') + provider.install + end + + it 'installs a specific version from a specific source' do + resource[:ensure] = '0.2' + resource[:source] = 'pear.php.net/dummy' + described_class.expects(:pear). + with('-D', 'auto_discover=1', 'upgrade', '--alldeps', '-f', 'pear.php.net/dummy-0.2') + provider.install + end + + it 'uses the specified responsefile' do + resource[:responsefile] = '/fake/pearresponse' + Puppet::Util::Execution.expects(:execute). + with( + ['/fake/pear', '-D', 'auto_discover=1', 'upgrade', '--alldeps', 'dummy'], + stdinfile: resource[:responsefile] + ) + provider.install + end + + it 'accepts install_options' do + resource[:install_options] = ['--onlyreqdeps'] + described_class.expects(:pear). + with('-D', 'auto_discover=1', 'upgrade', '--onlyreqdeps', 'dummy') + provider.install + end + end + + describe '#query' do + it 'queries information about one package' do + described_class.expects(:pear). + with('list', '-a'). + returns File.read(my_fixture('list_a')) + + resource[:name] = 'pear' + expect(provider.query).to eq( + name: 'PEAR', vendor: 'pear.php.net', ensure: '1.10.1', provider: :pear + ) + end + end + + describe '#latest' do + it 'fetches the latest version available' do + described_class.expects(:pear). + with('remote-info', 'Benchmark'). + returns File.read(my_fixture('remote-info_benchmark')) + + resource[:name] = 'Benchmark' + expect(provider.latest).to eq '1.2.9' + end + end + + describe '#uninstall' do + it 'uninstalls a package' do + described_class.expects(:pear). + with('uninstall', resource[:name]). + returns('uninstall ok') + provider.uninstall + end + + it 'raises an error otherwise' do + described_class.expects(:pear). + with('uninstall', resource[:name]). + returns('unexpected output') + expect { provider.uninstall }.to raise_error(Puppet::Error) + end + end + + describe '#update' do + it 'ignores the resource version' do + resource[:ensure] = '2.0' + + described_class.expects(:pear). + with('-D', 'auto_discover=1', 'upgrade', '--alldeps', 'dummy') + provider.update + end + end +end diff --git a/spec/unit/provider/package/pecl_spec.rb b/spec/unit/provider/package/pecl_spec.rb new file mode 100644 index 00000000..ae2f15d1 --- /dev/null +++ b/spec/unit/provider/package/pecl_spec.rb @@ -0,0 +1,77 @@ +require 'spec_helper' + +describe Puppet::Type.type(:package).provider(:pecl) do + let(:resource) do + Puppet::Type.type(:package).new name: 'dummy', ensure: :installed + end + + let(:provider) do + described_class.new(resource) + end + + let(:parent_class) do + Puppet::Type::Package::ProviderPear + end + + before do + parent_class.stubs(:command).with(:pear).returns '/fake/pear' + end + + describe '.instances' do + it 'returns pecl installed packages via pear' do + parent_class.expects(:pear). + with('list', '-a'). + returns File.read(fixtures('unit/provider/package/pear/list_a')) + + expect(described_class.instances.map(&:properties)).to eq [ + { ensure: '1.13.5', name: 'zip', vendor: 'pecl.php.net', provider: :pecl } + ] + end + end + + describe '#install' do + it 'installs with pear' do + parent_class.expects(:pear) + provider.install + end + end + + describe '#query' do + it 'queries pecl package info via pear' do + parent_class.expects(:pear). + with('list', '-a'). + returns File.read(fixtures('unit/provider/package/pear/list_a')) + + resource[:name] = 'zip' + expect(provider.query).to eq(ensure: '1.13.5', name: 'zip', vendor: 'pecl.php.net', provider: :pecl) + end + end + + describe '#latest' do + it 'fetches the latest version available via pear' do + parent_class.expects(:pear). + with('remote-info', 'pecl.php.net/zip'). + returns File.read(fixtures('unit/provider/package/pear/remote-info_zip')) + + resource[:name] = 'zip' + expect(provider.latest).to eq '1.13.5' + end + end + + describe '#uninstall' do + it 'uninstalls a package via pear' do + parent_class.expects(:pear). + returns('uninstall ok') + provider.uninstall + end + end + + describe '#update' do + it 'updates to latest version via pear' do + resource[:ensure] = '2.0' + + parent_class.expects(:pear) + provider.update + end + end +end From 11eb58195325d1b9ddfbb36b4115ced8027204a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Sat, 11 Feb 2017 21:07:41 +0100 Subject: [PATCH 145/221] composer auto_update: exec's environment must be array we were passing a Hash, a Hash missing HOME, at that (#303) This fixes both issues. --- manifests/composer/auto_update.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index be8b6348..78c0c626 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -38,9 +38,9 @@ } if $proxy_type and $proxy_server { - $env = {"${proxy_type}_proxy" => $proxy_server} + $env = [ 'HOME=/root', "${proxy_type}_proxy=${proxy_server}" ] } else { - $env = undef + $env = [ 'HOME=/root' ] } exec { 'update composer': From 3e349994bbdfc0bfb7dbff4220c1a1beb156cee1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 18:43:47 +0100 Subject: [PATCH 146/221] modulesync 0.16.11 --- .msync.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index e911d18c..f0e17e16 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.16.10' +modulesync_config_version: '0.16.11' diff --git a/.travis.yml b/.travis.yml index 6214a554..7ab6632a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ before_install: - bundle -v - rm Gemfile.lock || true - gem update --system - - gem update bundler + - gem install bundler -v '~>1.13.0' - gem --version - bundle -v script: From 2cc47e356cae1ace91fd8401e52c65e402e68a2a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 21:01:49 +0100 Subject: [PATCH 147/221] release 4.0.0 --- CHANGELOG.md | 37 ++++++++++++++++++++++++++----------- metadata.json | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a5d9f5a..d00266e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,31 @@ # Changelog -## 4.0.0 - * Fix a bug turning `manage_repos` off on wheezy - * Fix a deprecation warning on `apt::key` when using `manage_repos` on wheezy (#110) - This change requires puppetlabs/apt at >= 1.8.0 - * Allow removal of config values (#124) - * Add `phpversion` fact, for querying through PuppetDB or Foreman (#119) - * Allow configuring the fpm pid file (#123) - * Add embedded SAPI support (#115) - * Add options to fpm config and pool configs (#139) - * Add parameter logic for PHP 7 on Ubuntu/Debian (#180) - * add SLES PHP 7.0 Support (#220) +## 2017-02-11 Release 4.0.0 + +This is the last release with Puppet3 support! +* Fix a bug turning `manage_repos` off on wheezy +* Fix a deprecation warning on `apt::key` when using `manage_repos` on wheezy (#110). This change requires puppetlabs/apt at >= 1.8.0 +* Allow removal of config values (#124) +* Add `phpversion` fact, for querying through PuppetDB or Foreman (#119) +* Allow configuring the fpm pid file (#123) +* Add embedded SAPI support (#115) +* Add options to fpm config and pool configs (#139) +* Add parameter logic for PHP 7 on Ubuntu/Debian (#180) +* add SLES PHP 7.0 Support (#220) +* allow packaged extensions to be loaded as zend extensions +* Fix command to enable php extensions (#226) +* Fix many rucocop warnings +* Update module Ubuntu 14.04 default to official repository setup +* Fix dependency for extentions with no package source +* Allow packaged extensions to be loaded as Zend extensions +* Support using an http proxy for downloading composer +* Refactor classes php::fpm and php::fpm:service +* Manage apache/PHP configurations on Debian and RHEL systems +* use voxpupuli/archive to download composer +* respect $manage_repos, do not include ::apt if set to false +* Bump min version_requirement for Puppet + deps +* allow pipe param for pecl extensions +* Fix: composer auto_update: exec's environment must be array ### Breaking Changes * Deep merge `php::extensions` the same way as `php::settings`. This technically is a diff --git a/metadata.json b/metadata.json index f6d2bd20..bd362245 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "4.0.0-beta1", + "version": "4.0.0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", @@ -9,15 +9,36 @@ "issues_url": "https://github.com/voxpupuli/puppet-php/issues", "description": "Puppet module that aims to manage PHP and extensions in a generic way on many platforms with sane defaults and easy configuration", "dependencies": [ - { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0 < 5.0.0" }, - { "name": "puppetlabs/apt", "version_requirement": ">= 2.1.0 < 3.0.0" }, - { "name": "puppetlabs/inifile", "version_requirement": ">=1.4.1 < 2.0.0" }, - { "name": "darin/zypprepo", "version_requirement": ">=1.0.2 < 2.0.0" }, - { "name": "puppet/archive", "version_requirement": ">= 1.0.0 < 2.0.0" }, - { "name": "example42/yum", "version_requirement": ">= 2.1.28 < 3.0.0" } + { + "name": "puppetlabs/stdlib", + "version_requirement": ">= 4.6.0 < 5.0.0" + }, + { + "name": "puppetlabs/apt", + "version_requirement": ">= 2.1.0 < 3.0.0" + }, + { + "name": "puppetlabs/inifile", + "version_requirement": ">=1.4.1 < 2.0.0" + }, + { + "name": "darin/zypprepo", + "version_requirement": ">=1.0.2 < 2.0.0" + }, + { + "name": "puppet/archive", + "version_requirement": ">= 1.0.0 < 2.0.0" + }, + { + "name": "example42/yum", + "version_requirement": ">= 2.1.28 < 3.0.0" + } ], "requirements": [ - { "name": "puppet", "version_requirement": ">= 3.8.7 < 5.0.0" } + { + "name": "puppet", + "version_requirement": ">= 3.8.7 < 5.0.0" + } ], "operatingsystem_support": [ { "operatingsystem": "Ubuntu", From f2bb54b3ff7c06227675e51452a9e90d1ea999b8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 21:58:40 +0100 Subject: [PATCH 148/221] [blacksmith] Bump version to 4.0.1-rc0 --- metadata.json | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/metadata.json b/metadata.json index bd362245..bd85f2cc 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "4.0.0", + "version": "4.0.1-rc0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", @@ -41,41 +41,49 @@ } ], "operatingsystem_support": [ - { "operatingsystem": "Ubuntu", + { + "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "14.04" ] }, - { "operatingsystem": "Debian", + { + "operatingsystem": "Debian", "operatingsystemrelease": [ "7", "8" ] }, - { "operatingsystem": "RedHat", + { + "operatingsystem": "RedHat", "operatingsystemrelease": [ "6", "7" ] }, - { "operatingsystem": "CentOS", + { + "operatingsystem": "CentOS", "operatingsystemrelease": [ "6", "7" ] }, - { "operatingsystem": "FreeBSD", + { + "operatingsystem": "FreeBSD", "operatingsystemrelease": [ "9", "10", "11" ] }, - { "operatingsystem": "SLES", + { + "operatingsystem": "SLES", "operatingsystemrelease": [ "11" ] }, - { "operatingsystem": "OpenSUSE" } + { + "operatingsystem": "OpenSUSE" + } ] } From 99f33b66f66f0f9f3cb9ee56f2d639bbad941755 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 22:05:06 +0100 Subject: [PATCH 149/221] rerelease 4.0.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index bd85f2cc..6c8cf66d 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "4.0.1-rc0", + "version": "4.0.0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From 912a644c59d4513707cc943d8aa7781eeb4fa55d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 22:03:15 +0100 Subject: [PATCH 150/221] add secrets to .{travis,secrets}.yml --- .sync.yml | 3 +++ .travis.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .sync.yml diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 00000000..dbe8e9f2 --- /dev/null +++ b/.sync.yml @@ -0,0 +1,3 @@ +--- +.travis.yml: + secure: "GOhttACuJt+3s38m4WnW5RuTgwqaAoeEQnNT+X1Ukn7KdcIk4KV8NzYU/CC0VIm8lUOnBWYJKEC4ixX/J/4Wbxox2RAoKMQrO++L0DB1zTCJnq9SfoUBMaQhXvLu+PbxAR0p3P47ozra0C+pOWDpOaxT9ecufrPQt9W9Z4aY/bs=" diff --git a/.travis.yml b/.travis.yml index 7ab6632a..1c72ebec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "GOhttACuJt+3s38m4WnW5RuTgwqaAoeEQnNT+X1Ukn7KdcIk4KV8NzYU/CC0VIm8lUOnBWYJKEC4ixX/J/4Wbxox2RAoKMQrO++L0DB1zTCJnq9SfoUBMaQhXvLu+PbxAR0p3P47ozra0C+pOWDpOaxT9ecufrPQt9W9Z4aY/bs=" on: tags: true # all_branches is required to use tags From 176c15823c170a4ee06431897a95600a8ce255b6 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 22:05:18 +0100 Subject: [PATCH 151/221] [blacksmith] Bump version to 4.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 6c8cf66d..bd85f2cc 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "4.0.0", + "version": "4.0.1-rc0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From ae4d489d12539b61f7501e2cdc67eefa0cf7cb37 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 22:06:11 +0100 Subject: [PATCH 152/221] rerelease 4.0.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index bd85f2cc..6c8cf66d 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "4.0.1-rc0", + "version": "4.0.0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From 255ea90583e1c007d3840ec37a3440029b380915 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 22:06:14 +0100 Subject: [PATCH 153/221] [blacksmith] Bump version to 4.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 6c8cf66d..bd85f2cc 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "4.0.0", + "version": "4.0.1-rc0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From 8c31d9c424ab3f86cb7122f5da395ed5273c7542 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 22:00:58 +0100 Subject: [PATCH 154/221] modulesync 0.20.0 --- .gitignore | 4 +++ .msync.yml | 2 +- .pmtignore | 20 +++++++++++ .travis.yml | 19 ++++------- .yardopts | 1 + Gemfile | 11 +++--- Rakefile | 11 ++++++ metadata.json | 2 +- spec/acceptance/nodesets/centos-6-x64.yml | 15 ++++++++ spec/acceptance/nodesets/centos-7-x64.yml | 15 ++++++++ spec/acceptance/nodesets/docker/centos-7.yml | 2 +- .../nodesets/ec2/amazonlinux-2016091.yml | 31 +++++++++++++++++ .../nodesets/ec2/image_templates.yaml | 34 +++++++++++++++++++ spec/acceptance/nodesets/ec2/rhel-73-x64.yml | 29 ++++++++++++++++ .../nodesets/ec2/sles-12sp2-x64.yml | 29 ++++++++++++++++ .../nodesets/ec2/ubuntu-1604-x64.yml | 29 ++++++++++++++++ .../nodesets/ec2/windows-2016-base-x64.yml | 29 ++++++++++++++++ spec/acceptance/nodesets/fedora-25-x64.yml | 2 +- spec/spec_helper.rb | 2 +- 19 files changed, 265 insertions(+), 22 deletions(-) create mode 100644 .pmtignore create mode 100644 spec/acceptance/nodesets/centos-6-x64.yml create mode 100644 spec/acceptance/nodesets/centos-7-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml create mode 100644 spec/acceptance/nodesets/ec2/image_templates.yaml create mode 100644 spec/acceptance/nodesets/ec2/rhel-73-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml diff --git a/.gitignore b/.gitignore index 82426da6..0d629b0c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,13 @@ spec/fixtures/manifests/ spec/fixtures/modules/ .vagrant/ .bundle/ +.ruby-version coverage/ log/ .idea/ +.dependencies/ +.librarian/ +Puppetfile.lock *.iml .*.sw? .yardoc/ diff --git a/.msync.yml b/.msync.yml index f0e17e16..d03e5700 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.16.11' +modulesync_config_version: '0.20.0' diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 00000000..fb589575 --- /dev/null +++ b/.pmtignore @@ -0,0 +1,20 @@ +docs/ +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock +*.iml +.*.sw? +.yardoc/ diff --git a/.travis.yml b/.travis.yml index 7ab6632a..fc928217 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ --- sudo: false +dist: trusty language: ruby cache: bundler bundler_args: --without system_tests development @@ -7,7 +8,7 @@ before_install: - bundle -v - rm Gemfile.lock || true - gem update --system - - gem install bundler -v '~>1.13.0' + - gem update bundler - gem --version - bundle -v script: @@ -15,26 +16,18 @@ script: matrix: fast_finish: true include: - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test - - rvm: 2.1.9 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - rvm: 2.1.9 env: PUPPET_VERSION="~> 4.0" CHECK=test - rvm: 2.2.6 env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.3 - env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.3.3 - env: PUPPET_VERSION="~> 4.0" CHECK=rubocop - rvm: 2.3.3 env: PUPPET_VERSION="~> 4.0" CHECK=test - rvm: 2.4.0 env: PUPPET_VERSION="~> 4.0" CHECK=test - allow_failures: - - rvm: 2.4.0 + - rvm: 2.4.0 + env: PUPPET_VERSION="~> 4.0" CHECK=rubocop + - rvm: 2.4.0 + env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: - master diff --git a/.yardopts b/.yardopts index 29c933bc..3687f518 100644 --- a/.yardopts +++ b/.yardopts @@ -1 +1,2 @@ --markup markdown +--output-dir docs/ diff --git a/Gemfile b/Gemfile index e8db724e..2270de7d 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,8 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false + gem 'puppetlabs_spec_helper', '~> 2.0.1', :require => false + gem 'parallel_tests', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -29,10 +30,12 @@ group :test do gem 'redcarpet', :require => false gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0' - gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' gem 'mocha', '>= 1.2.1', :require => false - gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0' - gem 'simplecov-console', :require => false if RUBY_VERSION >= '2.0.0' + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2' + gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' + gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' end group :development do diff --git a/Rakefile b/Rakefile index d00f2470..2def02fa 100644 --- a/Rakefile +++ b/Rakefile @@ -30,4 +30,15 @@ task test: [ :metadata_lint, :release_checks, ] + +begin + require 'github_changelog_generator/task' + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + version = (Blacksmith::Modulefile.new).version + config.future_release = "#{version}" + config.header = "# Change log\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not impact the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix modulesync} + end +rescue LoadError +end # vim: syntax=ruby diff --git a/metadata.json b/metadata.json index bd85f2cc..ae7a063b 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "4.0.1-rc0", + "version": "5.0.0-rc0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml new file mode 100644 index 00000000..16abc8f1 --- /dev/null +++ b/spec/acceptance/nodesets/centos-6-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-6-x64: + roles: + - master + platform: el-6-x86_64 + box: centos/6 + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml new file mode 100644 index 00000000..e05a3ae1 --- /dev/null +++ b/spec/acceptance/nodesets/centos-7-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-7-x64: + roles: + - master + platform: el-7-x86_64 + box: centos/7 + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml index 886b1eeb..85e9d63c 100644 --- a/spec/acceptance/nodesets/docker/centos-7.yml +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -10,7 +10,7 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/usr/sbin/init"]' docker_image_commands: - - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss' CONFIG: trace_limit: 200 masterless: true diff --git a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml new file mode 100644 index 00000000..3f064f0a --- /dev/null +++ b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml @@ -0,0 +1,31 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +# Amazon Linux is not a RHEL clone. +# +HOSTS: + amazonlinux-2016091-x64: + roles: + - master + platform: centos-6-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: amazonlinux-2016091-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/image_templates.yaml b/spec/acceptance/nodesets/ec2/image_templates.yaml new file mode 100644 index 00000000..9a277d81 --- /dev/null +++ b/spec/acceptance/nodesets/ec2/image_templates.yaml @@ -0,0 +1,34 @@ +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +# Hint: image IDs (ami-*) for the same image are different per location. +# +AMI: + # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type + amazonlinux-2016091-eu-central-1: + :image: + :aio: ami-af0fc0c0 + :region: eu-central-1 + # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type + rhel-73-eu-central-1: + :image: + :aio: ami-e4c63e8b + :region: eu-central-1 + # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type + sles-12sp2-eu-central-1: + :image: + :aio: ami-c425e4ab + :region: eu-central-1 + # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type + ubuntu-1604-eu-central-1: + :image: + :aio: ami-fe408091 + :region: eu-central-1 + # Microsoft Windows Server 2016 Base + windows-2016-base-eu-central-1: + :image: + :aio: ami-88ec20e7 + :region: eu-central-1 diff --git a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml new file mode 100644 index 00000000..cd0521e7 --- /dev/null +++ b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + rhel-73-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: rhel-73-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml new file mode 100644 index 00000000..a14bea6c --- /dev/null +++ b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + sles-12sp2-x64: + roles: + - master + platform: sles-12-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: sles-12sp2-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml new file mode 100644 index 00000000..21ce560a --- /dev/null +++ b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + ubuntu-1604-x64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: ubuntu-1604-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ubuntu +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml new file mode 100644 index 00000000..36bd9891 --- /dev/null +++ b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + windows-2016-base-x64: + roles: + - master + platform: windows-2016-64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: windows-2016-base-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml index c3a3cbf5..60ae0117 100644 --- a/spec/acceptance/nodesets/fedora-25-x64.yml +++ b/spec/acceptance/nodesets/fedora-25-x64.yml @@ -9,7 +9,7 @@ HOSTS: fedora-25-x64: roles: - master - platform: fedora-24-x86_64 + platform: fedora-25-x86_64 box: fedora/25-cloud-base hypervisor: vagrant CONFIG: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 32709c81..2aa9da74 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ require 'rspec-puppet-facts' include RspecPuppetFacts -if Dir.exist?(File.expand_path('../../lib', __FILE__)) && RUBY_VERSION !~ %r{^1.9} +if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' require 'simplecov' require 'simplecov-console' From 760da7acec663aec7a08a865bc794eb0ab58c38a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Feb 2017 22:12:18 +0100 Subject: [PATCH 155/221] delete unneeded spec.opts --- spec/spec.opts | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 spec/spec.opts diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 91cd6427..00000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace From 985895f178fe8996155f068c145d44e3b342144e Mon Sep 17 00:00:00 2001 From: Thai Pham Date: Tue, 14 Feb 2017 07:48:24 +1100 Subject: [PATCH 156/221] Remove support for PHP 5.5 in Ubuntu --- manifests/repo/ubuntu.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index faa2faed..f073fad8 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -16,11 +16,14 @@ $version_real = $version } + if ($version_real == '5.5') { + fail('PHP 5.5 is no longer available for download') + } + validate_re($version_real, '^\d\.\d') $version_repo = $version_real ? { '5.4' => 'ondrej/php5-oldstable', - '5.5' => 'ondrej/php', '5.6' => 'ondrej/php', '7.0' => 'ondrej/php' } From a89c005fbccb06be3bf9de40f27d1dabe3772aae Mon Sep 17 00:00:00 2001 From: Matthias Crauwels Date: Fri, 17 Feb 2017 13:46:38 +0100 Subject: [PATCH 157/221] no further config required for PEAR extensions --- manifests/extension.pp | 112 +++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index b3e6624d..11402827 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -142,74 +142,76 @@ $package_depends = undef } - if $zend == true { - $extension_key = 'zend_extension' - if $php_api_version != undef { - $module_path = "/usr/lib/php5/${php_api_version}/" + if $provider != 'pear' { # PEAR packages don't require antu further configuration, they just need to "be there". + if $zend == true { + $extension_key = 'zend_extension' + if $php_api_version != undef { + $module_path = "/usr/lib/php5/${php_api_version}/" + } + else { + $module_path = undef + } } else { + $extension_key = 'extension' $module_path = undef } - } - else { - $extension_key = 'extension' - $module_path = undef - } - if $so_name != $name { - $lowercase_title = $so_name - } - else { - $lowercase_title = downcase($title) - } + if $so_name != $name { + $lowercase_title = $so_name + } + else { + $lowercase_title = downcase($title) + } - # Ensure "." prefix is present in setting keys if requested - if $settings_prefix { - if is_string($settings_prefix) { - $full_settings_prefix = $settings_prefix + # Ensure "." prefix is present in setting keys if requested + if $settings_prefix { + if is_string($settings_prefix) { + $full_settings_prefix = $settings_prefix + } else { + $full_settings_prefix = $lowercase_title + } + $full_settings = ensure_prefix($settings, "${full_settings_prefix}.") } else { - $full_settings_prefix = $lowercase_title + $full_settings = $settings } - $full_settings = ensure_prefix($settings, "${full_settings_prefix}.") - } else { - $full_settings = $settings - } - - $final_settings = deep_merge( - {"${extension_key}" => "${module_path}${so_name}.so"}, - $full_settings - ) - - $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) - ::php::config { $title: - file => "${config_root_ini}/${lowercase_title}.ini", - config => $final_settings, - require => $package_depends, - } - # Ubuntu/Debian systems use the mods-available folder. We need to enable - # settings files ourselves with php5enmod command. - $ext_tool_enable = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable) - $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) - $ext_tool_enabled = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled) + $final_settings = deep_merge( + {"${extension_key}" => "${module_path}${so_name}.so"}, + $full_settings + ) - if $::osfamily == 'Debian' and $ext_tool_enabled { - $cmd = "${ext_tool_enable} -s ${sapi} ${lowercase_title}" + $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) + ::php::config { $title: + file => "${config_root_ini}/${lowercase_title}.ini", + config => $final_settings, + require => $package_depends, + } - if $sapi == 'ALL' { - exec { $cmd: - onlyif => "${ext_tool_query} -s cli -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", - require =>::Php::Config[$title], - } - } else { - exec { $cmd: - onlyif => "${ext_tool_query} -s ${sapi} -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", - require =>::Php::Config[$title], + # Ubuntu/Debian systems use the mods-available folder. We need to enable + # settings files ourselves with php5enmod command. + $ext_tool_enable = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable) + $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) + $ext_tool_enabled = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled) + + if $::osfamily == 'Debian' and $ext_tool_enabled { + $cmd = "${ext_tool_enable} -s ${sapi} ${lowercase_title}" + + if $sapi == 'ALL' { + exec { $cmd: + onlyif => "${ext_tool_query} -s cli -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", + require =>::Php::Config[$title], + } + } else { + exec { $cmd: + onlyif => "${ext_tool_query} -s ${sapi} -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", + require =>::Php::Config[$title], + } } - } - if $::php::fpm { - Package[$::php::fpm::package] ~> Exec[$cmd] + if $::php::fpm { + Package[$::php::fpm::package] ~> Exec[$cmd] + } } } } From 3b7af3a24b74d3a2b7faaa42de691452a630f07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Wed, 22 Feb 2017 15:59:38 +0100 Subject: [PATCH 158/221] replace ensure_packages use with package resource We don't need the overly complex ensure_packages() function. This module is designed to manage php. We should be confident in this, and just let it do that. We also remove [] in the package { $title: }. If $real_package is an array, it doesn't need an extra set of []. --- manifests/extension.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index b3e6624d..52de6588 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -109,7 +109,7 @@ } if $provider == 'pecl' or $provider == 'pear' { - ensure_packages( [ $real_package ], { + package { $real_package: ensure => $ensure, provider => $provider, source => $real_source, @@ -118,7 +118,7 @@ Class['::php::pear'], Class['::php::dev'], ], - }) + } unless empty($compiler_packages) { ensure_resource('package', $compiler_packages) @@ -130,11 +130,11 @@ warning("responsefile param is not supported by php::extension provider ${provider}") } - ensure_packages( [ $real_package ], { + package { $real_package: ensure => $ensure, provider => $provider, source => $real_source, - }) + } } $package_depends = "Package[${real_package}]" From 8cb3fb573a3c6227f40daf3c04e04ec7d7d6fc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Thu, 23 Feb 2017 22:37:55 +0100 Subject: [PATCH 159/221] Simplify php::extension This defined type tried to do too much at once, so split the two main concerns: installation & onfiguration. Readability is greatly enhanced by reducing the nesting level of `if`s. --- manifests/extension.pp | 184 ++++++--------------------------- manifests/extension/config.pp | 112 ++++++++++++++++++++ manifests/extension/install.pp | 85 +++++++++++++++ types/provider.pp | 28 +++++ types/sapi.pp | 6 ++ 5 files changed, 264 insertions(+), 151 deletions(-) create mode 100644 manifests/extension/config.pp create mode 100644 manifests/extension/install.pp create mode 100644 types/provider.pp create mode 100644 types/sapi.pp diff --git a/manifests/extension.pp b/manifests/extension.pp index 5e6c3820..f133b1fd 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -18,10 +18,6 @@ # The source to install the extension from. Possible values # depend on the *provider* used # -# [*pecl_source*] -# The pecl source channel to install pecl package from -# Superseded by *source* -# # [*so_name*] # The DSO name of the package (e.g. opcache for zendopcache) # @@ -57,161 +53,47 @@ # *providers*: pear, pecl. # define php::extension ( - $ensure = 'installed', - $provider = undef, - $source = undef, - $pecl_source = undef, - $so_name = $name, - $php_api_version = undef, - $package_prefix = $::php::package_prefix, - $header_packages = [], - $compiler_packages = $::php::params::compiler_packages, - $zend = false, - $settings = {}, - $settings_prefix = false, - $sapi = 'ALL', - $responsefile = undef, + String $ensure = 'installed', + Optional[Php::Provider] $provider = undef, + Optional[String] $source = undef, + Optional[String] $so_name = downcase($name), + Optional[String] $php_api_version = undef, + String $package_prefix = $::php::package_prefix, + Boolean $zend = false, + Hash $settings = {}, + Php::Sapi $sapi = 'ALL', + Variant[Boolean, String] $settings_prefix = false, + Optional[Stdlib::AbsolutePath] $responsefile = undef, + Variant[String, Array[String]] $header_packages = [], + Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages, ) { if ! defined(Class['php']) { warning('php::extension is private') } - validate_string($ensure) - validate_string($package_prefix) - validate_string($so_name) - validate_string($php_api_version) - validate_string($sapi) - validate_array($header_packages) - validate_bool($zend) - - if $source and $pecl_source { - fail('Only one of $source and $pecl_source can be specified.') - } - - if $source { - $real_source = $source - } - else { - $real_source = $pecl_source - } - - if $provider != 'none' { - case $provider { - 'pecl': { $real_package = $title } - 'pear': { $real_package = $title } - default: { $real_package = "${package_prefix}${title}" } - } - - unless empty($header_packages) { - ensure_resource('package', $header_packages) - Package[$header_packages] -> Package[$real_package] - } - - if $provider == 'pecl' or $provider == 'pear' { - package { $real_package: - ensure => $ensure, - provider => $provider, - source => $real_source, - responsefile => $responsefile, - require => [ - Class['::php::pear'], - Class['::php::dev'], - ], - } - - unless empty($compiler_packages) { - ensure_resource('package', $compiler_packages) - Package[$compiler_packages] -> Package[$real_package] - } - } - else { - if $responsefile != undef { - warning("responsefile param is not supported by php::extension provider ${provider}") - } - - package { $real_package: - ensure => $ensure, - provider => $provider, - source => $real_source, - } - } - - $package_depends = "Package[${real_package}]" - } else { - $package_depends = undef + php::extension::install { $title: + ensure => $ensure, + provider => $provider, + source => $source, + responsefile => $responsefile, + package_prefix => $package_prefix, + header_packages => $header_packages, + compiler_packages => $compiler_packages, } - if $provider != 'pear' { # PEAR packages don't require antu further configuration, they just need to "be there". - if $zend == true { - $extension_key = 'zend_extension' - if $php_api_version != undef { - $module_path = "/usr/lib/php5/${php_api_version}/" - } - else { - $module_path = undef - } - } - else { - $extension_key = 'extension' - $module_path = undef - } - - if $so_name != $name { - $lowercase_title = $so_name - } - else { - $lowercase_title = downcase($title) - } - - # Ensure "." prefix is present in setting keys if requested - if $settings_prefix { - if is_string($settings_prefix) { - $full_settings_prefix = $settings_prefix - } else { - $full_settings_prefix = $lowercase_title - } - $full_settings = ensure_prefix($settings, "${full_settings_prefix}.") - } else { - $full_settings = $settings - } - - $final_settings = deep_merge( - {"${extension_key}" => "${module_path}${so_name}.so"}, - $full_settings - ) - - $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) - ::php::config { $title: - file => "${config_root_ini}/${lowercase_title}.ini", - config => $final_settings, - require => $package_depends, - } - - # Ubuntu/Debian systems use the mods-available folder. We need to enable - # settings files ourselves with php5enmod command. - $ext_tool_enable = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable) - $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) - $ext_tool_enabled = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled) - - if $::osfamily == 'Debian' and $ext_tool_enabled { - $cmd = "${ext_tool_enable} -s ${sapi} ${lowercase_title}" - - if $sapi == 'ALL' { - exec { $cmd: - onlyif => "${ext_tool_query} -s cli -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", - require =>::Php::Config[$title], - } - } else { - exec { $cmd: - onlyif => "${ext_tool_query} -s ${sapi} -m ${lowercase_title} | /bin/grep 'No module matches ${lowercase_title}'", - require =>::Php::Config[$title], - } - } - - if $::php::fpm { - Package[$::php::fpm::package] ~> Exec[$cmd] - } + # PEAR packages don't require any further configuration, they just need to "be there". + if $provider != 'pear' { + php::extension::config { $title: + ensure => $ensure, + provider => $provider, + so_name => $so_name, + php_api_version => $php_api_version, + zend => $zend, + settings => $settings, + settings_prefix => $settings_prefix, + sapi => $sapi, + subscribe => Php::Extension::Install[$title], } } } diff --git a/manifests/extension/config.pp b/manifests/extension/config.pp new file mode 100644 index 00000000..0fdfc819 --- /dev/null +++ b/manifests/extension/config.pp @@ -0,0 +1,112 @@ +# Configure a PHP extension package +# +# === Parameters +# +# [*ensure*] +# The ensure of the package to install +# Could be "latest", "installed" or a pinned version +# +# [*provider*] +# The provider used to install the package +# Could be "pecl", "apt", "dpkg" or any other OS package provider +# If set to "none", no package will be installed +# +# [*so_name*] +# The DSO name of the package (e.g. opcache for zendopcache) +# +# [*php_api_version*] +# This parameter is used to build the full path to the extension +# directory for zend_extension in PHP < 5.5 (e.g. 20100525) +# +# [*header_packages*] +# System packages dependencies to install for extensions (e.g. for +# memcached libmemcached-dev on Debian) +# +# [*compiler_packages*] +# System packages dependencies to install for compiling extensions +# (e.g. build-essential on Debian) +# +# [*zend*] +# Boolean parameter, whether to load extension as zend_extension. +# Defaults to false. +# +# [*settings*] +# Nested hash of global config parameters for php.ini +# +# [*settings_prefix*] +# Boolean/String parameter, whether to prefix all setting keys with +# the extension name or specified name. Defaults to false. +# +# [*sapi*] +# String parameter, whether to specify ALL sapi or a specific sapi. +# Defaults to ALL. +# +define php::extension::config ( + String $ensure = 'installed', + Optional[Php::Provider] $provider = undef, + Optional[String] $so_name = downcase($name), + Optional[String] $php_api_version = undef, + Boolean $zend = false, + Hash $settings = {}, + Variant[Boolean, String] $settings_prefix = false, + Php::Sapi $sapi = 'ALL', +) { + + if ! defined(Class['php']) { + warning('php::extension::config is private') + } + + if $zend == true { + $ini_name = downcase($so_name) + $extension_key = 'zend_extension' + $module_path = $php_api_version? { + undef => undef, + default => "/usr/lib/php5/${php_api_version}/", + } + } else { + $ini_name = downcase($title) + $extension_key = 'extension' + $module_path = undef + } + + # Ensure "." prefix is present in setting keys if requested + $full_settings = $settings_prefix? { + true => ensure_prefix($settings, "${so_name}."), + false => $settings, + String => ensure_prefix($settings, "${settings_prefix}."), + } + + $final_settings = deep_merge( + {"${extension_key}" => "${module_path}${so_name}.so"}, + $full_settings + ) + + $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) + ::php::config { $title: + file => "${config_root_ini}/${ini_name}.ini", + config => $final_settings, + } + + # Ubuntu/Debian systems use the mods-available folder. We need to enable + # settings files ourselves with php5enmod command. + $ext_tool_enable = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable) + $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) + $ext_tool_enabled = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled) + + if $::osfamily == 'Debian' and $ext_tool_enabled { + $cmd = "${ext_tool_enable} -s ${sapi} ${so_name}" + + $_sapi = $sapi? { + 'ALL' => 'cli', + default => $sapi, + } + exec { $cmd: + onlyif => "${ext_tool_query} -s ${_sapi} -m ${so_name} | /bin/grep 'No module matches ${so_name}'", + require => ::Php::Config[$title], + } + + if $::php::fpm { + Package[$::php::fpm::package] ~> Exec[$cmd] + } + } +} diff --git a/manifests/extension/install.pp b/manifests/extension/install.pp new file mode 100644 index 00000000..1fe6be40 --- /dev/null +++ b/manifests/extension/install.pp @@ -0,0 +1,85 @@ +# Install a PHP extension package +# +# === Parameters +# +# [*ensure*] +# The ensure of the package to install +# Could be "latest", "installed" or a pinned version +# +# [*package_prefix*] +# Prefix to prepend to the package name for the package provider +# +# [*provider*] +# The provider used to install the package +# Could be "pecl", "apt", "dpkg" or any other OS package provider +# If set to "none", no package will be installed +# +# [*source*] +# The source to install the extension from. Possible values +# depend on the *provider* used +# +# [*header_packages*] +# System packages dependencies to install for extensions (e.g. for +# memcached libmemcached-dev on Debian) +# +# [*compiler_packages*] +# System packages dependencies to install for compiling extensions +# (e.g. build-essential on Debian) +# +# [*responsefile*] +# File containing answers for interactive extension setup. Supported +# *providers*: pear, pecl. +# +define php::extension::install ( + String $ensure = 'installed', + Optional[Php::Provider] $provider = undef, + Optional[String] $source = undef, + String $package_prefix = $::php::package_prefix, + Optional[Stdlib::AbsolutePath] $responsefile = undef, + Variant[String, Array[String]] $header_packages = [], + Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages, +) { + + if ! defined(Class['php']) { + warning('php::extension::install is private') + } + + case $provider { + /pecl|pear/: { + $real_package = $title + + unless empty($header_packages) { + ensure_resource('package', $header_packages) + Package[$header_packages] -> Package[$real_package] + } + unless empty($compiler_packages) { + ensure_resource('package', $compiler_packages) + Package[$compiler_packages] -> Package[$real_package] + } + + $package_require = [ + Class['::php::pear'], + Class['::php::dev'], + ] + } + + 'none' : { + debug("No package installed for php::extension: `${title}`.") + } + + default: { + $real_package = "${package_prefix}${title}" + $package_require = undef + } + } + + unless $provider == 'none' { + package { $real_package: + ensure => $ensure, + provider => $provider, + source => $source, + responsefile => $responsefile, + require => $package_require, + } + } +} diff --git a/types/provider.pp b/types/provider.pp new file mode 100644 index 00000000..14af0a08 --- /dev/null +++ b/types/provider.pp @@ -0,0 +1,28 @@ +type Php::Provider = Enum[ + # do nothing + 'none', + + # php + 'pecl', + 'pear', + + # Debuntu + 'dpkg', + 'apt', + + # RHEL + 'yum', + 'rpm', + 'dnf', + 'up2date', + + # Suse + 'zypper', + 'rug', + + # FreeBSD + 'freebsd', + 'pkgng', + 'ports', + 'portupgrade', +] diff --git a/types/sapi.pp b/types/sapi.pp new file mode 100644 index 00000000..5ee11bc7 --- /dev/null +++ b/types/sapi.pp @@ -0,0 +1,6 @@ +type Php::Sapi = Enum[ + 'ALL', + 'cli', + 'fpm', + 'apache2', +] From 69ba10fc0ea0261445d3d6bde9c4dd41a305c3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 25 Feb 2017 15:04:25 +0100 Subject: [PATCH 160/221] Fixed forge badge on README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f810f889..0541a66f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Puppet Forge](http://img.shields.io/puppetforge/v/voxpupuli/php.svg)](https://forge.puppetlabs.com/voxpupuli/php) +[![Puppet Forge](http://img.shields.io/puppetforge/v/puppet/php.svg)](https://forge.puppetlabs.com/puppet/php) [![Build Status](https://travis-ci.org/voxpupuli/puppet-php.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-php) ## Current Status From d2fdaa26f29321c1d1aef4af89639b012cecf2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Sun, 26 Feb 2017 16:13:49 +0100 Subject: [PATCH 161/221] php::extension: restore prev behaviour wrt extension.ini naming previously we placed extensions= directives in their $so_name.ini This behaviour is now restored. --- manifests/extension/config.pp | 4 ++-- spec/defines/extension_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/extension/config.pp b/manifests/extension/config.pp index 0fdfc819..f9e69990 100644 --- a/manifests/extension/config.pp +++ b/manifests/extension/config.pp @@ -57,18 +57,18 @@ } if $zend == true { - $ini_name = downcase($so_name) $extension_key = 'zend_extension' $module_path = $php_api_version? { undef => undef, default => "/usr/lib/php5/${php_api_version}/", } } else { - $ini_name = downcase($title) $extension_key = 'extension' $module_path = undef } + $ini_name = downcase($so_name) + # Ensure "." prefix is present in setting keys if requested $full_settings = $settings_prefix? { true => ensure_prefix($settings, "${so_name}."), diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 442f4db3..87c7674e 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -175,7 +175,7 @@ it { is_expected.to contain_package('build-essential') } it do is_expected.to contain_php__config('json').with( - file: "#{etcdir}/json.ini", + file: "#{etcdir}/nice_name.ini", config: { 'extension' => 'nice_name.so', 'test' => 'foo' From 55daa873821b6e545e1d6d75f9fb58a482367933 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 7 Mar 2017 22:07:50 +1100 Subject: [PATCH 162/221] Only add a dependency on `Class['apt::update']` if `$manage_repo` is `true` The change introduced in #278 seems reasonable, but it means that `Class['apt::update']` may not actually be defined. --- manifests/packages.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/packages.pp b/manifests/packages.pp index e6c3d321..ec937fbb 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -33,10 +33,10 @@ if $::osfamily == 'debian' { if $manage_repos { include ::apt + Class['::apt::update'] -> Package[$real_names] } package { $real_names: - ensure => $ensure, - require => Class['::apt::update'], + ensure => $ensure, } } else { package { $real_names: From 17337ecc27cb3e903b36bf83f3537d194c1baa93 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Mar 2017 01:06:55 +0100 Subject: [PATCH 163/221] modulesync 0.20.1 --- .msync.yml | 2 +- Rakefile | 2 +- spec/acceptance/nodesets/docker/centos-7.yml | 1 + spec/acceptance/nodesets/docker/debian-8.yml | 1 + spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml | 2 +- spec/acceptance/nodesets/ec2/image_templates.yaml | 2 +- spec/acceptance/nodesets/ec2/rhel-73-x64.yml | 2 +- spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml | 2 +- spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml | 2 +- spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml | 2 +- 10 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.msync.yml b/.msync.yml index d03e5700..a8e6a4ee 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.20.0' +modulesync_config_version: '0.20.1' diff --git a/Rakefile b/Rakefile index 2def02fa..82c89608 100644 --- a/Rakefile +++ b/Rakefile @@ -35,7 +35,7 @@ begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = (Blacksmith::Modulefile.new).version - config.future_release = "#{version}" + config.future_release = "v#{version}" config.header = "# Change log\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not impact the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix modulesync} end diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml index 85e9d63c..41e924b5 100644 --- a/spec/acceptance/nodesets/docker/centos-7.yml +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -11,6 +11,7 @@ HOSTS: docker_cmd: '["/usr/sbin/init"]' docker_image_commands: - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss' + - 'systemctl mask getty@tty1.service' CONFIG: trace_limit: 200 masterless: true diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml index 500bee52..7a1f35c3 100644 --- a/spec/acceptance/nodesets/docker/debian-8.yml +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -13,6 +13,7 @@ HOSTS: - 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list' - 'apt-get update && apt-get install -y cron locales-all net-tools wget' - 'rm -f /usr/sbin/policy-rc.d' + - 'systemctl mask getty@tty1.service getty-static.service' CONFIG: trace_limit: 200 masterless: true diff --git a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml index 3f064f0a..19dd43ed 100644 --- a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml +++ b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/image_templates.yaml b/spec/acceptance/nodesets/ec2/image_templates.yaml index 9a277d81..e50593ee 100644 --- a/spec/acceptance/nodesets/ec2/image_templates.yaml +++ b/spec/acceptance/nodesets/ec2/image_templates.yaml @@ -7,7 +7,7 @@ # Hint: image IDs (ami-*) for the same image are different per location. # AMI: - # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type + # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type amazonlinux-2016091-eu-central-1: :image: :aio: ami-af0fc0c0 diff --git a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml index cd0521e7..7fac8236 100644 --- a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml +++ b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml index a14bea6c..8542154d 100644 --- a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml +++ b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml index 21ce560a..9cf59d59 100644 --- a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml +++ b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml index 36bd9891..0932e29c 100644 --- a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml +++ b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # From b5e3b91cc63b932446dc378c7e014317cf2bcf7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Thu, 16 Mar 2017 12:10:01 +0100 Subject: [PATCH 164/221] don't try to load extension.so for pear modules inspired by 8cb3fb573a3c6227f40daf3c04e04ec7d7d6fc42 --- manifests/extension.pp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index b3e6624d..dda8456e 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -175,10 +175,14 @@ $full_settings = $settings } - $final_settings = deep_merge( - {"${extension_key}" => "${module_path}${so_name}.so"}, - $full_settings - ) + if $provider != 'pear' { + $final_settings = deep_merge( + {"${extension_key}" => "${module_path}${so_name}.so"}, + $full_settings + ) + } else { + $final_settings = $full_settings + } $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) ::php::config { $title: From 3fb3602d31c94304baf33cad753d1d77ee9a8fe3 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Thu, 16 Mar 2017 09:01:06 -0500 Subject: [PATCH 165/221] Expose fpm user and group (#327) --- README.md | 13 +++++++++++++ manifests/fpm.pp | 4 ++++ manifests/init.pp | 2 ++ spec/classes/php_spec.rb | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+) diff --git a/README.md b/README.md index 0541a66f..ae5ed8a1 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,17 @@ by default. Specify additional pools like so: For an overview of all possible parameters for `php::fpm::pool` resources please see [its documention](http://php.puppet.mayflower.de/php/fpm/pool.html). +### Overriding php-fpm user + +By default, php-fpm is set up to run as Apache. If you need to customize that user, you can do that like so: + +```puppet + class { '::php': + fpm_user => 'nginx', + fpm_group => 'nginx', + } +``` + ### Alternative examples using Hiera Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera. @@ -139,6 +150,8 @@ Below are all the examples you see above, but defined in YAML format for use wit php::ensure: latest php::manage_repos: true php::fpm: true +php::fpm_user: 'nginx' +php::fpm_group: 'nginx' php::dev: true php::composer: true php::pear: true diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 0743b052..3a665899 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -45,6 +45,8 @@ # class php::fpm ( $ensure = $::php::ensure, + $user = $::php::fpm_user, + $group = $::php::fpm_group, $service_ensure = $::php::fpm_service_ensure, $service_enable = $::php::fpm_service_enable, $service_name = $::php::fpm_service_name, @@ -83,6 +85,8 @@ } class { '::php::fpm::config': + user => $user, + group => $group, inifile => $inifile, settings => $real_settings, log_owner => $log_owner, diff --git a/manifests/init.pp b/manifests/init.pp index 5145f5fa..cd507b78 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -118,6 +118,8 @@ $fpm_global_pool_settings = {}, $fpm_inifile = $::php::params::fpm_inifile, $fpm_package = undef, + $fpm_user = $::php::params::fpm_user, + $fpm_group = $::php::params::fpm_group, $embedded = false, $dev = true, $composer = true, diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index c8b7d85f..a2a8f0a0 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -50,6 +50,42 @@ end end + describe 'when called with fpm_user parameter' do + let(:params) { { fpm_user: 'nginx' } } + it { is_expected.to contain_class('php::fpm').with(user: 'nginx') } + it { is_expected.to contain_php__fpm__pool('www').with(user: 'nginx') } + + dstfile = case facts[:osfamily] + when 'Debian' + '/etc/php5/fpm/pool.d/www.conf' + when 'Suse' + '/etc/php5/fpm/pool.d/www.conf' + when 'RedHat' + '/etc/php-fpm.d/www.conf' + when 'FreeBSD' + '/usr/local/etc/php-fpm.d/www.conf' + end + + it { is_expected.to contain_file(dstfile).with_content(%r{user = nginx}) } + end + describe 'when called with fpm_group parameter' do + let(:params) { { fpm_group: 'nginx' } } + 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' + '/etc/php5/fpm/pool.d/www.conf' + when 'Suse' + '/etc/php5/fpm/pool.d/www.conf' + when 'RedHat' + '/etc/php-fpm.d/www.conf' + when 'FreeBSD' + '/usr/local/etc/php-fpm.d/www.conf' + end + + it { is_expected.to contain_file(dstfile).with_content(%r{group = nginx}) } + end + describe 'when fpm is disabled' do let(:params) { { fpm: false } } it { is_expected.not_to contain_class('php::fpm') } From 9bc60c4d850a936a4fdd3946a33fe5a2f60840f9 Mon Sep 17 00:00:00 2001 From: amette Date: Thu, 16 Mar 2017 16:46:48 +0100 Subject: [PATCH 166/221] Allow installing PHP 7.1 on Debian --- manifests/globals.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index b0094bbc..cc9f111e 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -83,7 +83,7 @@ $fpm_service_name = "php${globals_php_version}-fpm" $ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}" $ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}" - $package_prefix = 'php7.0-' + $package_prefix = "php${globals_php_version}-" } default: { $default_config_root = '/etc/php5' From bbee2643366eb70acdbd3b44c6d68b21bc7bb157 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Fri, 24 Mar 2017 16:55:09 -0500 Subject: [PATCH 167/221] add optional param to prefix the extension ini filename --- manifests/extension.pp | 5 +++++ manifests/extension/config.pp | 6 +++++- spec/defines/extension_spec.rb | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index f133b1fd..9adf47ee 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -21,6 +21,9 @@ # [*so_name*] # The DSO name of the package (e.g. opcache for zendopcache) # +# [*ini_prefix*] +# An optional filename prefix for the settings file of the extension +# # [*php_api_version*] # This parameter is used to build the full path to the extension # directory for zend_extension in PHP < 5.5 (e.g. 20100525) @@ -57,6 +60,7 @@ Optional[Php::Provider] $provider = undef, Optional[String] $source = undef, Optional[String] $so_name = downcase($name), + Optional[String] $ini_prefix = undef, Optional[String] $php_api_version = undef, String $package_prefix = $::php::package_prefix, Boolean $zend = false, @@ -88,6 +92,7 @@ ensure => $ensure, provider => $provider, so_name => $so_name, + ini_prefix => $ini_prefix, php_api_version => $php_api_version, zend => $zend, settings => $settings, diff --git a/manifests/extension/config.pp b/manifests/extension/config.pp index f9e69990..8c9813d3 100644 --- a/manifests/extension/config.pp +++ b/manifests/extension/config.pp @@ -14,6 +14,9 @@ # [*so_name*] # The DSO name of the package (e.g. opcache for zendopcache) # +# [*ini_prefix*] +# An optional filename prefix for the settings file of the extension +# # [*php_api_version*] # This parameter is used to build the full path to the extension # directory for zend_extension in PHP < 5.5 (e.g. 20100525) @@ -45,6 +48,7 @@ String $ensure = 'installed', Optional[Php::Provider] $provider = undef, Optional[String] $so_name = downcase($name), + Optional[String] $ini_prefix = undef, Optional[String] $php_api_version = undef, Boolean $zend = false, Hash $settings = {}, @@ -83,7 +87,7 @@ $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini) ::php::config { $title: - file => "${config_root_ini}/${ini_name}.ini", + file => "${config_root_ini}/${ini_prefix}${ini_name}.ini", config => $final_settings, } diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 87c7674e..aafe1c50 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -138,6 +138,27 @@ end end + context 'add ini file prefix if requested' do + let(:title) { 'zendopcache' } + let(:params) do + { + provider: 'pecl', + zend: true, + ini_prefix: '10-', + so_name: 'opcache' + } + end + + it do + is_expected.to contain_php__config('zendopcache').with( + file: "#{etcdir}/10-opcache.ini", + config: { + 'zend_extension' => 'opcache.so' + } + ) + end + end + context 'pecl extensions support php_api_version' do let(:title) { 'xdebug' } let(:params) do From 94e417faf6e075981645ae5c5553bda43c42e394 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 15 Apr 2017 16:56:16 +0200 Subject: [PATCH 168/221] modulesync 0.21.0 --- .github/CONTRIBUTING.md | 4 +++ .msync.yml | 2 +- .overcommit.yml | 63 +++++++++++++++++++++++++++++++++++++++++ .rubocop.yml | 2 ++ .travis.yml | 17 +++++++---- Gemfile | 16 +++++------ 6 files changed, 89 insertions(+), 15 deletions(-) create mode 100644 .overcommit.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5574191a..602f324b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -98,3 +98,7 @@ If you don't want to have to recreate the virtual machine every time you can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. + +The easiest way to debug in a docker container is to open a shell: + + docker exec -it -u root ${container_id_or_name} bash diff --git a/.msync.yml b/.msync.yml index a8e6a4ee..540f0cea 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.20.1' +modulesync_config_version: '0.21.0' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 00000000..31699e74 --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,63 @@ +# Managed by https://github.com/voxpupuli/modulesync_configs +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'test' + - 'rubocop' + command: [ 'bundle', 'exec', 'rake' ] diff --git a/.rubocop.yml b/.rubocop.yml index ef85ceb4..4e113f03 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,6 +9,8 @@ AllCops: - .vendor/**/* - pkg/**/* - spec/fixtures/**/* + - Gemfile + - Rakefile Lint/ConditionPosition: Enabled: True diff --git a/.travis.yml b/.travis.yml index fc928217..94e3933d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ sudo: false dist: trusty language: ruby cache: bundler -bundler_args: --without system_tests development before_install: - bundle -v - rm Gemfile.lock || true @@ -17,16 +16,22 @@ matrix: fast_finish: true include: - rvm: 2.1.9 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.2.6 + - rvm: 2.2.7 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.3 + - rvm: 2.3.4 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=rubocop - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: diff --git a/Gemfile b/Gemfile index 2270de7d..d35336cb 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.0.1', :require => false - gem 'parallel_tests', :require => false + gem 'puppetlabs_spec_helper', '~> 2.1.1', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -26,10 +25,10 @@ group :test do gem 'metadata-json-lint', :require => false gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' - gem 'puppet-strings', '~> 1.0.0', :require => false + gem 'puppet-strings', '~> 1.0', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0' - gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.48.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false @@ -39,9 +38,10 @@ group :test do end group :development do - gem 'travis', :require => false - gem 'travis-lint', :require => false - gem 'guard-rake', :require => false + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false + gem 'overcommit', '~> 0.39.1', :require => false end group :system_tests do From 328cc9ac7be207b1c4582ea358a5d236d071155f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 15 Apr 2017 16:56:31 +0200 Subject: [PATCH 169/221] rubocop: autofixes --- spec/classes/php_fpm_spec.rb | 1 + spec/classes/php_repo_ubuntu_spec.rb | 3 +++ spec/classes/php_spec.rb | 5 +++++ spec/defines/config_spec.rb | 2 ++ spec/defines/fpm_pool_spec.rb | 1 + 5 files changed, 12 insertions(+) diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index eb1621c1..e9682f9c 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -7,6 +7,7 @@ facts end let(:pre_condition) { 'class {"php": fpm => false}' } + describe 'when called with no parameters' do # rubocop:disable RSpec/RepeatedExample case facts[:osfamily] diff --git a/spec/classes/php_repo_ubuntu_spec.rb b/spec/classes/php_repo_ubuntu_spec.rb index 3aa5f2e1..6650ab43 100644 --- a/spec/classes/php_repo_ubuntu_spec.rb +++ b/spec/classes/php_repo_ubuntu_spec.rb @@ -19,6 +19,7 @@ version: '7.0' } end + it { is_expected.to contain_exec('add-apt-repository-ppa:ondrej/php') } end @@ -28,6 +29,7 @@ version: '5.6' } end + it { is_expected.to contain_exec('add-apt-repository-ppa:ondrej/php') } end @@ -37,6 +39,7 @@ version: '5.4' } end + it { expect { is_expected.to raise_error(Puppet::Error) } } end diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index a2a8f0a0..b8026daa 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -30,6 +30,7 @@ describe 'when called with package_prefix parameter' do let(:params) { { package_prefix: 'myphp-' } } + case facts[:osfamily] when 'Debian' it { is_expected.not_to contain_class('php::global') } @@ -52,6 +53,7 @@ describe 'when called with fpm_user parameter' do let(:params) { { fpm_user: 'nginx' } } + it { is_expected.to contain_class('php::fpm').with(user: 'nginx') } it { is_expected.to contain_php__fpm__pool('www').with(user: 'nginx') } @@ -70,6 +72,7 @@ end describe 'when called with fpm_group parameter' do let(:params) { { fpm_group: 'nginx' } } + 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] @@ -88,10 +91,12 @@ describe 'when fpm is disabled' do let(:params) { { fpm: false } } + it { is_expected.not_to contain_class('php::fpm') } end describe 'when composer is disabled' do let(:params) { { composer: false } } + it { is_expected.not_to contain_class('php::composer') } end end diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index e20639c4..e0c0c752 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -17,6 +17,7 @@ config: {} } end + it { is_expected.to compile } end @@ -66,6 +67,7 @@ config: {} } end + it { is_expected.to compile } end diff --git a/spec/defines/fpm_pool_spec.rb b/spec/defines/fpm_pool_spec.rb index c423306c..be69869c 100644 --- a/spec/defines/fpm_pool_spec.rb +++ b/spec/defines/fpm_pool_spec.rb @@ -7,6 +7,7 @@ facts end let(:pre_condition) { 'include php' } + case facts[:osfamily] when 'Debian' case facts[:operatingsystem] From be964f6af4344e095bfc2959dd1f4668b0f4b1e5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 15 Apr 2017 16:56:33 +0200 Subject: [PATCH 170/221] puppet-lint: autofixes --- manifests/composer.pp | 4 +-- manifests/embedded.pp | 4 +-- manifests/init.pp | 66 +++++++++++++++++++++--------------------- manifests/phpunit.pp | 4 +-- manifests/repo/suse.pp | 4 +-- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/manifests/composer.pp b/manifests/composer.pp index ba1ec389..99dec1c9 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -47,8 +47,8 @@ source => $source, proxy_type => $proxy_type, proxy_server => $proxy_server, - } -> - file { $path: + } + -> file { $path: mode => '0555', owner => root, group => $root_group, diff --git a/manifests/embedded.pp b/manifests/embedded.pp index 6837c22f..cf4c6ae6 100644 --- a/manifests/embedded.pp +++ b/manifests/embedded.pp @@ -42,8 +42,8 @@ package { $real_package: ensure => $ensure, require => Class['::php::packages'], - }-> - ::php::config { 'embedded': + } + -> ::php::config { 'embedded': file => $inifile, config => $real_settings, } diff --git a/manifests/init.pp b/manifests/init.pp index cd507b78..5b719724 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -183,24 +183,24 @@ $real_fpm_global_pool_settings = deep_merge($fpm_global_pool_settings, hiera_hash('php::fpm_global_pool_settings', {})) if $manage_repos { - class { '::php::repo': } -> - Anchor['php::begin'] + class { '::php::repo': } + -> Anchor['php::begin'] } - anchor { 'php::begin': } -> - class { '::php::packages': } -> - class { '::php::cli': + anchor { 'php::begin': } + -> class { '::php::packages': } + -> class { '::php::cli': settings => $real_settings, - } -> - anchor { 'php::end': } + } + -> anchor { 'php::end': } # Configure global PHP settings in php.ini if $::osfamily != 'Debian' { - Class['php::packages'] -> - class {'::php::global': + Class['php::packages'] + -> class {'::php::global': settings => $real_settings, - } -> - Anchor['php::end'] + } + -> Anchor['php::end'] } if $fpm { contain '::php::fpm' } @@ -210,43 +210,43 @@ fail('Enabling both cli and embedded sapis is not currently supported') } - Anchor['php::begin'] -> - class { '::php::embedded': + Anchor['php::begin'] + -> class { '::php::embedded': settings => $real_settings, - } -> - Anchor['php::end'] + } + -> Anchor['php::end'] } if $dev { - Anchor['php::begin'] -> - class { '::php::dev': } -> - Anchor['php::end'] + Anchor['php::begin'] + -> class { '::php::dev': } + -> Anchor['php::end'] } if $composer { - Anchor['php::begin'] -> - class { '::php::composer': + Anchor['php::begin'] + -> class { '::php::composer': proxy_type => $proxy_type, proxy_server => $proxy_server, - } -> - Anchor['php::end'] + } + -> Anchor['php::end'] } if $pear { - Anchor['php::begin'] -> - class { '::php::pear': + Anchor['php::begin'] + -> class { '::php::pear': ensure => $pear_ensure, - } -> - Anchor['php::end'] + } + -> Anchor['php::end'] } if $phpunit { - Anchor['php::begin'] -> - class { '::php::phpunit': } -> - Anchor['php::end'] + Anchor['php::begin'] + -> class { '::php::phpunit': } + -> Anchor['php::end'] } if $apache_config { - Anchor['php::begin'] -> - class { '::php::apache_config': + Anchor['php::begin'] + -> class { '::php::apache_config': settings => $real_settings, - } -> - Anchor['php::end'] + } + -> Anchor['php::end'] } create_resources('::php::extension', $real_extensions, { diff --git a/manifests/phpunit.pp b/manifests/phpunit.pp index dba40aa5..444e9450 100644 --- a/manifests/phpunit.pp +++ b/manifests/phpunit.pp @@ -37,8 +37,8 @@ creates => $path, path => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/'], require => [Class['::php::cli'],Package['wget']], - } -> - file { $path: + } + -> file { $path: mode => '0555', owner => root, group => root, diff --git a/manifests/repo/suse.pp b/manifests/repo/suse.pp index b034901d..9c02f5bb 100644 --- a/manifests/repo/suse.pp +++ b/manifests/repo/suse.pp @@ -16,8 +16,8 @@ baseurl => $baseurl, enabled => 1, autorefresh => 1, - } ~> - exec { 'zypprepo-accept-key': + } + ~> exec { 'zypprepo-accept-key': command => 'zypper --gpg-auto-import-keys update -y', path => '/usr/bin:/bin', refreshonly => true, From 58de8953c1a991ce7c962cf55f0dfa5ddddbff07 Mon Sep 17 00:00:00 2001 From: juniorsysadmin Date: Sun, 16 Apr 2017 17:54:23 +1000 Subject: [PATCH 171/221] Rubocop fixes: Indent Heredoc --- lib/puppet/parser/functions/ensure_prefix.rb | 24 +++++++------- .../parser/functions/to_hash_settings.rb | 32 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/puppet/parser/functions/ensure_prefix.rb b/lib/puppet/parser/functions/ensure_prefix.rb index c6ca6cb4..f1985518 100644 --- a/lib/puppet/parser/functions/ensure_prefix.rb +++ b/lib/puppet/parser/functions/ensure_prefix.rb @@ -1,23 +1,23 @@ module Puppet::Parser::Functions newfunction(:ensure_prefix, type: :rvalue, doc: <<-EOS -This function ensures a prefix for all elements in an array or the keys in a hash. + This function ensures a prefix for all elements in an array or the keys in a hash. -*Examples:* + *Examples:* - ensure_prefix({'a' => 1, 'b' => 2, 'p.c' => 3}, 'p.') + ensure_prefix({'a' => 1, 'b' => 2, 'p.c' => 3}, 'p.') -Will return: - { - 'p.a' => 1, - 'p.b' => 2, - 'p.c' => 3, - } + Will return: + { + 'p.a' => 1, + 'p.b' => 2, + 'p.c' => 3, + } - ensure_prefix(['a', 'p.b', 'c'], 'p.') + ensure_prefix(['a', 'p.b', 'c'], 'p.') -Will return: - ['p.a', 'p.b', 'p.c'] + Will return: + ['p.a', 'p.b', 'p.c'] EOS ) do |arguments| if arguments.size < 2 diff --git a/lib/puppet/parser/functions/to_hash_settings.rb b/lib/puppet/parser/functions/to_hash_settings.rb index 88083906..9e33ee97 100644 --- a/lib/puppet/parser/functions/to_hash_settings.rb +++ b/lib/puppet/parser/functions/to_hash_settings.rb @@ -1,28 +1,28 @@ module Puppet::Parser::Functions newfunction(:to_hash_settings, type: :rvalue, doc: <<-EOS -This function converts a +{key => value}+ hash into a nested hash and can add an id to the outer key. -The optional id string as second parameter is prepended to the resource name. + This function converts a +{key => value}+ hash into a nested hash and can add an id to the outer key. + The optional id string as second parameter is prepended to the resource name. -*Examples:* + *Examples:* - to_hash_settings({'a' => 1, 'b' => 2}) + to_hash_settings({'a' => 1, 'b' => 2}) -Would return: - { - 'a' => {'key' => 'a', 'value' => 1}, - 'b' => {'key' => 'b', 'value' => 2} - } + Would return: + { + 'a' => {'key' => 'a', 'value' => 1}, + 'b' => {'key' => 'b', 'value' => 2} + } -and: + and: - to_hash_settings({'a' => 1, 'b' => 2}, 'foo') + to_hash_settings({'a' => 1, 'b' => 2}, 'foo') -Would return: - { - 'foo: a' => {'key' => 'a', 'value' => 1}, - 'foo: b' => {'key' => 'b', 'value' => 2} - } + Would return: + { + 'foo: a' => {'key' => 'a', 'value' => 1}, + 'foo: b' => {'key' => 'b', 'value' => 2} + } EOS ) do |arguments| hash, id = arguments From 64066a840fa26022af139af644fc51f533cb2d5b Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Fri, 2 Jun 2017 14:08:13 -0500 Subject: [PATCH 172/221] Add missing php-fpm user and group class param docs --- manifests/fpm.pp | 6 ++++++ manifests/fpm/pool.pp | 4 ++-- manifests/init.pp | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 3a665899..64e6fd9f 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -2,6 +2,12 @@ # # === Parameters # +# [*user*] +# The user that php-fpm should run as +# +# [*group*] +# The group that php-fpm should run as +# # [*service_enable*] # Enable/disable FPM service # diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index e3437314..57ea628b 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -25,10 +25,10 @@ # [*listen_mode*] # # [*user*] -# Which user the php-fpm process to run as +# The user that php-fpm should run as # # [*group*] -# Which group the php-fpm process to run as +# The group that php-fpm should run as # # [*pm*] # diff --git a/manifests/init.pp b/manifests/init.pp index 5b719724..53e6c8f4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -42,6 +42,12 @@ # [*fpm_package*] # Name of fpm package to install # +# [*fpm_user*] +# The user that php-fpm should run as +# +# [*fpm_group*] +# The group that php-fpm should run as +# # [*dev*] # Install php header files, needed to install pecl modules # From edf6249da1061fd5a28e57cef732ba00ca57fc18 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:17:25 +0200 Subject: [PATCH 173/221] Add support for puppetlabs/apt 4.X --- manifests/repo/debian.pp | 24 +++++++++++++++--------- metadata.json | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/manifests/repo/debian.pp b/manifests/repo/debian.pp index 760f5a4c..702ddf0d 100644 --- a/manifests/repo/debian.pp +++ b/manifests/repo/debian.pp @@ -44,11 +44,14 @@ }}) ::apt::source { "source_php_${release}": - location => $location, - release => $release, - repos => $repos, - include_src => $include_src, - require => Apt::Key['php::repo::debian'], + location => $location, + release => $release, + repos => $repos, + include => { + 'src' => $include_src, + 'deb' => true, + }, + require => Apt::Key['php::repo::debian'], } if ($dotdeb) { @@ -56,10 +59,13 @@ # See: http://www.dotdeb.org/instructions/ if $release == 'wheezy-php56' { ::apt::source { 'dotdeb-wheezy': - location => $location, - release => 'wheezy', - repos => $repos, - include_src => $include_src, + location => $location, + release => 'wheezy', + repos => $repos, + include => { + 'src' => $include_src, + 'deb' => true, + }, } } } diff --git a/metadata.json b/metadata.json index ae7a063b..f74e21d3 100644 --- a/metadata.json +++ b/metadata.json @@ -15,7 +15,7 @@ }, { "name": "puppetlabs/apt", - "version_requirement": ">= 2.1.0 < 3.0.0" + "version_requirement": ">= 4.1.0 < 5.0.0" }, { "name": "puppetlabs/inifile", From 448a53be0974c91130804579d16b57e3c2440016 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 11 Jun 2017 17:59:26 +0200 Subject: [PATCH 174/221] modulesync 0.21.3 --- .gitignore | 1 + .msync.yml | 2 +- .rspec_parallel | 1 + .rubocop.yml | 9 +++++++++ Gemfile | 1 + spec/acceptance/nodesets/archlinux-2-x64.yml | 13 +++++++++++++ spec/acceptance/nodesets/docker/ubuntu-16.04.yml | 2 +- 7 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .rspec_parallel create mode 100644 spec/acceptance/nodesets/archlinux-2-x64.yml diff --git a/.gitignore b/.gitignore index 0d629b0c..e9b3cf4b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Puppetfile.lock *.iml .*.sw? .yardoc/ +Guardfile diff --git a/.msync.yml b/.msync.yml index 540f0cea..4abde220 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.21.0' +modulesync_config_version: '0.21.3' diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 00000000..e4d136b7 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1 @@ +--format progress diff --git a/.rubocop.yml b/.rubocop.yml index 4e113f03..d92e4e45 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,6 +11,7 @@ AllCops: - spec/fixtures/**/* - Gemfile - Rakefile + - Guardfile Lint/ConditionPosition: Enabled: True @@ -502,6 +503,10 @@ Style/ClosingParenthesisIndentation: # RSpec +RSpec/BeforeAfterAll: + Exclude: + - spec/acceptance/**/* + # We don't use rspec in this way RSpec/DescribeClass: Enabled: False @@ -521,6 +526,10 @@ RSpec/RepeatedDescription: RSpec/NestedGroups: Enabled: False +# this is broken on ruby1.9 +Style/IndentHeredoc: + Enabled: False + # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs Security/YAMLLoad: Enabled: false diff --git a/Gemfile b/Gemfile index d35336cb..0914f7cb 100644 --- a/Gemfile +++ b/Gemfile @@ -35,6 +35,7 @@ group :test do gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2' gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' + gem 'parallel_tests', :require => false end group :development do diff --git a/spec/acceptance/nodesets/archlinux-2-x64.yml b/spec/acceptance/nodesets/archlinux-2-x64.yml new file mode 100644 index 00000000..89b63003 --- /dev/null +++ b/spec/acceptance/nodesets/archlinux-2-x64.yml @@ -0,0 +1,13 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + archlinux-2-x64: + roles: + - master + platform: archlinux-2-x64 + box: archlinux/archlinux + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml index 92a93cb7..bac2d5b3 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml +++ b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -10,7 +10,7 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'apt-get install -y net-tools wget' + - 'apt-get install -y net-tools wget locales' - 'locale-gen en_US.UTF-8' CONFIG: trace_limit: 200 From e11af6252d7b992e70d7ba26e3aadbae747c1daf Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 10:21:53 +0200 Subject: [PATCH 175/221] bump to minimal recommended stdlib version --- metadata.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata.json b/metadata.json index f74e21d3..9a1979da 100644 --- a/metadata.json +++ b/metadata.json @@ -11,7 +11,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.6.0 < 5.0.0" + "version_requirement": ">= 4.13.1 < 5.0.0" }, { "name": "puppetlabs/apt", @@ -19,11 +19,11 @@ }, { "name": "puppetlabs/inifile", - "version_requirement": ">=1.4.1 < 2.0.0" + "version_requirement": ">= 1.4.1 < 2.0.0" }, { "name": "darin/zypprepo", - "version_requirement": ">=1.0.2 < 2.0.0" + "version_requirement": ">= 1.0.2 < 2.0.0" }, { "name": "puppet/archive", From cda89a5e1a6a801c18ae0ce27edcb7f5e6535aa8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 10:22:18 +0200 Subject: [PATCH 176/221] bump to minimal recommended puppet4 version --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 9a1979da..eb6d24e3 100644 --- a/metadata.json +++ b/metadata.json @@ -37,7 +37,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 3.8.7 < 5.0.0" + "version_requirement": ">= 4.7.0 < 5.0.0" } ], "operatingsystem_support": [ From fe696257bb2dba764fc7e3b81eb2ffac46bd4587 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:20:07 +0200 Subject: [PATCH 177/221] replace validate_* with datatypes in apache_config --- manifests/apache_config.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/manifests/apache_config.pp b/manifests/apache_config.pp index 291c9407..d7730f62 100644 --- a/manifests/apache_config.pp +++ b/manifests/apache_config.pp @@ -9,17 +9,14 @@ # Hash with nested hash of key => value to set in inifile # class php::apache_config( - $inifile = $::php::params::apache_inifile, - $settings = {} + Stdlib::Absolutepath $inifile = $::php::params::apache_inifile, + Hash $settings = {} ) inherits ::php::params { if $caller_module_name != $module_name { warning('php::apache_config is private') } - validate_absolute_path($inifile) - validate_hash($settings) - $real_settings = deep_merge($settings, hiera_hash('php::apache::settings', {})) ::php::config { 'apache': From c2a47835c841548276fb556aa1c33a157fb5c4f1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:21:19 +0200 Subject: [PATCH 178/221] replace validate_* with datatypes in fpm --- manifests/fpm.pp | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 3a665899..8ef5bc3f 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -44,32 +44,26 @@ # Defaults is empty hash. # class php::fpm ( - $ensure = $::php::ensure, - $user = $::php::fpm_user, - $group = $::php::fpm_group, - $service_ensure = $::php::fpm_service_ensure, - $service_enable = $::php::fpm_service_enable, - $service_name = $::php::fpm_service_name, - $service_provider = $::php::fpm_service_provider, - $package = $::php::real_fpm_package, - $inifile = $::php::fpm_inifile, - $settings = $::php::real_settings, - $global_pool_settings = $::php::real_fpm_global_pool_settings, - $pools = $::php::real_fpm_pools, - $log_owner = $::php::log_owner, - $log_group = $::php::log_group, + String $ensure = $::php::ensure, + $user = $::php::fpm_user, + $group = $::php::fpm_group, + $service_ensure = $::php::fpm_service_ensure, + $service_enable = $::php::fpm_service_enable, + $service_name = $::php::fpm_service_name, + $service_provider = $::php::fpm_service_provider, + String $package = $::php::real_fpm_package, + Stdlib::Absolutepath $inifile = $::php::fpm_inifile, + Hash $settings = $::php::real_settings, + $global_pool_settings = $::php::real_fpm_global_pool_settings, + Hash $pools = $::php::real_fpm_pools, + $log_owner = $::php::log_owner, + $log_group = $::php::log_group, ) { if ! defined(Class['php']) { warning('php::fpm is private') } - validate_string($ensure) - validate_string($package) - validate_absolute_path($inifile) - validate_hash($settings) - validate_hash($pools) - $real_settings = deep_merge($settings, hiera_hash('php::fpm::settings', {})) # On FreeBSD fpm is not a separate package, but included in the 'php' package. From c78c643b21f6cfa615bb5a603680b5b0b0cec586 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:22:17 +0200 Subject: [PATCH 179/221] replace validate_* with datatypes in ubuntu --- manifests/repo/ubuntu.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/repo/ubuntu.pp b/manifests/repo/ubuntu.pp index f073fad8..66005e13 100644 --- a/manifests/repo/ubuntu.pp +++ b/manifests/repo/ubuntu.pp @@ -19,8 +19,7 @@ if ($version_real == '5.5') { fail('PHP 5.5 is no longer available for download') } - - validate_re($version_real, '^\d\.\d') + assert_type(Pattern[/^\d\.\d/], $version_real) $version_repo = $version_real ? { '5.4' => 'ondrej/php5-oldstable', From da553f9bb9c7fd48bc0ff8026453e962cebfface Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:22:56 +0200 Subject: [PATCH 180/221] replace validate_* with datatypes in pear --- manifests/pear.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/manifests/pear.pp b/manifests/pear.pp index 9fef078e..68997467 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -9,8 +9,8 @@ # The package name for PHP pear # class php::pear ( - $ensure = $::php::pear_ensure, - $package = undef, + String $ensure = $::php::pear_ensure, + Optional[String] $package = undef, ) inherits ::php::params { if $caller_module_name != $module_name { @@ -40,9 +40,6 @@ $package_name = $package } - validate_string($ensure) - validate_string($package_name) - # Default PHP come with xml module and no seperate package for it if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0 { ensure_packages(["${php::package_prefix}xml"], { From 13729db24bd7e6d2ee74c9bc395218bba8bfb9da Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:24:20 +0200 Subject: [PATCH 181/221] replace validate_* with datatypes in phpunit --- manifests/phpunit.pp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/manifests/phpunit.pp b/manifests/phpunit.pp index 444e9450..5832be2b 100644 --- a/manifests/phpunit.pp +++ b/manifests/phpunit.pp @@ -15,21 +15,16 @@ # Defines the time in days after which an auto-update gets executed # class php::phpunit ( - $source = $::php::params::phpunit_source, - $path = $::php::params::phpunit_path, - $auto_update = true, - $max_age = $::php::params::phpunit_max_age, + String $source = $::php::params::phpunit_source, + Stdlib::Absolutepath $path = $::php::params::phpunit_path, + Boolean $auto_update = true, + Integer $max_age = $::php::params::phpunit_max_age, ) inherits ::php::params { if $caller_module_name != $module_name { warning('php::phpunit is private') } - validate_string($source) - validate_absolute_path($path) - validate_bool($auto_update) - validate_re("x${max_age}", '^x\d+$') - ensure_packages(['wget']) exec { 'download phpunit': From d5e8995905878615a3a573525539ba62ede6e6d0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:25:18 +0200 Subject: [PATCH 182/221] replace validate_* with datatypes in packages --- manifests/packages.pp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/manifests/packages.pp b/manifests/packages.pp index ec937fbb..47f46ef5 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -13,22 +13,18 @@ # package prefix `$php::package_prefix` # class php::packages ( - $ensure = $::php::ensure, - $manage_repos = $::php::manage_repos, - $names_to_prefix = prefix( + String $ensure = $::php::ensure, + Boolean $manage_repos = $::php::manage_repos, + Array $names_to_prefix = prefix( $::php::params::common_package_suffixes, $::php::package_prefix # lint:ignore:parameter_documentation ), - $names = $::php::params::common_package_names, + Array $names = $::php::params::common_package_names, ) inherits ::php::params { if $caller_module_name != $module_name { warning('php::packages is private') } - validate_string($ensure) - validate_array($names) - validate_array($names_to_prefix) - $real_names = union($names, $names_to_prefix) if $::osfamily == 'debian' { if $manage_repos { From f44104319cfd089599850bb9eb2fa9f2afd784ed Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:26:20 +0200 Subject: [PATCH 183/221] replace validate_* with datatypes in composer --- manifests/cli.pp | 7 ++----- manifests/composer.pp | 19 +++++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/manifests/cli.pp b/manifests/cli.pp index b07ad665..61ca93bb 100644 --- a/manifests/cli.pp +++ b/manifests/cli.pp @@ -9,17 +9,14 @@ # Hash with nested hash of key => value to set in inifile # class php::cli( - $inifile = $::php::params::cli_inifile, - $settings = {} + Stdlib::Absolutepath $inifile = $::php::params::cli_inifile, + Hash $settings = {} ) inherits ::php::params { if $caller_module_name != $module_name { warning('php::cli is private') } - validate_absolute_path($inifile) - validate_hash($settings) - $real_settings = deep_merge($settings, hiera_hash('php::cli::settings', {})) ::php::config { 'cli': diff --git a/manifests/composer.pp b/manifests/composer.pp index 99dec1c9..80712977 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -24,24 +24,19 @@ # UNIX group of the root user # class php::composer ( - $source = $::php::params::composer_source, - $path = $::php::params::composer_path, - $proxy_type = undef, - $proxy_server = undef, - $auto_update = true, - $max_age = $::php::params::composer_max_age, - $root_group = $::php::params::root_group, + String $source = $::php::params::composer_source, + Stdlib::Absolutepath $path = $::php::params::composer_path, + $proxy_type = undef, + $proxy_server = undef, + Boolean $auto_update = true, + Integer $max_age = $::php::params::composer_max_age, + Variant[Integer, String] $root_group = $::php::params::root_group, ) inherits ::php::params { if $caller_module_name != $module_name { warning('php::composer is private') } - validate_string($source) - validate_absolute_path($path) - validate_bool($auto_update) - validate_re("x${max_age}", '^x\d+$') - archive { 'download composer': path => $path, source => $source, From e9f5eab3a6cfdf60baa25ad040cfafac9d78041d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:26:42 +0200 Subject: [PATCH 184/221] replace validate_* with datatypes in setting --- manifests/config/setting.pp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/manifests/config/setting.pp b/manifests/config/setting.pp index 543cee8e..44439d38 100644 --- a/manifests/config/setting.pp +++ b/manifests/config/setting.pp @@ -21,15 +21,13 @@ define php::config::setting( $key, $value, - $file, + Stdlib::Absolutepath $file, ) { if $caller_module_name != $module_name { warning('php::config::setting is private') } - validate_string($file) - $split_name = split($key, '/') if count($split_name) == 1 { $section = '' # lint:ignore:empty_string_assignment From 6b2124343d39c41474452a54439ffead77adceae Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:27:15 +0200 Subject: [PATCH 185/221] replace validate_* with datatypes in config --- manifests/config.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 531a454c..f7c47f22 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -18,17 +18,14 @@ # } # define php::config( - $file, - $config + Stdlib::Absolutepath $file, + Hash $config ) { if $caller_module_name != $module_name { warning('php::config is private') } - validate_absolute_path($file) - validate_hash($config) - create_resources(::php::config::setting, to_hash_settings($config, $file), { file => $file }) From 250d9bdb7606a2fcd2df5ed718a6c3c4b2869b46 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:27:38 +0200 Subject: [PATCH 186/221] replace validate_* with datatypes in dev --- manifests/dev.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/manifests/dev.pp b/manifests/dev.pp index cbb77339..34129afc 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -9,17 +9,14 @@ # The package name for the PHP development files # class php::dev( - $ensure = $::php::ensure, - $package = "${::php::package_prefix}${::php::params::dev_package_suffix}", + String $ensure = $::php::ensure, + String $package = "${::php::package_prefix}${::php::params::dev_package_suffix}", ) inherits ::php::params { if $caller_module_name != $module_name { warning('php::dev is private') } - validate_string($ensure) - validate_string($package) - # On FreeBSD there is no 'devel' package. $real_package = $::osfamily ? { 'FreeBSD' => [], From fb3b1f70f0d6e0b31c6fc57b34b07e7ee8bfb38e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:28:15 +0200 Subject: [PATCH 187/221] replace validate_* with datatypes in global --- manifests/global.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/manifests/global.pp b/manifests/global.pp index 76789943..dd35f186 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -12,17 +12,14 @@ # class php::global( - $inifile = $::php::config_root_inifile, - $settings = {} + Stdlib::Absolutepath $inifile = $::php::config_root_inifile, + Hash $settings = {} ) inherits ::php { if $caller_module_name != $module_name { warning('php::global is private') } - validate_absolute_path($inifile) - validate_hash($settings) - # No deep merging required since the settings we have are the global settings. $real_settings = $settings From d5c7360eff8591131821b52138218077c46a11ba Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:29:07 +0200 Subject: [PATCH 188/221] replace validate_* with datatypes in globals --- manifests/globals.pp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index b0094bbc..69b3adc8 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -12,20 +12,10 @@ # Path to pid file for fpm class php::globals ( - $php_version = undef, - $config_root = undef, - $fpm_pid_file = undef, + Optional[Pattern[/^[57].[0-9]/]] $php_version = undef, + Optional[Stdlib::Absolutepath] $config_root = undef, + Optional[Stdlib::Absolutepath] $fpm_pid_file = undef, ) { - if $php_version != undef { - validate_re($php_version, '^[57].[0-9]') - } - if $config_root != undef { - validate_absolute_path($config_root) - } - - if $fpm_pid_file != undef { - validate_absolute_path($fpm_pid_file) - } $default_php_version = $::osfamily ? { 'Debian' => $::operatingsystem ? { From b490f8dd4ce8ddd1d1208fc4186ee27fb7acc91f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:31:34 +0200 Subject: [PATCH 189/221] replace validate_* with datatypes in embedded --- manifests/embedded.pp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/manifests/embedded.pp b/manifests/embedded.pp index cf4c6ae6..2c860d4d 100644 --- a/manifests/embedded.pp +++ b/manifests/embedded.pp @@ -15,20 +15,16 @@ # Specify which version of the package to install # class php::embedded( - $ensure = $::php::ensure, - $package = - "${::php::package_prefix}${::php::params::embedded_package_suffix}", - $inifile = $::php::params::embedded_inifile, - $settings = {}, + String $ensure = $::php::ensure, + String $package = "${::php::package_prefix}${::php::params::embedded_package_suffix}", + Stdlib::Absolutepath $inifile = $::php::params::embedded_inifile, + Hash $settings = {}, ) inherits ::php::params { if $caller_module_name != $module_name { warning('php::embedded is private') } - validate_absolute_path($inifile) - validate_hash($settings) - $real_settings = deep_merge( $settings, hiera_hash('php::embedded::settings', {}) From abee5c17fd95bf1990fe95904ff9dd8dad7d19fd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:32:18 +0200 Subject: [PATCH 190/221] replace validate_* with datatypes in pool --- manifests/fpm/pool.pp | 88 +++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index e3437314..e7a63ea4 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -115,48 +115,48 @@ # '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d' # define php::fpm::pool ( - $ensure = 'present', - $listen = '127.0.0.1:9000', - $listen_backlog = '-1', - $listen_allowed_clients = undef, - $listen_owner = undef, - $listen_group = undef, - $listen_mode = undef, - $user = $::php::fpm::config::user, - $group = $::php::fpm::config::group, - $pm = 'dynamic', - $pm_max_children = '50', - $pm_start_servers = '5', - $pm_min_spare_servers = '5', - $pm_max_spare_servers = '35', - $pm_max_requests = '0', - $pm_process_idle_timeout = '10s', - $pm_status_path = undef, - $ping_path = undef, - $ping_response = 'pong', - $access_log = undef, - $access_log_format = "%R - %u %t \"%m %r\" %s", - $request_terminate_timeout = '0', - $request_slowlog_timeout = '0', - $security_limit_extensions = undef, - $slowlog = "/var/log/php-fpm/${name}-slow.log", - $template = 'php/fpm/pool.conf.erb', - $rlimit_files = undef, - $rlimit_core = undef, - $chroot = undef, - $chdir = undef, - $catch_workers_output = 'no', - $include = undef, - $env = [], - $env_value = {}, - $options = {}, - $php_value = {}, - $php_flag = {}, - $php_admin_value = {}, - $php_admin_flag = {}, - $php_directives = [], - $root_group = $::php::params::root_group, - $base_dir = undef, + $ensure = 'present', + $listen = '127.0.0.1:9000', + $listen_backlog = '-1', + $listen_allowed_clients = undef, + $listen_owner = undef, + $listen_group = undef, + $listen_mode = undef, + $user = $::php::fpm::config::user, + $group = $::php::fpm::config::group, + $pm = 'dynamic', + $pm_max_children = '50', + $pm_start_servers = '5', + $pm_min_spare_servers = '5', + $pm_max_spare_servers = '35', + $pm_max_requests = '0', + $pm_process_idle_timeout = '10s', + $pm_status_path = undef, + $ping_path = undef, + $ping_response = 'pong', + $access_log = undef, + $access_log_format = "%R - %u %t \"%m %r\" %s", + $request_terminate_timeout = '0', + $request_slowlog_timeout = '0', + $security_limit_extensions = undef, + $slowlog = "/var/log/php-fpm/${name}-slow.log", + $template = 'php/fpm/pool.conf.erb', + $rlimit_files = undef, + $rlimit_core = undef, + $chroot = undef, + $chdir = undef, + $catch_workers_output = 'no', + $include = undef, + $env = [], + $env_value = {}, + $options = {}, + $php_value = {}, + $php_flag = {}, + $php_admin_value = {}, + $php_admin_flag = {}, + $php_directives = [], + $root_group = $::php::params::root_group, + Optional[Stdlib::Absolutepath] $base_dir = undef, ) { # The base class must be included first because it is used by parameter defaults @@ -164,10 +164,6 @@ warning('You must include the php base class before using any php defined resources') } - if $base_dir != undef { - validate_absolute_path($base_dir) - } - $pool = $title # Hack-ish to default to user for group too From 6f6840c1d17a8658850dae621e0f07b722d03358 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:36:21 +0200 Subject: [PATCH 191/221] replace validate_* with datatypes in config --- manifests/fpm/config.pp | 68 +++++++++++++---------------------------- 1 file changed, 22 insertions(+), 46 deletions(-) diff --git a/manifests/fpm/config.pp b/manifests/fpm/config.pp index 636706b3..69186907 100644 --- a/manifests/fpm/config.pp +++ b/manifests/fpm/config.pp @@ -71,54 +71,30 @@ # Path to fpm pid file # class php::fpm::config( - $config_file = $::php::params::fpm_config_file, - $user = $::php::params::fpm_user, - $group = $::php::params::fpm_group, - $inifile = $::php::params::fpm_inifile, - $pid_file = $::php::params::fpm_pid_file, - $settings = {}, - $pool_base_dir = $::php::params::fpm_pool_dir, - $pool_purge = false, - $error_log = $::php::params::fpm_error_log, - $log_level = 'notice', - $emergency_restart_threshold = '0', - $emergency_restart_interval = '0', - $process_control_timeout = '0', - $process_max = '0', - $rlimit_files = undef, - $systemd_interval = undef, - $log_owner = $::php::params::fpm_user, - $log_group = $::php::params::fpm_group, - $log_dir_mode = '0770', - $root_group = $::php::params::root_group, - $syslog_facility = 'daemon', - $syslog_ident = 'php-fpm', + $config_file = $::php::params::fpm_config_file, + String $user = $::php::params::fpm_user, + String $group = $::php::params::fpm_group, + String $inifile = $::php::params::fpm_inifile, + $pid_file = $::php::params::fpm_pid_file, + Hash $settings = {}, + Stdlib::Absolutepath $pool_base_dir = $::php::params::fpm_pool_dir, + $pool_purge = false, + String $error_log = $::php::params::fpm_error_log, + String $log_level = 'notice', + Integer $emergency_restart_threshold = 0, + Variant[Integer, Pattern[/^\d+[smhd]?$/]] $emergency_restart_interval = 0, + Variant[Integer, Pattern[/^\d+[smhd]?$/]] $process_control_timeout = 0, + Integer $process_max = 0, + $rlimit_files = undef, + Optional[Variant[Integer,Pattern[/^\d+[smhd]?$/]]] $systemd_interval = undef, + String $log_owner = $::php::params::fpm_user, + String $log_group = $::php::params::fpm_group, + Pattern[/^\d+$/] $log_dir_mode = '0770', + $root_group = $::php::params::root_group, + String $syslog_facility = 'daemon', + String $syslog_ident = 'php-fpm', ) inherits ::php::params { - validate_string($user) - validate_string($group) - validate_string($inifile) - validate_hash($settings) - - $number_re = '^\d+$' - $interval_re = '^\d+[smhd]?$' - - validate_absolute_path($pool_base_dir) - validate_string($error_log) - validate_string($log_level) - validate_re($emergency_restart_threshold, $number_re) - validate_re($emergency_restart_interval, $interval_re) - validate_re($process_control_timeout, $interval_re) - validate_string($log_owner) - validate_string($log_group) - validate_re($log_dir_mode, $number_re) - validate_string($syslog_facility) - validate_string($syslog_ident) - - if $systemd_interval { - validate_re($systemd_interval, $interval_re) - } - if $caller_module_name != $module_name { warning('php::fpm::config is private') } From 816466cba678fb73c45d1c5d4c2edfa3d501c80f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 11:40:09 +0200 Subject: [PATCH 192/221] replace validate_* with datatypes in init --- manifests/init.pp | 91 +++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 59 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 5b719724..81b43ec5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -107,67 +107,40 @@ # [*settings*] # class php ( - $ensure = $::php::params::ensure, - $manage_repos = $::php::params::manage_repos, - $fpm = true, - $fpm_service_enable = $::php::params::fpm_service_enable, - $fpm_service_ensure = $::php::params::fpm_service_ensure, - $fpm_service_name = $::php::params::fpm_service_name, - $fpm_service_provider = undef, - $fpm_pools = { 'www' => {} }, - $fpm_global_pool_settings = {}, - $fpm_inifile = $::php::params::fpm_inifile, - $fpm_package = undef, - $fpm_user = $::php::params::fpm_user, - $fpm_group = $::php::params::fpm_group, - $embedded = false, - $dev = true, - $composer = true, - $pear = true, - $pear_ensure = $::php::params::pear_ensure, - $phpunit = false, - $apache_config = false, - $proxy_type = undef, - $proxy_server = undef, - $extensions = {}, - $settings = {}, - $package_prefix = $::php::params::package_prefix, - $config_root_ini = $::php::params::config_root_ini, - $config_root_inifile = $::php::params::config_root_inifile, - $ext_tool_enable = $::php::params::ext_tool_enable, - $ext_tool_query = $::php::params::ext_tool_query, - $ext_tool_enabled = $::php::params::ext_tool_enabled, - $log_owner = $::php::params::fpm_user, - $log_group = $::php::params::fpm_group, + String $ensure = $::php::params::ensure, + Boolean $manage_repos = $::php::params::manage_repos, + Boolean $fpm = true, + $fpm_service_enable = $::php::params::fpm_service_enable, + $fpm_service_ensure = $::php::params::fpm_service_ensure, + $fpm_service_name = $::php::params::fpm_service_name, + $fpm_service_provider = undef, + Hash $fpm_pools = { 'www' => {} }, + Hash $fpm_global_pool_settings = {}, + $fpm_inifile = $::php::params::fpm_inifile, + $fpm_package = undef, + $fpm_user = $::php::params::fpm_user, + $fpm_group = $::php::params::fpm_group, + Boolean $embedded = false, + Boolean $dev = true, + Boolean $composer = true, + Boolean $pear = true, + String $pear_ensure = $::php::params::pear_ensure, + Boolean $phpunit = false, + Boolean $apache_config = false, + $proxy_type = undef, + $proxy_server = undef, + Hash $extensions = {}, + Hash $settings = {}, + $package_prefix = $::php::params::package_prefix, + Stdlib::Absolutepath $config_root_ini = $::php::params::config_root_ini, + Stdlib::Absolutepath $config_root_inifile = $::php::params::config_root_inifile, + Optional[Stdlib::Absolutepath] $ext_tool_enable = $::php::params::ext_tool_enable, + Optional[Stdlib::Absolutepath] $ext_tool_query = $::php::params::ext_tool_query, + Boolean $ext_tool_enabled = $::php::params::ext_tool_enabled, + String $log_owner = $::php::params::fpm_user, + String $log_group = $::php::params::fpm_group, ) inherits ::php::params { - validate_string($ensure) - validate_bool($manage_repos) - validate_bool($fpm) - validate_bool($embedded) - validate_bool($dev) - validate_bool($composer) - validate_bool($pear) - validate_bool($ext_tool_enabled) - validate_string($pear_ensure) - validate_bool($phpunit) - validate_bool($apache_config) - validate_hash($extensions) - validate_hash($settings) - validate_hash($fpm_pools) - validate_hash($fpm_global_pool_settings) - validate_string($log_owner) - validate_string($log_group) - validate_absolute_path($config_root_ini) - validate_absolute_path($config_root_inifile) - - if $ext_tool_enable != undef { - validate_absolute_path($ext_tool_enable) - } - if $ext_tool_query != undef { - validate_absolute_path($ext_tool_query) - } - $real_fpm_package = pick($fpm_package, "${package_prefix}${::php::params::fpm_package_suffix}") # Deep merge global php settings From 2241148c74db2f52fb348a08558df2eac0ff163e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 12 Jun 2017 17:56:29 +0200 Subject: [PATCH 193/221] reformat class parameter --- manifests/extension.pp | 18 +++++++++--------- manifests/extension/install.pp | 8 ++++---- manifests/packages.pp | 4 +--- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index f133b1fd..e33501be 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -53,15 +53,15 @@ # *providers*: pear, pecl. # define php::extension ( - String $ensure = 'installed', - Optional[Php::Provider] $provider = undef, - Optional[String] $source = undef, - Optional[String] $so_name = downcase($name), - Optional[String] $php_api_version = undef, - String $package_prefix = $::php::package_prefix, - Boolean $zend = false, - Hash $settings = {}, - Php::Sapi $sapi = 'ALL', + String $ensure = 'installed', + Optional[Php::Provider] $provider = undef, + Optional[String] $source = undef, + Optional[String] $so_name = downcase($name), + Optional[String] $php_api_version = undef, + String $package_prefix = $::php::package_prefix, + Boolean $zend = false, + Hash $settings = {}, + Php::Sapi $sapi = 'ALL', Variant[Boolean, String] $settings_prefix = false, Optional[Stdlib::AbsolutePath] $responsefile = undef, Variant[String, Array[String]] $header_packages = [], diff --git a/manifests/extension/install.pp b/manifests/extension/install.pp index 1fe6be40..7902a2e1 100644 --- a/manifests/extension/install.pp +++ b/manifests/extension/install.pp @@ -31,10 +31,10 @@ # *providers*: pear, pecl. # define php::extension::install ( - String $ensure = 'installed', - Optional[Php::Provider] $provider = undef, - Optional[String] $source = undef, - String $package_prefix = $::php::package_prefix, + String $ensure = 'installed', + Optional[Php::Provider] $provider = undef, + Optional[String] $source = undef, + String $package_prefix = $::php::package_prefix, Optional[Stdlib::AbsolutePath] $responsefile = undef, Variant[String, Array[String]] $header_packages = [], Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages, diff --git a/manifests/packages.pp b/manifests/packages.pp index 47f46ef5..54591927 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -15,9 +15,7 @@ class php::packages ( String $ensure = $::php::ensure, Boolean $manage_repos = $::php::manage_repos, - Array $names_to_prefix = prefix( - $::php::params::common_package_suffixes, $::php::package_prefix # lint:ignore:parameter_documentation - ), + Array $names_to_prefix = prefix($::php::params::common_package_suffixes, $::php::package_prefix), Array $names = $::php::params::common_package_names, ) inherits ::php::params { From c4f0d21de4a91752a7c2dc9ddafd8ce51055b703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Fri, 23 Jun 2017 15:07:03 +0200 Subject: [PATCH 194/221] remove example42/yum dependency fixes #354 --- manifests/repo/redhat.pp | 25 +++++++++++++++++++++++-- metadata.json | 4 ---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index 5885a593..b64bfb05 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -9,6 +9,27 @@ class php::repo::redhat ( $yum_repo = 'remi_php56', ) { - contain "::yum::repo::${yum_repo}" - contain '::yum::repo::remi' + + $releasever = $::operatingsystem ? { + /(?i:Amazon)/ => '6', + default => '$releasever', # Yum var + } + + yumrepo { 'remi': + descr => 'Remi\'s RPM repository for Enterprise Linux $releasever - $basearch', + mirrorlist => "http://rpms.remirepo.net/enterprise/${releasever}/remi/mirror", + enabled => 1, + gpgcheck => 1, + gpgkey => 'http://rpms.remirepo.net/RPM-GPG-KEY-remi', + priority => 1, + } + + yumrepo { 'remi-php56': + descr => 'Remi\'s PHP 5.6 RPM repository for Enterprise Linux $releasever - $basearch', + mirrorlist => "http://rpms.remirepo.net/enterprise/${releasever}/php56/mirror", + enabled => 1, + gpgcheck => 1, + gpgkey => 'http://rpms.remirepo.net/RPM-GPG-KEY-remi', + priority => 1, + } } diff --git a/metadata.json b/metadata.json index eb6d24e3..d17eb1d7 100644 --- a/metadata.json +++ b/metadata.json @@ -28,10 +28,6 @@ { "name": "puppet/archive", "version_requirement": ">= 1.0.0 < 2.0.0" - }, - { - "name": "example42/yum", - "version_requirement": ">= 2.1.28 < 3.0.0" } ], "requirements": [ From 817eac130f3956aba1c947e6409ee953911ceb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Thu, 29 Jun 2017 11:38:02 +0200 Subject: [PATCH 195/221] use https URLs for remirepo --- manifests/repo/redhat.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index b64bfb05..a4040a17 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -17,19 +17,19 @@ yumrepo { 'remi': descr => 'Remi\'s RPM repository for Enterprise Linux $releasever - $basearch', - mirrorlist => "http://rpms.remirepo.net/enterprise/${releasever}/remi/mirror", + mirrorlist => "https://rpms.remirepo.net/enterprise/${releasever}/remi/mirror", enabled => 1, gpgcheck => 1, - gpgkey => 'http://rpms.remirepo.net/RPM-GPG-KEY-remi', + gpgkey => 'https://rpms.remirepo.net/RPM-GPG-KEY-remi', priority => 1, } yumrepo { 'remi-php56': descr => 'Remi\'s PHP 5.6 RPM repository for Enterprise Linux $releasever - $basearch', - mirrorlist => "http://rpms.remirepo.net/enterprise/${releasever}/php56/mirror", + mirrorlist => "https://rpms.remirepo.net/enterprise/${releasever}/php56/mirror", enabled => 1, gpgcheck => 1, - gpgkey => 'http://rpms.remirepo.net/RPM-GPG-KEY-remi', + gpgkey => 'https://rpms.remirepo.net/RPM-GPG-KEY-remi', priority => 1, } } From 65f5469df1ac2df940d186ee1135fbc8be206ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Thu, 29 Jun 2017 17:09:38 +0200 Subject: [PATCH 196/221] pear/pecl: pass install_options to provider --- manifests/extension.pp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/manifests/extension.pp b/manifests/extension.pp index dda8456e..1217903b 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -71,6 +71,7 @@ $settings_prefix = false, $sapi = 'ALL', $responsefile = undef, + $install_options = undef, ) { if ! defined(Class['php']) { @@ -110,11 +111,12 @@ if $provider == 'pecl' or $provider == 'pear' { ensure_packages( [ $real_package ], { - ensure => $ensure, - provider => $provider, - source => $real_source, - responsefile => $responsefile, - require => [ + ensure => $ensure, + provider => $provider, + source => $real_source, + responsefile => $responsefile, + install_options => $install_options, + require => [ Class['::php::pear'], Class['::php::dev'], ], From 734832e78318f1b972ed07b723d63712de5c6796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= Date: Thu, 29 Jun 2017 18:10:09 +0200 Subject: [PATCH 197/221] extension: pass install_options to provider --- manifests/extension.pp | 5 +++++ manifests/extension/install.pp | 15 ++++++++++----- types/installoptions.pp | 8 ++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 types/installoptions.pp diff --git a/manifests/extension.pp b/manifests/extension.pp index e33501be..1a902b31 100644 --- a/manifests/extension.pp +++ b/manifests/extension.pp @@ -52,6 +52,9 @@ # File containing answers for interactive extension setup. Supported # *providers*: pear, pecl. # +# [*install_options*] +# Array of String or Hash options to pass to the provider. +# define php::extension ( String $ensure = 'installed', Optional[Php::Provider] $provider = undef, @@ -66,6 +69,7 @@ Optional[Stdlib::AbsolutePath] $responsefile = undef, Variant[String, Array[String]] $header_packages = [], Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages, + Php::InstallOptions $install_options = undef, ) { if ! defined(Class['php']) { @@ -80,6 +84,7 @@ package_prefix => $package_prefix, header_packages => $header_packages, compiler_packages => $compiler_packages, + install_options => $install_options, } # PEAR packages don't require any further configuration, they just need to "be there". diff --git a/manifests/extension/install.pp b/manifests/extension/install.pp index 7902a2e1..47795e00 100644 --- a/manifests/extension/install.pp +++ b/manifests/extension/install.pp @@ -30,6 +30,9 @@ # File containing answers for interactive extension setup. Supported # *providers*: pear, pecl. # +# [*install_options*] +# Array of String or Hash options to pass to the provider. +# define php::extension::install ( String $ensure = 'installed', Optional[Php::Provider] $provider = undef, @@ -38,6 +41,7 @@ Optional[Stdlib::AbsolutePath] $responsefile = undef, Variant[String, Array[String]] $header_packages = [], Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages, + Php::InstallOptions $install_options = undef, ) { if ! defined(Class['php']) { @@ -75,11 +79,12 @@ unless $provider == 'none' { package { $real_package: - ensure => $ensure, - provider => $provider, - source => $source, - responsefile => $responsefile, - require => $package_require, + ensure => $ensure, + provider => $provider, + source => $source, + responsefile => $responsefile, + install_options => $install_options, + require => $package_require, } } } diff --git a/types/installoptions.pp b/types/installoptions.pp new file mode 100644 index 00000000..b9a528dc --- /dev/null +++ b/types/installoptions.pp @@ -0,0 +1,8 @@ +type Php::InstallOptions = Optional[ + Array[ + Variant[ + String, + Hash[String, String] + ] + ] +] From 8b6a49f9e996f17e15991c4078ccb95073f63f9f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 29 Jun 2017 17:46:03 +0200 Subject: [PATCH 198/221] replace legacy facts with new $facts hash --- manifests/dev.pp | 4 ++-- manifests/embedded.pp | 2 +- manifests/extension/config.pp | 2 +- manifests/fpm.pp | 4 ++-- manifests/fpm/pool.pp | 2 +- manifests/fpm/service.pp | 2 +- manifests/globals.pp | 12 +++++----- manifests/init.pp | 4 ++-- manifests/packages.pp | 2 +- manifests/params.pp | 12 +++++----- manifests/pear.pp | 44 +++++++++++++++++++---------------- manifests/repo.pp | 6 ++--- manifests/repo/redhat.pp | 2 +- 13 files changed, 51 insertions(+), 47 deletions(-) diff --git a/manifests/dev.pp b/manifests/dev.pp index 34129afc..8c69bc79 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -18,13 +18,13 @@ } # On FreeBSD there is no 'devel' package. - $real_package = $::osfamily ? { + $real_package = $facts['os']['family'] ? { 'FreeBSD' => [], default => $package, } # Default PHP come with xml module and no seperate package for it - if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0 { + if $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16.04') >= 0 { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], diff --git a/manifests/embedded.pp b/manifests/embedded.pp index 2c860d4d..5c40ee52 100644 --- a/manifests/embedded.pp +++ b/manifests/embedded.pp @@ -30,7 +30,7 @@ hiera_hash('php::embedded::settings', {}) ) - $real_package = $::osfamily ? { + $real_package = $facts['os']['family'] ? { 'Debian' => "lib${package}", default => $package, } diff --git a/manifests/extension/config.pp b/manifests/extension/config.pp index f9e69990..1b1271e9 100644 --- a/manifests/extension/config.pp +++ b/manifests/extension/config.pp @@ -93,7 +93,7 @@ $ext_tool_query = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query) $ext_tool_enabled = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled) - if $::osfamily == 'Debian' and $ext_tool_enabled { + if $facts['os']['family'] == 'Debian' and $ext_tool_enabled { $cmd = "${ext_tool_enable} -s ${sapi} ${so_name}" $_sapi = $sapi? { diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 8ef5bc3f..99203902 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -68,7 +68,7 @@ # On FreeBSD fpm is not a separate package, but included in the 'php' package. # Implies that the option SET+=FPM was set when building the port. - $real_package = $::osfamily ? { + $real_package = $facts['os']['family'] ? { 'FreeBSD' => [], default => $package, } @@ -98,7 +98,7 @@ # Create an override to use a reload signal as trusty and utopic's # upstart version supports this - if $::operatingsystem == 'Ubuntu' and ($::operatingsystemmajrelease == '14.04' or $::operatingsystemmajrelease == '14.10') { + if $facts['os']['name'] == 'Ubuntu' and ($facts['os']['release']['major'] == '14') { if ($service_enable) { $fpm_override = 'reload signal USR2' } diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index e7a63ea4..f3eb1686 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -174,7 +174,7 @@ # On FreeBSD fpm is not a separate package, but included in the 'php' package. # Implies that the option SET+=FPM was set when building the port. - $real_package = $::osfamily ? { + $real_package = $facts['os']['name'] ? { 'FreeBSD' => [], default => $::php::fpm::package, } diff --git a/manifests/fpm/service.pp b/manifests/fpm/service.pp index 8f7d150a..e08d1e22 100644 --- a/manifests/fpm/service.pp +++ b/manifests/fpm/service.pp @@ -27,7 +27,7 @@ $reload = "service ${service_name} reload" - if $::operatingsystem == 'Ubuntu' and $::operatingsystemmajrelease == '12.04' { + if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '12' { # Precise upstart doesn't support reload signals, so use # regular service restart instead $restart = undef diff --git a/manifests/globals.pp b/manifests/globals.pp index 69b3adc8..c0c86bd7 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -17,9 +17,9 @@ Optional[Stdlib::Absolutepath] $fpm_pid_file = undef, ) { - $default_php_version = $::osfamily ? { - 'Debian' => $::operatingsystem ? { - 'Ubuntu' => $::operatingsystemrelease ? { + $default_php_version = $facts['os']['family'] ? { + 'Debian' => $facts['os']['name'] ? { + 'Ubuntu' => $facts['os']['release']['full'] ? { /^(16.04)$/ => '7.0', default => '5.x', }, @@ -30,9 +30,9 @@ $globals_php_version = pick($php_version, $default_php_version) - case $::osfamily { + case $facts['os']['family'] { 'Debian': { - if $::operatingsystem == 'Ubuntu' { + if $facts['os']['name'] == 'Ubuntu' { case $globals_php_version { /^5\.4/: { $default_config_root = '/etc/php5' @@ -112,7 +112,7 @@ $default_fpm_pid_file = '/var/run/php-fpm.pid' } default: { - fail("Unsupported osfamily: ${::osfamily}") + fail("Unsupported osfamily: ${facts['os']['family']}") } } diff --git a/manifests/init.pp b/manifests/init.pp index 81b43ec5..e6a2ec4a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -168,7 +168,7 @@ -> anchor { 'php::end': } # Configure global PHP settings in php.ini - if $::osfamily != 'Debian' { + if $facts['os']['family'] != 'Debian' { Class['php::packages'] -> class {'::php::global': settings => $real_settings, @@ -178,7 +178,7 @@ if $fpm { contain '::php::fpm' } if $embedded { - if $::osfamily == 'RedHat' and $fpm { + if $facts['os']['family'] == 'RedHat' and $fpm { # Both fpm and embeded SAPIs are using same php.ini fail('Enabling both cli and embedded sapis is not currently supported') } diff --git a/manifests/packages.pp b/manifests/packages.pp index 54591927..7c95156d 100644 --- a/manifests/packages.pp +++ b/manifests/packages.pp @@ -24,7 +24,7 @@ } $real_names = union($names, $names_to_prefix) - if $::osfamily == 'debian' { + if $facts['os']['family'] == 'debian' { if $manage_repos { include ::apt Class['::apt::update'] -> Package[$real_names] diff --git a/manifests/params.pp b/manifests/params.pp index df29edd9..a37b3473 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -14,7 +14,7 @@ $phpunit_path = '/usr/local/bin/phpunit' $phpunit_max_age = 30 - case $::osfamily { + case $facts['os']['family'] { 'Debian': { $config_root = $php::globals::globals_config_root $config_root_ini = "${config_root}/mods-available" @@ -42,9 +42,9 @@ $ext_tool_query = $php::globals::ext_tool_query $ext_tool_enabled = true - case $::operatingsystem { + case $facts['os']['name'] { 'Debian': { - $manage_repos = (versioncmp($::operatingsystemrelease, '8') < 0) + $manage_repos = (versioncmp($facts['os']['release']['major'], '8') < 0) } 'Ubuntu': { @@ -88,7 +88,7 @@ $ext_tool_enable = undef $ext_tool_query = undef $ext_tool_enabled = false - case $::operatingsystem { + case $facts['os']['name'] { 'SLES': { $compiler_packages = [] } @@ -96,7 +96,7 @@ $compiler_packages = 'devel_basis' } default: { - fail("Unsupported operating system ${::operatingsystem}") + fail("Unsupported operating system ${facts['os']['name']}") } } } @@ -158,7 +158,7 @@ $ext_tool_enabled = false } default: { - fail("Unsupported osfamily: ${::osfamily}") + fail("Unsupported osfamily: ${facts['os']['family']}") } } } diff --git a/manifests/pear.pp b/manifests/pear.pp index 68997467..e68d9dfc 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -18,30 +18,34 @@ } # Defaults for the pear package name - if $package == undef { - if $::osfamily == 'Debian' { - # Debian is a litte stupid: The pear package is called 'php-pear' - # even though others are called 'php5-fpm' or 'php5-dev' - $package_name = "php-${::php::params::pear_package_suffix}" - } elsif $::operatingsystem == 'Amazon' { - # On Amazon Linux the package name is also just 'php-pear'. - # This would normally not be problematic but if you specify a - # package_prefix other than 'php' then it will fail. - $package_name = "php-${::php::params::pear_package_suffix}" - } elsif $::osfamily == 'FreeBSD' { - # On FreeBSD the package name is just 'pear'. - $package_name = $::php::params::pear_package_suffix - } else { - # This is the default for all other architectures - $package_name = - "${::php::package_prefix}${::php::params::pear_package_suffix}" - } - } else { + if $package { $package_name = $package + } else { + case $facts['os']['family'] { + 'Debian': { + # Debian is a litte stupid: The pear package is called 'php-pear' + # even though others are called 'php5-fpm' or 'php5-dev' + $package_name = "php-${::php::params::pear_package_suffix}" + } + 'Amazon': { + # On Amazon Linux the package name is also just 'php-pear'. + # This would normally not be problematic but if you specify a + # package_prefix other than 'php' then it will fail. + $package_name = "php-${::php::params::pear_package_suffix}" + } + 'FreeBSD': { + # On FreeBSD the package name is just 'pear'. + $package_name = $::php::params::pear_package_suffix + } + default: { + # This is the default for all other architectures + $package_name = "${::php::package_prefix}${::php::params::pear_package_suffix}" + } + } } # Default PHP come with xml module and no seperate package for it - if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0 { + if $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16.04') >= 0 { ensure_packages(["${php::package_prefix}xml"], { ensure => present, require => Class['::apt::update'], diff --git a/manifests/repo.pp b/manifests/repo.pp index 004a8264..f7b8ae30 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -2,12 +2,12 @@ # class php::repo { - $msg_no_repo = "No repo available for ${::osfamily}/${::operatingsystem}" + $msg_no_repo = "No repo available for ${facts['os']['family']}/${facts['os']['name']}" - case $::osfamily { + case $facts['os']['family'] { 'Debian': { # no contain here because apt does that already - case $::operatingsystem { + case $facts['os']['family'] { 'Debian': { include ::php::repo::debian } diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index a4040a17..bd64e056 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -10,7 +10,7 @@ $yum_repo = 'remi_php56', ) { - $releasever = $::operatingsystem ? { + $releasever = $facts['os']['name'] ? { /(?i:Amazon)/ => '6', default => '$releasever', # Yum var } From d6674a1863d6dd9bdd3af799d7a81208ef9a0b4e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 29 Jun 2017 17:53:38 +0200 Subject: [PATCH 199/221] add initial archlinux support --- manifests/globals.pp | 4 ++++ manifests/params.pp | 27 +++++++++++++++++++++++++++ metadata.json | 3 +++ spec/classes/php_spec.rb | 4 ++++ spec/defines/extension_spec.rb | 2 ++ 5 files changed, 40 insertions(+) diff --git a/manifests/globals.pp b/manifests/globals.pp index c0c86bd7..47ede5db 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -111,6 +111,10 @@ $default_config_root = '/usr/local/etc' $default_fpm_pid_file = '/var/run/php-fpm.pid' } + 'Archlinux': { + $default_config_root = '/etc/php' + $default_fpm_pid_file = '/run/php-fpm/php-fpm.pid' + } default: { fail("Unsupported osfamily: ${facts['os']['family']}") } diff --git a/manifests/params.pp b/manifests/params.pp index a37b3473..a6de99b2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -157,6 +157,33 @@ $ext_tool_query = undef $ext_tool_enabled = false } + 'Archlinux': { + $config_root_ini = '/etc/php/conf.d' + $config_root_inifile = '/etc/php/php.ini' + $common_package_names = [] + $common_package_suffixes = ['cli', 'common'] + $cli_inifile = '/etc/php/php.ini' + $dev_package_suffix = undef + $fpm_pid_file = '/run/php-fpm/php-fpm.pid' + $fpm_config_file = '/etc/php/php-fpm.conf' + $fpm_error_log = '/var/log/php-fpm/error.log' + $fpm_inifile = '/etc/php/php.ini' + $fpm_package_suffix = 'fpm' + $fpm_pool_dir = '/etc/php/php-fpm.d' + $fpm_service_name = 'php-fpm' + $fpm_user = 'root' + $fpm_group = 'root' + $apache_inifile = '/etc/php/php.ini' + $embedded_package_suffix = 'embedded' + $embedded_inifile = '/etc/php/php.ini' + $package_prefix = 'php-' + $compiler_packages = ['gcc', 'make'] + $manage_repos = false + $root_group = 'root' + $ext_tool_enable = undef + $ext_tool_query = undef + $ext_tool_enabled = false + } default: { fail("Unsupported osfamily: ${facts['os']['family']}") } diff --git a/metadata.json b/metadata.json index d17eb1d7..e5578b60 100644 --- a/metadata.json +++ b/metadata.json @@ -80,6 +80,9 @@ }, { "operatingsystem": "OpenSUSE" + }, + { + "operatingsystem": "Archlinux" } ] } diff --git a/spec/classes/php_spec.rb b/spec/classes/php_spec.rb index b8026daa..cf024ef7 100644 --- a/spec/classes/php_spec.rb +++ b/spec/classes/php_spec.rb @@ -60,6 +60,8 @@ dstfile = case facts[:osfamily] when 'Debian' '/etc/php5/fpm/pool.d/www.conf' + when 'Archlinux' + '/etc/php/php-fpm.d/www.conf' when 'Suse' '/etc/php5/fpm/pool.d/www.conf' when 'RedHat' @@ -78,6 +80,8 @@ dstfile = case facts[:osfamily] when 'Debian' '/etc/php5/fpm/pool.d/www.conf' + when 'Archlinux' + '/etc/php/php-fpm.d/www.conf' when 'Suse' '/etc/php5/fpm/pool.d/www.conf' when 'RedHat' diff --git a/spec/defines/extension_spec.rb b/spec/defines/extension_spec.rb index 87c7674e..e7164259 100644 --- a/spec/defines/extension_spec.rb +++ b/spec/defines/extension_spec.rb @@ -13,6 +13,8 @@ etcdir = case facts[:osfamily] when 'Debian' '/etc/php5/mods-available' + when 'Archlinux' + '/etc/php/conf.d' else '/etc/php.d' end From ad4c8081e37f4cef5e1e4d7d3eabb3d723fb9161 Mon Sep 17 00:00:00 2001 From: Luca Lesinigo Date: Tue, 4 Jul 2017 12:41:03 +0200 Subject: [PATCH 200/221] fix default value of php::fpm::pool::access_log_format --- manifests/fpm/pool.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp index f3eb1686..3f092bbe 100644 --- a/manifests/fpm/pool.pp +++ b/manifests/fpm/pool.pp @@ -135,7 +135,7 @@ $ping_path = undef, $ping_response = 'pong', $access_log = undef, - $access_log_format = "%R - %u %t \"%m %r\" %s", + $access_log_format = '"%R - %u %t \"%m %r\" %s"', $request_terminate_timeout = '0', $request_slowlog_timeout = '0', $security_limit_extensions = undef, From 1c801de8a245c796dc494284115a338b4d07afa2 Mon Sep 17 00:00:00 2001 From: Chadwick Banning Date: Thu, 13 Jul 2017 09:51:55 -0400 Subject: [PATCH 201/221] Confine pecl provider to where pear command is available --- lib/puppet/provider/package/pecl.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/puppet/provider/package/pecl.rb b/lib/puppet/provider/package/pecl.rb index 562656ed..442aa45f 100644 --- a/lib/puppet/provider/package/pecl.rb +++ b/lib/puppet/provider/package/pecl.rb @@ -7,6 +7,8 @@ has_feature :upgradeable has_feature :install_options + commands pear: 'pear' + def self.instances pear_packages = super From 7030901d1ac1ec73d9883630cc6e7cdaba6f105c Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 2 Aug 2017 10:52:22 -0700 Subject: [PATCH 202/221] Release 5.0.0 --- CHANGELOG.md | 33 ++++++++++++++++++++++++++++++++- metadata.json | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00266e8..4133d563 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,35 @@ # Changelog -## 2017-02-11 Release 4.0.0 +## 2017-08-02 Release [5.0.0] +### Summary +This backwards-incompatible release drops puppet 3, PHP 5.5 on Ubuntu, and the deprecated `php::extension` parameter `pecl_source`. It improves much of the internal code quality, and adds several useful features the most interesting of which is probably the `php::extension` parameter `ini_prefix`. + +### Changed +- Drop puppet 3 compatibility. +- Bumped puppetlabs-apt lower bound to 4.1.0 +- Bumped puppetlabs-stdlib lower bound to 4.13.1 + +### Removed +- Deprecated `php::extension` define parameters `pecl_source`. Use `source` instead. +- PHP 5.5 support on ubuntu. + +### Added +- `php` class parameters `fpm_user` and `fpm_group` to customize php-fpm user/group. +- `php::fpm` class parameters `user` and `group`. +- `php::fpm::pool` define parameter `pm_process_idle_timeout` and pool.conf `pm.process_idle_timeout` directive. +- `php::extension` class parameters `ini_prefix` and `install_options`. +- Archlinux compatibility. +- Bumped puppetlabs-apt upper bound to 5.0.0 + +### Fixed +- Replaced validate functions with data types. +- Linting issues. +- Replace legacy facts with facts hash. +- Simplify `php::extension` +- Only apt dependency when `manage_repos => true` +- No more example42/yum dependency + +## 2017-02-11 Release [4.0.0] This is the last release with Puppet3 support! * Fix a bug turning `manage_repos` off on wheezy @@ -191,3 +220,5 @@ This is the last release with Puppet3 support! ## 1.0.0 Initial release +[4.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v4.0.0...v4.1.0 +[4.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v3.4.2...v4.0.0 diff --git a/metadata.json b/metadata.json index e5578b60..e865f6ef 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "5.0.0-rc0", + "version": "5.0.0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From 3c507e3a0ae7f2b880917097f35d1be0dbc56a7e Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Thu, 10 Aug 2017 11:21:02 -0500 Subject: [PATCH 203/221] Fix facts usage when selecting repo class This fixes a bug introduced in #357 where Debian repositories were being selected on Ubuntu. --- manifests/repo.pp | 2 +- spec/classes/php_repo_spec.rb | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 spec/classes/php_repo_spec.rb diff --git a/manifests/repo.pp b/manifests/repo.pp index f7b8ae30..b02e65ae 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -7,7 +7,7 @@ case $facts['os']['family'] { 'Debian': { # no contain here because apt does that already - case $facts['os']['family'] { + case $facts['os']['name'] { 'Debian': { include ::php::repo::debian } diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb new file mode 100644 index 00000000..f10ad8c0 --- /dev/null +++ b/spec/classes/php_repo_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe 'php::repo', type: :class do + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + + describe 'when configuring a package repo' do + case facts[:osfamily] + when 'Debian' + case facts[:operatingsystem] + when 'Debian' + it { is_expected.to contain_class('php::repo::debian') } + when 'Ubuntu' + it { is_expected.to contain_class('php::repo::ubuntu') } + end + when 'Suse' + it { is_expected.to contain_class('php::repo::suse') } + when 'RedHat' + it { is_expected.to contain_class('php::repo::redhat') } + end + end + + end + end +end From 3c598fb5a53567c90bddcc147cad1206bac338a6 Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Thu, 10 Aug 2017 13:03:06 -0500 Subject: [PATCH 204/221] Fix Rubocop EmptyLinesAroundBlockBody error --- spec/classes/php_repo_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb index f10ad8c0..79429fcc 100644 --- a/spec/classes/php_repo_spec.rb +++ b/spec/classes/php_repo_spec.rb @@ -22,7 +22,6 @@ it { is_expected.to contain_class('php::repo::redhat') } end end - end end end From 192fd218244682f2c48fac0102b07bd5b664bc42 Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Thu, 10 Aug 2017 13:24:25 -0500 Subject: [PATCH 205/221] Fix OS fact comparison for Ubuntu 12 and 14 This change uses `versioncmp` instead of an equality operator when comparing Ubuntu OS facts for more compatibility between various facter versions, and Ubuntu system versions. Also, `$facts['os']['release']['major']` was changed to `$facts['os']['release']['full']` to be more consistent with other version comparisons in this module. --- manifests/fpm.pp | 4 +++- manifests/fpm/service.pp | 4 +++- spec/classes/php_fpm_service_spec.rb | 34 ++++++++++++++++++++++++++++ spec/classes/php_fpm_spec.rb | 7 ++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 spec/classes/php_fpm_service_spec.rb diff --git a/manifests/fpm.pp b/manifests/fpm.pp index 99203902..7df16cae 100644 --- a/manifests/fpm.pp +++ b/manifests/fpm.pp @@ -98,7 +98,9 @@ # Create an override to use a reload signal as trusty and utopic's # upstart version supports this - if $facts['os']['name'] == 'Ubuntu' and ($facts['os']['release']['major'] == '14') { + 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' } diff --git a/manifests/fpm/service.pp b/manifests/fpm/service.pp index e08d1e22..d9748a4d 100644 --- a/manifests/fpm/service.pp +++ b/manifests/fpm/service.pp @@ -27,7 +27,9 @@ $reload = "service ${service_name} reload" - if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '12' { + 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 diff --git a/spec/classes/php_fpm_service_spec.rb b/spec/classes/php_fpm_service_spec.rb new file mode 100644 index 00000000..1bc45d74 --- /dev/null +++ b/spec/classes/php_fpm_service_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +describe 'php::fpm::service', type: :class do + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + + let(:pre_condition) { 'class {"php": fpm => true}' } + + describe 'when called with no parameters' do + # rubocop:disable RSpec/RepeatedExample + case facts[:osfamily] + when 'Debian' + it { is_expected.to contain_service('php5-fpm').with_ensure('running') } + if facts[:operatingsystem] == 'Ubuntu' + if facts[:operatingsystemrelease] == '12.04' + it { is_expected.to contain_service('php5-fpm').without_restart } + else + it { is_expected.to contain_service('php5-fpm').with_restart('service php5-fpm reload') } + end + end + when 'Suse' + it { is_expected.to contain_service('php-fpm').with_ensure('running') } + when 'FreeBSD' + it { is_expected.to contain_service('php-fpm').with_ensure('running') } + else + it { is_expected.to contain_service('php-fpm').with_ensure('running') } + end + end + end + end +end diff --git a/spec/classes/php_fpm_spec.rb b/spec/classes/php_fpm_spec.rb index e9682f9c..37737eb3 100644 --- a/spec/classes/php_fpm_spec.rb +++ b/spec/classes/php_fpm_spec.rb @@ -14,6 +14,13 @@ when 'Debian' it { is_expected.to contain_package('php5-fpm').with_ensure('present') } it { is_expected.to contain_service('php5-fpm').with_ensure('running') } + if facts[:operatingsystem] == 'Ubuntu' + if facts[:operatingsystemrelease] == '14.04' + it { is_expected.to contain_file('/etc/init/php5-fpm.override').with_content('reload signal USR2') } + else + it { is_expected.to contain_file('/etc/init/php5-fpm.override').with_content("reload signal USR2\nmanual") } + end + end when 'Suse' it { is_expected.to contain_package('php5-fpm').with_ensure('present') } it { is_expected.to contain_service('php-fpm').with_ensure('running') } From 4fdc9a223f2a72634e3e46d2aaa8178c55862a0f Mon Sep 17 00:00:00 2001 From: Leo Antunes Date: Mon, 4 Sep 2017 11:59:04 +0200 Subject: [PATCH 206/221] bump dep on puppet/archive to '< 3.0.0' --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e865f6ef..6b6aa597 100644 --- a/metadata.json +++ b/metadata.json @@ -27,7 +27,7 @@ }, { "name": "puppet/archive", - "version_requirement": ">= 1.0.0 < 2.0.0" + "version_requirement": ">= 1.0.0 < 3.0.0" } ], "requirements": [ From 5e913313778f447151cff29fae42bd013fad670f Mon Sep 17 00:00:00 2001 From: David Hollinger Date: Fri, 8 Sep 2017 10:01:21 -0500 Subject: [PATCH 207/221] Bump metadata.json version to 5.0.1-rc --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 6b6aa597..f1b6e17e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "5.0.0", + "version": "5.0.1-rc", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From 5b921986d7f6c0d4fcdd3f2566c5aff95319484c Mon Sep 17 00:00:00 2001 From: Michael Moll Date: Wed, 13 Sep 2017 11:25:35 +0200 Subject: [PATCH 208/221] update dependencies in metadata --- metadata.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata.json b/metadata.json index f1b6e17e..ec12ba98 100644 --- a/metadata.json +++ b/metadata.json @@ -19,11 +19,11 @@ }, { "name": "puppetlabs/inifile", - "version_requirement": ">= 1.4.1 < 2.0.0" + "version_requirement": ">= 1.4.1 < 3.0.0" }, { - "name": "darin/zypprepo", - "version_requirement": ">= 1.0.2 < 2.0.0" + "name": "puppet/zypprepo", + "version_requirement": ">= 2.0.0 < 3.0.0" }, { "name": "puppet/archive", From 93a316e09e9b7cc73f8df363d42ac014bef0308d Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 26 Sep 2017 15:40:54 +0100 Subject: [PATCH 209/221] Fix syntax issues with data types --- types/provider.pp | 2 +- types/sapi.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/provider.pp b/types/provider.pp index 14af0a08..e8b04d9c 100644 --- a/types/provider.pp +++ b/types/provider.pp @@ -24,5 +24,5 @@ 'freebsd', 'pkgng', 'ports', - 'portupgrade', + 'portupgrade' # lint:ignore:trailing_comma ] diff --git a/types/sapi.pp b/types/sapi.pp index 5ee11bc7..1e96df46 100644 --- a/types/sapi.pp +++ b/types/sapi.pp @@ -2,5 +2,5 @@ 'ALL', 'cli', 'fpm', - 'apache2', + 'apache2' # lint:ignore:trailing_comma ] From 18c1fc9026892c010c7350f0a6db40b0a6fb959e Mon Sep 17 00:00:00 2001 From: William Yardley Date: Thu, 28 Sep 2017 11:32:27 -0700 Subject: [PATCH 210/221] Similar change to https://github.com/voxpupuli/puppet-nodejs/pull/318 --- spec/unit/provider/package/pear_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/unit/provider/package/pear_spec.rb b/spec/unit/provider/package/pear_spec.rb index d5b2a6c9..fc36a095 100644 --- a/spec/unit/provider/package/pear_spec.rb +++ b/spec/unit/provider/package/pear_spec.rb @@ -6,11 +6,14 @@ end let(:provider) do - described_class.new(resource) + provider = described_class.new(resource) + provider.resource = resource + provider end before do described_class.stubs(:command).with(:pear).returns '/fake/pear' + resource.provider = provider end describe '.instances' do From c37526e1d215c51dba944f8e817da80f98569893 Mon Sep 17 00:00:00 2001 From: Andreas Rudat Date: Sun, 24 Sep 2017 18:34:44 +0200 Subject: [PATCH 211/221] fixed ubuntu version for php7 --- manifests/globals.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index 9d003940..b4552689 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -20,7 +20,7 @@ $default_php_version = $facts['os']['family'] ? { 'Debian' => $facts['os']['name'] ? { 'Ubuntu' => $facts['os']['release']['full'] ? { - /^(16.04)$/ => '7.0', + /^(1[67].04)$/ => '7.0', default => '5.x', }, default => '5.x', From 57e52b5caf02d9c23d80bf6f5e12eb4a96cb8539 Mon Sep 17 00:00:00 2001 From: David Hollinger Date: Fri, 15 Sep 2017 16:31:25 -0500 Subject: [PATCH 212/221] modulesync 2017-09-15 --- .msync.yml | 2 +- .rubocop.yml | 77 +++++++++---------- .travis.yml | 12 +-- Gemfile | 13 ++-- Rakefile | 7 +- .../nodesets/docker/ubuntu-14.04.yml | 2 +- .../nodesets/docker/ubuntu-16.04.yml | 2 +- 7 files changed, 53 insertions(+), 62 deletions(-) diff --git a/.msync.yml b/.msync.yml index 4abde220..0a4a57db 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.21.3' +modulesync_config_version: '1.1.0' diff --git a/.rubocop.yml b/.rubocop.yml index d92e4e45..b1a95213 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -51,7 +51,7 @@ Lint/AmbiguousOperator: Lint/AssignmentInCondition: Enabled: True -Style/SpaceBeforeComment: +Layout/SpaceBeforeComment: Enabled: True Style/AndOr: @@ -119,7 +119,7 @@ Lint/UselessAssignment: Lint/Void: Enabled: True -Style/AccessModifierIndentation: +Layout/AccessModifierIndentation: Enabled: True Style/AccessorMethodName: @@ -128,13 +128,13 @@ Style/AccessorMethodName: Style/Alias: Enabled: True -Style/AlignArray: +Layout/AlignArray: Enabled: True -Style/AlignHash: +Layout/AlignHash: Enabled: True -Style/AlignParameters: +Layout/AlignParameters: Enabled: True Metrics/BlockNesting: @@ -152,7 +152,7 @@ Style/BracesAroundHashParameters: Style/CaseEquality: Enabled: True -Style/CaseIndentation: +Layout/CaseIndentation: Enabled: True Style/CharacterLiteral: @@ -186,64 +186,64 @@ Style/WordArray: Style/UnneededPercentQ: Enabled: True -Style/Tab: +Layout/Tab: Enabled: True -Style/SpaceBeforeSemicolon: +Layout/SpaceBeforeSemicolon: Enabled: True -Style/TrailingBlankLines: +Layout/TrailingBlankLines: Enabled: True -Style/SpaceInsideBlockBraces: +Layout/SpaceInsideBlockBraces: Enabled: True -Style/SpaceInsideBrackets: +Layout/SpaceInsideBrackets: Enabled: True -Style/SpaceInsideHashLiteralBraces: +Layout/SpaceInsideHashLiteralBraces: Enabled: True -Style/SpaceInsideParens: +Layout/SpaceInsideParens: Enabled: True -Style/LeadingCommentSpace: +Layout/LeadingCommentSpace: Enabled: True -Style/SpaceBeforeFirstArg: +Layout/SpaceBeforeFirstArg: Enabled: True -Style/SpaceAfterColon: +Layout/SpaceAfterColon: Enabled: True -Style/SpaceAfterComma: +Layout/SpaceAfterComma: Enabled: True -Style/SpaceAfterMethodName: +Layout/SpaceAfterMethodName: Enabled: True -Style/SpaceAfterNot: +Layout/SpaceAfterNot: Enabled: True -Style/SpaceAfterSemicolon: +Layout/SpaceAfterSemicolon: Enabled: True -Style/SpaceAroundEqualsInParameterDefault: +Layout/SpaceAroundEqualsInParameterDefault: Enabled: True -Style/SpaceAroundOperators: +Layout/SpaceAroundOperators: Enabled: True -Style/SpaceBeforeBlockBraces: +Layout/SpaceBeforeBlockBraces: Enabled: True -Style/SpaceBeforeComma: +Layout/SpaceBeforeComma: Enabled: True Style/CollectionMethods: Enabled: True -Style/CommentIndentation: +Layout/CommentIndentation: Enabled: True Style/ColonMethodCall: @@ -268,7 +268,7 @@ Style/DefWithParentheses: Style/PreferredHashMethods: Enabled: True -Style/DotPosition: +Layout/DotPosition: EnforcedStyle: trailing Style/DoubleNegation: @@ -277,25 +277,25 @@ Style/DoubleNegation: Style/EachWithObject: Enabled: True -Style/EmptyLineBetweenDefs: +Layout/EmptyLineBetweenDefs: Enabled: True -Style/IndentArray: +Layout/IndentArray: Enabled: True -Style/IndentHash: +Layout/IndentHash: Enabled: True -Style/IndentationConsistency: +Layout/IndentationConsistency: Enabled: True -Style/IndentationWidth: +Layout/IndentationWidth: Enabled: True -Style/EmptyLines: +Layout/EmptyLines: Enabled: True -Style/EmptyLinesAroundAccessModifier: +Layout/EmptyLinesAroundAccessModifier: Enabled: True Style/EmptyLiteral: @@ -314,7 +314,7 @@ Style/MethodDefParentheses: Style/LineEndConcatenation: Enabled: True -Style/TrailingWhitespace: +Layout/TrailingWhitespace: Enabled: True Style/StringLiterals: @@ -466,9 +466,6 @@ Metrics/ParameterLists: Lint/RequireParentheses: Enabled: True -Style/SpaceBeforeFirstArg: - Enabled: True - Style/ModuleFunction: Enabled: True @@ -484,7 +481,7 @@ Style/Encoding: Style/BlockDelimiters: Enabled: True -Style/MultilineBlockLayout: +Layout/MultilineBlockLayout: Enabled: True # 'Complexity' is very relative @@ -498,7 +495,7 @@ Metrics/PerceivedComplexity: Lint/UselessAssignment: Enabled: True -Style/ClosingParenthesisIndentation: +Layout/ClosingParenthesisIndentation: Enabled: True # RSpec @@ -527,7 +524,7 @@ RSpec/NestedGroups: Enabled: False # this is broken on ruby1.9 -Style/IndentHeredoc: +Layout/IndentHeredoc: Enabled: False # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs diff --git a/.travis.yml b/.travis.yml index 80042856..500ac95a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,21 +18,15 @@ matrix: - rvm: 2.1.9 bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.2.7 - bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.4 - bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=test - rvm: 2.4.1 bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=test + env: PUPPET_VERSION="~> 5.0" CHECK=test - rvm: 2.4.1 bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=rubocop + env: PUPPET_VERSION="~> 5.0" CHECK=rubocop - rvm: 2.4.1 bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes + env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: - master diff --git a/Gemfile b/Gemfile index 0914f7cb..9d5df205 100644 --- a/Gemfile +++ b/Gemfile @@ -11,11 +11,10 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.1.1', :require => false + gem 'puppetlabs_spec_helper', '~> 2.2.0', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false - gem 'puppet-lint-absolute_classname-check', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false gem 'puppet-lint-version_comparison-check', :require => false @@ -24,10 +23,10 @@ group :test do gem 'puppet-lint-variable_contains_upcase', :require => false gem 'metadata-json-lint', :require => false gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '~> 1.0', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.48.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false @@ -42,7 +41,7 @@ group :development do gem 'travis', :require => false gem 'travis-lint', :require => false gem 'guard-rake', :require => false - gem 'overcommit', '~> 0.39.1', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do @@ -63,10 +62,10 @@ end if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else - gem 'facter', :require => false, :groups => [:test] +gem 'facter', :require => false, :groups => [:test] end -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 82c89608..ab9411ba 100644 --- a/Rakefile +++ b/Rakefile @@ -35,9 +35,10 @@ begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = (Blacksmith::Modulefile.new).version - config.future_release = "v#{version}" - config.header = "# Change log\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not impact the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix modulesync} + config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' end rescue LoadError end diff --git a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml index 54d5e5a5..ae453044 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml +++ b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml @@ -12,7 +12,7 @@ HOSTS: docker_image_commands: - 'rm /usr/sbin/policy-rc.d' - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' - - 'apt-get install -y net-tools wget' + - 'apt-get install -y net-tools wget apt-transport-https' - 'locale-gen en_US.UTF-8' CONFIG: trace_limit: 200 diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml index bac2d5b3..2d173c5b 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml +++ b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -10,7 +10,7 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'apt-get install -y net-tools wget locales' + - 'apt-get install -y net-tools wget locales apt-transport-https' - 'locale-gen en_US.UTF-8' CONFIG: trace_limit: 200 From d2d8a6495179b928bff05b91ad8806fdc3a8732a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 10 Nov 2017 22:35:02 +0100 Subject: [PATCH 213/221] modulesync 1.4.1 --- .github/CONTRIBUTING.md | 29 ++++++++++++-------- .msync.yml | 2 +- .rubocop.yml | 13 +++++++++ .travis.yml | 21 ++++++++------ Gemfile | 20 +++++++++----- Rakefile | 26 ++++++++++++++++-- spec/acceptance/nodesets/docker/debian-7.yml | 1 - spec/acceptance/nodesets/docker/debian-8.yml | 1 - spec/acceptance/nodesets/docker/debian-9.yml | 20 ++++++++++++++ spec/spec_helper.rb | 3 +- 10 files changed, 101 insertions(+), 35 deletions(-) create mode 100644 spec/acceptance/nodesets/docker/debian-9.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 602f324b..7a0980a9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ This module has grown over time based on a range of contributions from people using it. If you follow these contributing guidelines your patch -will likely make it into a release a little quicker. +will likely make it into a release a little more quickly. ## Contributing @@ -65,6 +65,10 @@ add tests if you're adding new functionality. If you've not used [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask about how best to test your new feature. +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + To run your all the unit tests bundle exec rake spec SPEC_OPTS='--format documentation' @@ -73,10 +77,6 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb -To run the linter, the syntax checker and the unit tests: - - bundle exec rake test - ## Integration tests The unit tests just check the code runs, not that it does exactly what @@ -89,15 +89,20 @@ with: bundle exec rake acceptance -This will run the tests on an Ubuntu 12.04 virtual machine. You can also -run the integration tests against Centos 6.6 with. +This will run the tests on the module's default nodeset. You can override the +nodeset used, e.g., + + BEAKER_set=centos-7-x64 bundle exec rake acceptance + +There are default rake tasks for the various acceptance test modules, e.g., - BEAKER_set=centos-66-x64 bundle exec rake acceptances + bundle exec rake beaker:centos-7-x64 + bundle exec rake beaker:ssh:centos-7-x64 -If you don't want to have to recreate the virtual machine every time you -can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will -at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile -for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. +If you don't want to have to recreate the virtual machine every time you can +use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at +least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the +created virtual machines will be in `.vagrant/beaker_vagrant_files`. The easiest way to debug in a docker container is to open a shell: diff --git a/.msync.yml b/.msync.yml index 0a4a57db..02208380 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.1.0' +modulesync_config_version: '1.4.1' diff --git a/.rubocop.yml b/.rubocop.yml index b1a95213..3fc819bf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,6 +12,7 @@ AllCops: - Gemfile - Rakefile - Guardfile + - Vagrantfile Lint/ConditionPosition: Enabled: True @@ -45,6 +46,9 @@ Style/HashSyntax: Style/RedundantReturn: Enabled: True +Style/EndOfLine: + Enabled: False + Lint/AmbiguousOperator: Enabled: True @@ -530,3 +534,12 @@ Layout/IndentHeredoc: # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs Security/YAMLLoad: Enabled: false + +# This affects hiera interpolation, as well as some configs that we push. +Style/FormatStringToken: + Enabled: false + +# This is useful, but sometimes a little too picky about where unit tests files +# are located. +RSpec/FilePath: + Enabled: false diff --git a/.travis.yml b/.travis.yml index 500ac95a..de90e090 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,16 +16,16 @@ matrix: fast_finish: true include: - rvm: 2.1.9 - bundler_args: --without system_tests development + bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.1 - bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.4.1 - bundler_args: --without system_tests development + - rvm: 2.4.2 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls + - rvm: 2.4.2 + bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=rubocop - - rvm: 2.4.1 - bundler_args: --without system_tests development + - rvm: 2.4.2 + bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: @@ -33,6 +33,11 @@ branches: - /^v\d/ notifications: email: false + irc: + on_success: always + on_failure: always + channels: + - "chat.freenode.org#voxpupuli-notifications" deploy: provider: puppetforge user: puppet diff --git a/Gemfile b/Gemfile index 9d5df205..83d63b43 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.2.0', :require => false + gem 'puppetlabs_spec_helper', '~> 2.4.0', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -22,18 +22,13 @@ group :test do gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false gem 'metadata-json-lint', :require => false - gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' - gem 'puppet-strings', '~> 1.0', :require => false gem 'redcarpet', :require => false gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2' gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' gem 'parallel_tests', :require => false end @@ -45,8 +40,11 @@ group :development do end group :system_tests do + gem 'winrm', :require => false if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) + else + gem 'beaker', '>= 3.9.0', :require => false end if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] gem 'beaker-rspec', *location_for(beaker_rspec_version) @@ -55,6 +53,14 @@ group :system_tests do end gem 'serverspec', :require => false gem 'beaker-puppet_install_helper', :require => false + gem 'beaker-module_install_helper', :require => false +end + +group :release do + gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' + gem 'puppet-blacksmith', :require => false + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' + gem 'puppet-strings', '~> 1.0', :require => false end @@ -62,7 +68,7 @@ end if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else -gem 'facter', :require => false, :groups => [:test] + gem 'facter', :require => false, :groups => [:test] end ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s diff --git a/Rakefile b/Rakefile index ab9411ba..14ccf58b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,13 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet_blacksmith/rake_tasks' -require 'voxpupuli/release/rake_tasks' -require 'puppet-strings/tasks' + +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'puppet_blacksmith/rake_tasks' + require 'voxpupuli/release/rake_tasks' + require 'puppet-strings/tasks' +rescue LoadError +end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' PuppetLint.configuration.fail_on_warnings = true @@ -31,6 +37,17 @@ task test: [ :release_checks, ] +desc "Run main 'test' task and report merged results to coveralls" +task test_with_coveralls: [:test] do + if Dir.exist?(File.expand_path('../lib', __FILE__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end +end + begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| @@ -39,6 +56,9 @@ begin config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' + metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') + metadata = JSON.load(File.read(metadata_json)) + config.project = metadata['name'] end rescue LoadError end diff --git a/spec/acceptance/nodesets/docker/debian-7.yml b/spec/acceptance/nodesets/docker/debian-7.yml index 071acbf9..41b284d3 100644 --- a/spec/acceptance/nodesets/docker/debian-7.yml +++ b/spec/acceptance/nodesets/docker/debian-7.yml @@ -10,7 +10,6 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'echo deb http://ftp.debian.org/debian wheezy-backports main >> /etc/apt/sources.list' - 'apt-get update && apt-get install -y cron locales-all net-tools wget' CONFIG: trace_limit: 200 diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml index 7a1f35c3..a630b7ef 100644 --- a/spec/acceptance/nodesets/docker/debian-8.yml +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -10,7 +10,6 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list' - 'apt-get update && apt-get install -y cron locales-all net-tools wget' - 'rm -f /usr/sbin/policy-rc.d' - 'systemctl mask getty@tty1.service getty-static.service' diff --git a/spec/acceptance/nodesets/docker/debian-9.yml b/spec/acceptance/nodesets/docker/debian-9.yml new file mode 100644 index 00000000..dfc8e9c0 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-9.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/theforeman/foreman-installer-modulesync +HOSTS: + debian-9-x64: + platform: debian-9-amd64 + hypervisor: docker + image: debian:9 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv' + - 'rm -f /usr/sbin/policy-rc.d' + - 'systemctl mask getty@tty1.service getty-static.service' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2aa9da74..cdd49359 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,8 +8,7 @@ require 'simplecov-console' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console, - Coveralls::SimpleCov::Formatter + SimpleCov::Formatter::Console ] SimpleCov.start do track_files 'lib/**/*.rb' From 8029d680afe597e8216c3bb9546d03aba0353103 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Nov 2017 00:09:06 +0100 Subject: [PATCH 214/221] generate docs --- docs/Puppet/Parser/Functions.html | 105 ++ docs/_index.html | 369 +++++++ docs/css/common.css | 8 + docs/css/full_list.css | 58 ++ docs/css/style.css | 492 +++++++++ docs/file.README.html | 340 +++++++ docs/frames.html | 17 + docs/index.html | 340 +++++++ docs/js/app.js | 248 +++++ docs/js/full_list.js | 216 ++++ docs/js/jquery.js | 4 + docs/puppet_class_list.html | 209 ++++ docs/puppet_classes/php.html | 906 +++++++++++++++++ .../php_3A_3Aapache_config.html | 182 ++++ docs/puppet_classes/php_3A_3Acli.html | 182 ++++ docs/puppet_classes/php_3A_3Acomposer.html | 302 ++++++ .../php_3A_3Acomposer_3A_3Aauto_update.html | 246 +++++ docs/puppet_classes/php_3A_3Adev.html | 216 ++++ docs/puppet_classes/php_3A_3Aembedded.html | 244 +++++ docs/puppet_classes/php_3A_3Afpm.html | 482 +++++++++ .../php_3A_3Afpm_3A_3Aconfig.html | 596 +++++++++++ .../php_3A_3Afpm_3A_3Aservice.html | 245 +++++ docs/puppet_classes/php_3A_3Aglobal.html | 175 ++++ docs/puppet_classes/php_3A_3Aglobals.html | 384 +++++++ docs/puppet_classes/php_3A_3Apackages.html | 232 +++++ docs/puppet_classes/php_3A_3Aparams.html | 490 +++++++++ docs/puppet_classes/php_3A_3Apear.html | 258 +++++ docs/puppet_classes/php_3A_3Aphpunit.html | 248 +++++ .../php_3A_3Aphpunit_3A_3Aauto_update.html | 189 ++++ docs/puppet_classes/php_3A_3Arepo.html | 169 ++++ .../php_3A_3Arepo_3A_3Adebian.html | 312 ++++++ .../php_3A_3Arepo_3A_3Aredhat.html | 177 ++++ .../php_3A_3Arepo_3A_3Asuse.html | 175 ++++ .../php_3A_3Arepo_3A_3Aubuntu.html | 177 ++++ docs/puppet_defined_type_list.html | 104 ++ .../php_3A_3Aapache_vhost.html | 223 +++++ .../puppet_defined_types/php_3A_3Aconfig.html | 174 ++++ .../php_3A_3Aconfig_3A_3Asetting.html | 226 +++++ .../php_3A_3Aextension.html | 460 +++++++++ .../php_3A_3Aextension_3A_3Aconfig.html | 418 ++++++++ .../php_3A_3Aextension_3A_3Ainstall.html | 356 +++++++ .../php_3A_3Afpm_3A_3Apool.html | 935 ++++++++++++++++++ docs/puppet_function_list.html | 71 ++ .../ensure_prefix.html | 259 +++++ .../to_hash_settings.html | 224 +++++ docs/puppet_provider_list.html | 71 ++ docs/puppet_providers_package/pear.html | 129 +++ docs/puppet_providers_package/pecl.html | 129 +++ docs/top-level-namespace.html | 98 ++ 49 files changed, 12870 insertions(+) create mode 100644 docs/Puppet/Parser/Functions.html create mode 100644 docs/_index.html create mode 100644 docs/css/common.css create mode 100644 docs/css/full_list.css create mode 100644 docs/css/style.css create mode 100644 docs/file.README.html create mode 100644 docs/frames.html create mode 100644 docs/index.html create mode 100644 docs/js/app.js create mode 100644 docs/js/full_list.js create mode 100644 docs/js/jquery.js create mode 100644 docs/puppet_class_list.html create mode 100644 docs/puppet_classes/php.html create mode 100644 docs/puppet_classes/php_3A_3Aapache_config.html create mode 100644 docs/puppet_classes/php_3A_3Acli.html create mode 100644 docs/puppet_classes/php_3A_3Acomposer.html create mode 100644 docs/puppet_classes/php_3A_3Acomposer_3A_3Aauto_update.html create mode 100644 docs/puppet_classes/php_3A_3Adev.html create mode 100644 docs/puppet_classes/php_3A_3Aembedded.html create mode 100644 docs/puppet_classes/php_3A_3Afpm.html create mode 100644 docs/puppet_classes/php_3A_3Afpm_3A_3Aconfig.html create mode 100644 docs/puppet_classes/php_3A_3Afpm_3A_3Aservice.html create mode 100644 docs/puppet_classes/php_3A_3Aglobal.html create mode 100644 docs/puppet_classes/php_3A_3Aglobals.html create mode 100644 docs/puppet_classes/php_3A_3Apackages.html create mode 100644 docs/puppet_classes/php_3A_3Aparams.html create mode 100644 docs/puppet_classes/php_3A_3Apear.html create mode 100644 docs/puppet_classes/php_3A_3Aphpunit.html create mode 100644 docs/puppet_classes/php_3A_3Aphpunit_3A_3Aauto_update.html create mode 100644 docs/puppet_classes/php_3A_3Arepo.html create mode 100644 docs/puppet_classes/php_3A_3Arepo_3A_3Adebian.html create mode 100644 docs/puppet_classes/php_3A_3Arepo_3A_3Aredhat.html create mode 100644 docs/puppet_classes/php_3A_3Arepo_3A_3Asuse.html create mode 100644 docs/puppet_classes/php_3A_3Arepo_3A_3Aubuntu.html create mode 100644 docs/puppet_defined_type_list.html create mode 100644 docs/puppet_defined_types/php_3A_3Aapache_vhost.html create mode 100644 docs/puppet_defined_types/php_3A_3Aconfig.html create mode 100644 docs/puppet_defined_types/php_3A_3Aconfig_3A_3Asetting.html create mode 100644 docs/puppet_defined_types/php_3A_3Aextension.html create mode 100644 docs/puppet_defined_types/php_3A_3Aextension_3A_3Aconfig.html create mode 100644 docs/puppet_defined_types/php_3A_3Aextension_3A_3Ainstall.html create mode 100644 docs/puppet_defined_types/php_3A_3Afpm_3A_3Apool.html create mode 100644 docs/puppet_function_list.html create mode 100644 docs/puppet_functions_ruby3x/ensure_prefix.html create mode 100644 docs/puppet_functions_ruby3x/to_hash_settings.html create mode 100644 docs/puppet_provider_list.html create mode 100644 docs/puppet_providers_package/pear.html create mode 100644 docs/puppet_providers_package/pecl.html create mode 100644 docs/top-level-namespace.html diff --git a/docs/Puppet/Parser/Functions.html b/docs/Puppet/Parser/Functions.html new file mode 100644 index 00000000..54615e00 --- /dev/null +++ b/docs/Puppet/Parser/Functions.html @@ -0,0 +1,105 @@ + + + + + + + Module: Puppet::Parser::Functions + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Puppet::Parser::Functions + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/puppet/parser/functions/to_hash_settings.rb,
+ lib/puppet/parser/functions/ensure_prefix.rb
+
+
+ +
+ + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/docs/_index.html b/docs/_index.html new file mode 100644 index 00000000..0da78276 --- /dev/null +++ b/docs/_index.html @@ -0,0 +1,369 @@ + + + + + + + Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
+ + +

Documentation by YARD 0.9.9

+
+

Alphabetic Index

+ +

Puppet Class Listing A-Z

+ + + + + + +
+ + + + +
+ + +

Defined Type Listing A-Z

+ + + + + + +
+ + + + +
+ + + +

Puppet Provider Listing A-Z

+ + + + + + +
+ + +
    +
  • P
  • +
      + +
    • + pear + + (Resource type: package) + +
    • + +
    • + pecl + + (Resource type: package) + +
    • + +
    +
+ +
+ + +

Puppet Function Listing A-Z

+ + + + + + +
+ + + + + + + +
+ + +

File Listing

+ + +
+ +

Ruby Namespace Listing A-Z

+ + + + + + +
+ + +
    +
  • F
  • +
      + +
    • + Functions + + (Puppet::Parser) + +
    • + +
    +
+ +
+ + +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/docs/css/common.css b/docs/css/common.css new file mode 100644 index 00000000..d28b0936 --- /dev/null +++ b/docs/css/common.css @@ -0,0 +1,8 @@ +/* Ensure the search bar doesn't overlap with links */ +.fixed_header { + padding-bottom: 25px; +} + +#full_list { + padding-top: 15px; +} diff --git a/docs/css/full_list.css b/docs/css/full_list.css new file mode 100644 index 00000000..fa359824 --- /dev/null +++ b/docs/css/full_list.css @@ -0,0 +1,58 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; + background: #fafafa; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; } +#full_list ul { padding: 0; } +#full_list li { padding: 0; margin: 0; list-style: none; } +#full_list li .item { padding: 5px 5px 5px 12px; } +#noresults { padding: 7px 12px; background: #fff; } +#content.insearch #noresults { margin-left: 7px; } +li.collapsed ul { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.odd { background: #f0f0f0; } +li.even { background: #fafafa; } +.item:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a, a:visited { text-decoration: none; color: #05a; } +li.clicked > .item { background: #05a; color: #ccc; } +li.clicked > .item a, li.clicked > .item a:visited { color: #eee; } +li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; border-radius: 3px; } +#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; } +#full_list_nav a, #nav a:visited { color: #358; } +#full_list_nav a:hover { background: transparent; color: #5af; } +#full_list_nav span:after { content: ' | '; } +#full_list_nav span:last-child:after { content: ''; } + +#content h1 { margin-top: 0; } +li { white-space: nowrap; cursor: normal; } +li small { display: block; font-size: 0.8em; } +li small:before { content: ""; } +li small:after { content: ""; } +li small.search_info { display: none; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +#content.insearch #search { background-position: center right; } +#search input { width: 110px; } + +#full_list.insearch ul { display: block; } +#full_list.insearch .item { display: none; } +#full_list.insearch .found { display: block; padding-left: 11px !important; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/docs/css/style.css b/docs/css/style.css new file mode 100644 index 00000000..f682a691 --- /dev/null +++ b/docs/css/style.css @@ -0,0 +1,492 @@ +html { + width: 100%; + height: 100%; +} +body { + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + width: 100%; + margin: 0; + padding: 0; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +#nav { + position: relative; + width: 100%; + height: 100%; + border: 0; + border-right: 1px dotted #eee; + overflow: auto; +} +.nav_wrap { + margin: 0; + padding: 0; + width: 20%; + height: 100%; + position: relative; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; + flex-shrink: 0; + -webkit-flex-shrink: 0; + -ms-flex: 1 0; +} +#resizer { + position: absolute; + right: -5px; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; + z-index: 9999; +} +#main { + flex: 5 1; + -webkit-flex: 5 1; + -ms-flex: 5 1; + outline: none; + position: relative; + background: #fff; + padding: 1.2em; + padding-top: 0.2em; +} + +@media (max-width: 920px) { + .nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; } + #resizer { display: none; } + #nav { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 40px; + right: 12px; + width: 500px; + max-width: 80%; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + box-shadow: -7px 5px 25px #aaa; + border-radius: 2px; + } +} + +@media (min-width: 920px) { + body { height: 100%; overflow: hidden; } + #main { height: 100%; overflow: auto; } + #search { display: none; } +} + +#main img { max-width: 100%; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; + position: relative; +} +h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; } +h2 small a { + display: block; + height: 20px; + border: 1px solid #aaa; + border-bottom: 0; + border-top-left-radius: 5px; + background: #f8f8f8; + position: relative; + padding: 2px 7px; +} +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; } +.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { + color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link a, .docstring .object_link a { + font-family: monospace; font-size: 1.05em; + color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +.summary_desc pre.code .object_link a, .docstring pre.code .object_link a { + padding: 0px; background: inherit; color: inherit; border-radius: inherit; +} + +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
    */ +#filecontents li > p, .docstring li > p { margin: 0px; } +#filecontents ul, .docstring ul { padding-left: 20px; } +/* style for
    */ +#filecontents dl, .docstring dl { border: 1px solid #ccc; } +#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; } +#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; } +#filecontents dd > p, .docstring dd > p { margin: 0px; } + +.note { + color: #222; + margin: 20px 0; + padding: 10px; + border: 1px solid #eee; + border-radius: 3px; + display: block; +} +.docstring .note { + border-left-color: #ccc; + border-left-width: 5px; +} +.note.todo { background: #ffffc5; border-color: #ececaa; } +.note.returns_void { background: #efefef; } +.note.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.title.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.private { background: #ffffc5; border-color: #ececaa; } +.note.title { padding: 3px 6px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; } +.summary_signature + .note.title { margin-left: 7px; } +h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; } +.note.title { background: #efefef; } +.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; } +.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.private { background: #d5d5d5; border-color: #c5c5c5; } +.note.title.not_defined_here { background: transparent; border: none; font-style: italic; } +.discussion .note { margin-top: 6px; } +.discussion .note:first-child { margin-top: 0; } + +h3.inherited { + font-style: italic; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-weight: normal; + padding: 0; + margin: 0; + margin-top: 12px; + margin-bottom: 3px; + font-size: 13px; +} +p.inherited { + padding: 0; + margin: 0; + margin-left: 25px; +} + +.box_info dl { + margin: 0; + border: 0; + width: 100%; + font-size: 1em; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} +.box_info dl dt { + flex-shrink: 0; + -webkit-flex-shrink: 1; + -ms-flex-shrink: 1; + width: 100px; + text-align: right; + font-weight: bold; + border: 1px solid #aaa; + border-width: 1px 0px 0px 1px; + padding: 6px 0; + padding-right: 10px; +} +.box_info dl dd { + flex-grow: 1; + -webkit-flex-grow: 1; + -ms-flex: 1; + max-width: 420px; + padding: 6px 0; + padding-right: 20px; + border: 1px solid #aaa; + border-width: 1px 1px 0 0; + overflow: hidden; + position: relative; +} +.box_info dl:last-child > * { + border-bottom: 1px solid #aaa; +} +.box_info dl:nth-child(odd) > * { background: #eee; } +.box_info dl:nth-child(even) > * { background: #fff; } +.box_info dl > * { margin: 0; } + +ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; } +.index_inline_list { padding-left: 0; font-size: 1.1em; } + +.index_inline_list li { + list-style: none; + display: inline-block; + padding: 0 12px; + line-height: 30px; + margin-bottom: 5px; +} + +dl.constants { margin-left: 10px; } +dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; } +dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; } +dl.constants .docstring .note:first-child { margin-top: 5px; } + +.summary_desc { + margin-left: 32px; + display: block; + font-family: sans-serif; + font-size: 1.1em; + margin-top: 8px; + line-height: 1.5145em; + margin-bottom: 0.8em; +} +.summary_desc tt { font-size: 0.9em; } +dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; } +dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; } +dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; } +dl.constants .discussion *:first-child { margin-top: 0; } +dl.constants .discussion *:last-child { margin-bottom: 0; } + +.method_details { border-top: 1px dotted #ccc; margin-top: 25px; padding-top: 0; } +.method_details.first { border: 0; margin-top: 5px; } +.method_details.first h3.signature { margin-top: 1em; } +p.signature, h3.signature { + font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace; + padding: 6px 10px; margin-top: 1em; + background: #E8F4FF; border: 1px solid #d8d8e5; border-radius: 5px; +} +p.signature tt, +h3.signature tt { font-family: Monaco, Consolas, Courier, monospace; } +p.signature .overload, +h3.signature .overload { display: block; } +p.signature .extras, +h3.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; } +p.signature .not_defined_here, +h3.signature .not_defined_here, +p.signature .aliases, +h3.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; } +p.signature .aliases .names, +h3.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; } + +.tags .tag_title { font-size: 1.05em; margin-bottom: 0; font-weight: bold; } +.tags .tag_title tt { color: initial; padding: initial; background: initial; } +.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; } +.tags ul li { margin-bottom: 3px; } +.tags ul .name { font-family: monospace; font-weight: bold; } +.tags ul .note { padding: 3px 6px; } +.tags { margin-bottom: 12px; } + +.tags .examples .tag_title { margin-bottom: 10px; font-weight: bold; } +.tags .examples .inline p { padding: 0; margin: 0; font-weight: bold; font-size: 1em; } +.tags .examples .inline p:before { content: "▸"; font-size: 1em; margin-right: 5px; } + +.tags .overload .overload_item { list-style: none; margin-bottom: 25px; } +.tags .overload .overload_item .signature { + padding: 2px 8px; + background: #F1F8FF; border: 1px solid #d8d8e5; border-radius: 3px; +} +.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; } +.tags .overload .docstring { margin-top: 15px; } + +.defines { display: none; } + +#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; } + +.showSource { font-size: 0.9em; } +.showSource a, .showSource a:visited { text-decoration: none; color: #666; } + +#content a, #content a:visited { text-decoration: none; color: #05a; } +#content a:hover { background: #ffffa5; } + +ul.summary { + list-style: none; + font-family: monospace; + font-size: 1em; + line-height: 1.5em; + padding-left: 0px; +} +ul.summary a, ul.summary a:visited { + text-decoration: none; font-size: 1.1em; +} +ul.summary li { margin-bottom: 5px; } +.summary .summary_signature { + padding: 4px 8px; + background: #f8f8f8; + border: 1px solid #f0f0f0; + border-radius: 5px; +} +.summary_signature:hover { background: #CFEBFF; border-color: #A4CCDA; cursor: pointer; } +ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;} +ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; } +#content .summary_signature:hover a, +#content .summary_signature:hover a:visited { + background: transparent; + color: #049; +} + +p.inherited a { font-family: monospace; font-size: 0.9em; } +p.inherited { word-spacing: 5px; font-size: 1.2em; } + +p.children { font-size: 1.2em; } +p.children a { font-size: 0.9em; } +p.children strong { font-size: 0.8em; } +p.children strong.modules { padding-left: 5px; } + +ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; } +ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; } +ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHtJREFUeNqMzrEJAkEURdGzuhgZbSoYWcAWoBVsB4JgZAGmphsZCZYzTQgWNCYrDN9RvMmHx+X916SUBFbo8CzD1idXrLErw1mQttgXtyrOcQ/Ny5p4Qh+2XqLYYazsPWNTiuMkRxa4vcV+evuNAUOLIx5+c2hyzv7hNQC67Q+/HHmlEwAAAABJRU5ErkJggg==) no-repeat top center; } +ul.fullTree li:first-child { padding-top: 0; background: transparent; } +ul.fullTree li:last-child { padding-bottom: 0; } +.showAll ul.fullTree { display: block; } +.showAll .inheritName { display: none; } + +#search { position: absolute; right: 12px; top: 0px; z-index: 9000; } +#search a { + display: block; float: left; + padding: 4px 8px; text-decoration: none; color: #05a; fill: #05a; + border: 1px solid #d8d8e5; + border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; + background: #F1F8FF; + box-shadow: -1px 1px 3px #ddd; +} +#search a:hover { background: #f5faff; color: #06b; fill: #06b; } +#search a.active { + background: #568; padding-bottom: 20px; color: #fff; fill: #fff; + border: 1px solid #457; + border-top-left-radius: 5px; border-top-right-radius: 5px; +} +#search a.inactive { color: #999; fill: #999; } +.inheritanceTree, .toggleDefines { + float: right; + border-left: 1px solid #aaa; + position: absolute; top: 0; right: 0; + height: 100%; + background: #f6f6f6; + padding: 5px; + min-width: 55px; + text-align: center; +} + +#menu { font-size: 1.3em; color: #bbb; } +#menu .title, #menu a { font-size: 0.7em; } +#menu .title a { font-size: 1em; } +#menu .title { color: #555; } +#menu a, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; } +#menu a:hover { color: #05a; } + +#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; } +#footer a, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; } +#footer a:hover { color: #05a; } + +#listing ul.alpha { font-size: 1.1em; } +#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; } +#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; } +#listing ul.alpha ul { margin: 0; padding-left: 15px; } +#listing ul small { color: #666; font-size: 0.7em; } + +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } + +#content ul.summary li.deprecated .summary_signature a, +#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; } + +#toc { + position: relative; + float: right; + overflow-x: auto; + right: -3px; + margin-left: 20px; + margin-bottom: 20px; + padding: 20px; padding-right: 30px; + max-width: 300px; + z-index: 5000; + background: #fefefe; + border: 1px solid #ddd; + box-shadow: -2px 2px 6px #bbb; +} +#toc .title { margin: 0; } +#toc ol { padding-left: 1.8em; } +#toc li { font-size: 1.1em; line-height: 1.7em; } +#toc > ol > li { font-size: 1.1em; font-weight: bold; } +#toc ol > ol { font-size: 0.9em; } +#toc ol ol > ol { padding-left: 2.3em; } +#toc ol + li { margin-top: 0.3em; } +#toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; } +#toc.hidden:hover { background: #fafafa; } +#filecontents h1 + #toc.nofloat { margin-top: 0; } +@media (max-width: 560px) { + #toc { + margin-left: 0; + margin-top: 16px; + float: none; + max-width: none; + } +} + +/* syntax highlighting */ +.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; } +#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; } +#filecontents pre.code, .docstring pre.code { display: block; } +.source_code .lines { padding-right: 12px; color: #555; text-align: right; } +#filecontents pre.code, .docstring pre.code, +.tags pre.example { + padding: 9px 14px; + margin-top: 4px; + border: 1px solid #e1e1e8; + background: #f7f7f9; + border-radius: 4px; + font-size: 1em; + overflow-x: auto; + line-height: 1.2em; +} +pre.code { color: #000; tab-size: 2; } +pre.code .info.file { color: #555; } +pre.code .val { color: #036A07; } +pre.code .tstring_content, +pre.code .heredoc_beg, pre.code .heredoc_end, +pre.code .qwords_beg, pre.code .qwords_end, pre.code .qwords_sep, +pre.code .words_beg, pre.code .words_end, pre.code .words_sep, +pre.code .qsymbols_beg, pre.code .qsymbols_end, pre.code .qsymbols_sep, +pre.code .symbols_beg, pre.code .symbols_end, pre.code .symbols_sep, +pre.code .tstring, pre.code .dstring { color: #036A07; } +pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s, +pre.code .rubyid_to_sym, pre.code .rubyid_to_f, +pre.code .dot + pre.code .id, +pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; } +pre.code .comment { color: #0066FF; } +pre.code .const, pre.code .constant { color: #585CF6; } +pre.code .label, +pre.code .symbol { color: #C5060B; } +pre.code .kw, +pre.code .rubyid_require, +pre.code .rubyid_extend, +pre.code .rubyid_include { color: #0000FF; } +pre.code .ivar { color: #318495; } +pre.code .gvar, +pre.code .rubyid_backref, +pre.code .rubyid_nth_ref { color: #6D79DE; } +pre.code .regexp, .dregexp { color: #036A07; } +pre.code a { border-bottom: 1px dotted #bbf; } + +/* Color fix for links */ +#content .summary_desc pre.code .id > .object_link a, /* identifier */ +#content .docstring pre.code .id > .object_link a { color: #0085FF; } +#content .summary_desc pre.code .const > .object_link a, /* constant */ +#content .docstring pre.code .const > .object_link a { color: #585CF6; } diff --git a/docs/file.README.html b/docs/file.README.html new file mode 100644 index 00000000..e48e7ffc --- /dev/null +++ b/docs/file.README.html @@ -0,0 +1,340 @@ + + + + + + + File: README + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Forge +Build Status

    + +

    Current Status

    + +

    As the original creators of puppet-php are no longer maintaining the module, it has been handed over into the care of Vox Pupuli. +Please be sure to update all your links to the new location.

    + +

    voxpupuli/php Puppet Module

    + +

    voxpupuli/php is a Puppet module for managing PHP with a strong focus +on php-fpm. The module aims to use sane defaults for the supported +architectures. We strive to support all recent versions of Debian, +Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache +with mod_php is not supported.

    + +

    This originally was a fork of jippi/puppet-php +(nodes-php on Puppet Forge) but has since been rewritten in large parts.

    + +

    Usage

    + +

    Quickest way to get started is simply include'ing the php class.

    + +
    include '::php'
    +
    + +

    Or, you can override defaults and specify additional custom +configurations by declaring class { '::php': } with parameters:

    + +
    class { '::php':
    +  ensure       => latest,
    +  manage_repos => true,
    +  fpm          => true,
    +  dev          => true,
    +  composer     => true,
    +  pear         => true,
    +  phpunit      => false,
    +}
    +
    + +

    Optionally the PHP version or configuration root directory can be changed also:

    + +
    class { '::php::globals':
    +  php_version => '7.0',
    +  config_root => '/etc/php/7.0',
    +}->
    +class { '::php':
    +  manage_repos => true
    +}
    +
    + +

    There are more configuration options available. Please refer to the +auto-generated documentation at http://php.puppet.mayflower.de/.

    + +

    Defining php.ini settings

    + +

    PHP configuration parameters in php.ini files can be defined as parameter +settings on the main php class, or php::fpm / php::cli classes, +or php::extension resources for each component independently.

    + +

    These settings are written into their respective php.ini file. Global +settings in php::settings are merged with the settings of all components. +Please note that settings of extensions are always independent.

    + +

    In the following example the PHP options and timezone will be set in +all PHP configurations, i.e. the PHP cli application and all php-fpm pools.

    + +
      class { '::php':
    +    settings   => {
    +      'PHP/max_execution_time'  => '90',
    +      'PHP/max_input_time'      => '300',
    +      'PHP/memory_limit'        => '64M',
    +      'PHP/post_max_size'       => '32M',
    +      'PHP/upload_max_filesize' => '32M',
    +      'Date/date.timezone'      => 'Europe/Berlin',
    +    },
    +  }
    +
    + +

    Installing extensions

    + +

    PHP configuration parameters in php.ini files can be defined +as parameter extensions on the main php class. They are +activated for all activated SAPIs.

    + +
      class { '::php':
    +    extensions => {
    +      bcmath    => { },
    +      imagick   => {
    +        provider => pecl,
    +      },
    +      xmlrpc    => { },
    +      memcached => {
    +        provider        => 'pecl',
    +        header_packages => [ 'libmemcached-devel', ],
    +      },
    +      apc       => {
    +        provider => 'pecl',
    +        settings => {
    +          'apc/stat'       => '1',
    +          'apc/stat_ctime' => '1',
    +        },
    +        sapi     => 'fpm',
    +      },
    +    },
    +  }
    +
    + +

    See the documentation +of the php::extension resource for all available parameters and default +values.

    + +

    Defining php-fpm pools

    + +

    If different php-fpm pools are required, you can use php::fpm::pool +defined resource type. A single pool called www will be configured +by default. Specify additional pools like so:

    + +
      php::fpm::pool { 'www2':
    +    listen => '127.0.1.1:9000',
    +  }
    +
    + +

    For an overview of all possible parameters for php::fpm::pool resources +please see its documention.

    + +

    Overriding php-fpm user

    + +

    By default, php-fpm is set up to run as Apache. If you need to customize that user, you can do that like so:

    + +
      class { '::php':
    +    fpm_user  => 'nginx',
    +    fpm_group => 'nginx',
    +  }
    +
    + +

    Alternative examples using Hiera

    + +

    Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera.

    + +

    Below are all the examples you see above, but defined in YAML format for use with Hiera.

    + +
    ---
    +php::ensure: latest
    +php::manage_repos: true
    +php::fpm: true
    +php::fpm_user: 'nginx'
    +php::fpm_group: 'nginx'
    +php::dev: true
    +php::composer: true
    +php::pear: true
    +php::phpunit: false
    +php::settings:
    +  'PHP/max_execution_time': '90'
    +  'PHP/max_input_time': '300'
    +  'PHP/memory_limit': '64M'
    +  'PHP/post_max_size': '32M'
    +  'PHP/upload_max_filesize': '32M'
    +  'Date/date.timezone': 'Europe/Berlin'
    +php::extensions:
    +  bcmath: {}
    +  xmlrpc: {}
    +  imagick:
    +    provider: pecl
    +  memcached:
    +    provider: pecl
    +    header_packages:
    +      - libmemcached-dev
    +  apc:
    +    provider: pecl
    +    settings:
    +      'apc/stat': 1
    +      'apc/stat_ctime': 1
    +    sapi: 'fpm'
    +php::fpm::pools:
    +  www2:
    +    listen: '127.0.1.1:9000'
    +
    + +

    Notes

    + +

    Debian squeeze & Ubuntu precise come with PHP 5.3

    + +

    On Debian-based systems, we use php5enmod to enable extension-specific +configuration. This script is only present in php5 packages beginning with +version 5.4. Furthermore, PHP 5.3 is not supported by upstream anymore.

    + +

    We strongly suggest you use a recent PHP version, even if you're using an +older though still supported distribution release. Our default is to have +php::manage_repos enabled to add apt sources for +Dotdeb on Debian and +ppa:ondrej/php5 on +Ubuntu with packages for the current stable PHP version closely tracking +upstream.

    + +

    Ubuntu systems and Ondřej's PPA

    + +

    The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6) +in favor of a new PPA: ondrej/php which contains all 3 versions of PHP: 5.5, 5.6, and 7.0 +Here's an example in hiera of getting PHP 5.6 installed with php-fpm, pear/pecl, and composer:

    + +
    php::globals::php_version: '5.6'
    +php::fpm: true
    +php::dev: true
    +php::composer: true
    +php::pear: true
    +php::phpunit: false
    +
    + +

    If you do not specify a php version, in Ubuntu the default will be 7.0 if you are +running Xenial (16.04), otherwise PHP 5.6 will be installed (for other versions)

    + +

    Apache support

    + +

    Apache with mod_php is not supported by this module. Please use +puppetlabs/apache instead.

    + +

    We prefer using php-fpm. You can find an example Apache vhost in +manifests/apache_vhost.pp that shows you how to use mod_proxy_fcgi to +connect to php-fpm.

    + +

    Facts

    + +

    We deliver a phpversion fact with this module. This is explicitly NOT intended +to be used within your puppet manifests as it will only work on your second puppet +run. Its intention is to make querying PHP versions per server easy via PuppetDB or Foreman.

    + +

    FreeBSD support

    + +

    On FreeBSD systems we purge the system-wide extensions.ini in favour of +per-module configuration files.

    + +

    Please also note that support for Composer and PHPUnit on FreeBSD is untested +and thus likely incomplete.

    + +

    Running the test suite

    + +

    To run the tests install the ruby dependencies with bundler and execute +rake:

    + +
    bundle install --path vendor/bundle
    +bundle exec rake
    +
    + +

    Bugs & New Features

    + +

    If you happen to stumble upon a bug, please feel free to create a pull request +with a fix (optionally with a test), and a description of the bug and how it +was resolved.

    + +

    Or if you're not into coding, simply create an issue adding steps to let us +reproduce the bug and we will happily fix it.

    + +

    If you have a good idea for a feature or how to improve this module in general, +please create an issue to discuss it. We are very open to feedback. Pull +requests are always welcome.

    + +

    We hate orphaned and unmaintained Puppet modules as much as you do and +therefore promise that we will continue to maintain this module and keep +response times to issues short. If we happen to lose interest, we will write +a big fat warning into this README to let you know.

    + +

    License

    + +

    The project is released under the permissive MIT license.

    + +

    The source can be found at +github.com/voxpupuli/puppet-php.

    + +

    This Puppet module was originally maintained by some fellow puppeteers at +Mayflower GmbH and is now maintained by +Vox Pupuli.

    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/frames.html b/docs/frames.html new file mode 100644 index 00000000..0cb13714 --- /dev/null +++ b/docs/frames.html @@ -0,0 +1,17 @@ + + + + + Documentation by YARD 0.9.9 + + + + diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..3b1e69a7 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,340 @@ + + + + + + + File: README + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Forge +Build Status

    + +

    Current Status

    + +

    As the original creators of puppet-php are no longer maintaining the module, it has been handed over into the care of Vox Pupuli. +Please be sure to update all your links to the new location.

    + +

    voxpupuli/php Puppet Module

    + +

    voxpupuli/php is a Puppet module for managing PHP with a strong focus +on php-fpm. The module aims to use sane defaults for the supported +architectures. We strive to support all recent versions of Debian, +Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache +with mod_php is not supported.

    + +

    This originally was a fork of jippi/puppet-php +(nodes-php on Puppet Forge) but has since been rewritten in large parts.

    + +

    Usage

    + +

    Quickest way to get started is simply include'ing the php class.

    + +
    include '::php'
    +
    + +

    Or, you can override defaults and specify additional custom +configurations by declaring class { '::php': } with parameters:

    + +
    class { '::php':
    +  ensure       => latest,
    +  manage_repos => true,
    +  fpm          => true,
    +  dev          => true,
    +  composer     => true,
    +  pear         => true,
    +  phpunit      => false,
    +}
    +
    + +

    Optionally the PHP version or configuration root directory can be changed also:

    + +
    class { '::php::globals':
    +  php_version => '7.0',
    +  config_root => '/etc/php/7.0',
    +}->
    +class { '::php':
    +  manage_repos => true
    +}
    +
    + +

    There are more configuration options available. Please refer to the +auto-generated documentation at http://php.puppet.mayflower.de/.

    + +

    Defining php.ini settings

    + +

    PHP configuration parameters in php.ini files can be defined as parameter +settings on the main php class, or php::fpm / php::cli classes, +or php::extension resources for each component independently.

    + +

    These settings are written into their respective php.ini file. Global +settings in php::settings are merged with the settings of all components. +Please note that settings of extensions are always independent.

    + +

    In the following example the PHP options and timezone will be set in +all PHP configurations, i.e. the PHP cli application and all php-fpm pools.

    + +
      class { '::php':
    +    settings   => {
    +      'PHP/max_execution_time'  => '90',
    +      'PHP/max_input_time'      => '300',
    +      'PHP/memory_limit'        => '64M',
    +      'PHP/post_max_size'       => '32M',
    +      'PHP/upload_max_filesize' => '32M',
    +      'Date/date.timezone'      => 'Europe/Berlin',
    +    },
    +  }
    +
    + +

    Installing extensions

    + +

    PHP configuration parameters in php.ini files can be defined +as parameter extensions on the main php class. They are +activated for all activated SAPIs.

    + +
      class { '::php':
    +    extensions => {
    +      bcmath    => { },
    +      imagick   => {
    +        provider => pecl,
    +      },
    +      xmlrpc    => { },
    +      memcached => {
    +        provider        => 'pecl',
    +        header_packages => [ 'libmemcached-devel', ],
    +      },
    +      apc       => {
    +        provider => 'pecl',
    +        settings => {
    +          'apc/stat'       => '1',
    +          'apc/stat_ctime' => '1',
    +        },
    +        sapi     => 'fpm',
    +      },
    +    },
    +  }
    +
    + +

    See the documentation +of the php::extension resource for all available parameters and default +values.

    + +

    Defining php-fpm pools

    + +

    If different php-fpm pools are required, you can use php::fpm::pool +defined resource type. A single pool called www will be configured +by default. Specify additional pools like so:

    + +
      php::fpm::pool { 'www2':
    +    listen => '127.0.1.1:9000',
    +  }
    +
    + +

    For an overview of all possible parameters for php::fpm::pool resources +please see its documention.

    + +

    Overriding php-fpm user

    + +

    By default, php-fpm is set up to run as Apache. If you need to customize that user, you can do that like so:

    + +
      class { '::php':
    +    fpm_user  => 'nginx',
    +    fpm_group => 'nginx',
    +  }
    +
    + +

    Alternative examples using Hiera

    + +

    Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera.

    + +

    Below are all the examples you see above, but defined in YAML format for use with Hiera.

    + +
    ---
    +php::ensure: latest
    +php::manage_repos: true
    +php::fpm: true
    +php::fpm_user: 'nginx'
    +php::fpm_group: 'nginx'
    +php::dev: true
    +php::composer: true
    +php::pear: true
    +php::phpunit: false
    +php::settings:
    +  'PHP/max_execution_time': '90'
    +  'PHP/max_input_time': '300'
    +  'PHP/memory_limit': '64M'
    +  'PHP/post_max_size': '32M'
    +  'PHP/upload_max_filesize': '32M'
    +  'Date/date.timezone': 'Europe/Berlin'
    +php::extensions:
    +  bcmath: {}
    +  xmlrpc: {}
    +  imagick:
    +    provider: pecl
    +  memcached:
    +    provider: pecl
    +    header_packages:
    +      - libmemcached-dev
    +  apc:
    +    provider: pecl
    +    settings:
    +      'apc/stat': 1
    +      'apc/stat_ctime': 1
    +    sapi: 'fpm'
    +php::fpm::pools:
    +  www2:
    +    listen: '127.0.1.1:9000'
    +
    + +

    Notes

    + +

    Debian squeeze & Ubuntu precise come with PHP 5.3

    + +

    On Debian-based systems, we use php5enmod to enable extension-specific +configuration. This script is only present in php5 packages beginning with +version 5.4. Furthermore, PHP 5.3 is not supported by upstream anymore.

    + +

    We strongly suggest you use a recent PHP version, even if you're using an +older though still supported distribution release. Our default is to have +php::manage_repos enabled to add apt sources for +Dotdeb on Debian and +ppa:ondrej/php5 on +Ubuntu with packages for the current stable PHP version closely tracking +upstream.

    + +

    Ubuntu systems and Ondřej's PPA

    + +

    The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6) +in favor of a new PPA: ondrej/php which contains all 3 versions of PHP: 5.5, 5.6, and 7.0 +Here's an example in hiera of getting PHP 5.6 installed with php-fpm, pear/pecl, and composer:

    + +
    php::globals::php_version: '5.6'
    +php::fpm: true
    +php::dev: true
    +php::composer: true
    +php::pear: true
    +php::phpunit: false
    +
    + +

    If you do not specify a php version, in Ubuntu the default will be 7.0 if you are +running Xenial (16.04), otherwise PHP 5.6 will be installed (for other versions)

    + +

    Apache support

    + +

    Apache with mod_php is not supported by this module. Please use +puppetlabs/apache instead.

    + +

    We prefer using php-fpm. You can find an example Apache vhost in +manifests/apache_vhost.pp that shows you how to use mod_proxy_fcgi to +connect to php-fpm.

    + +

    Facts

    + +

    We deliver a phpversion fact with this module. This is explicitly NOT intended +to be used within your puppet manifests as it will only work on your second puppet +run. Its intention is to make querying PHP versions per server easy via PuppetDB or Foreman.

    + +

    FreeBSD support

    + +

    On FreeBSD systems we purge the system-wide extensions.ini in favour of +per-module configuration files.

    + +

    Please also note that support for Composer and PHPUnit on FreeBSD is untested +and thus likely incomplete.

    + +

    Running the test suite

    + +

    To run the tests install the ruby dependencies with bundler and execute +rake:

    + +
    bundle install --path vendor/bundle
    +bundle exec rake
    +
    + +

    Bugs & New Features

    + +

    If you happen to stumble upon a bug, please feel free to create a pull request +with a fix (optionally with a test), and a description of the bug and how it +was resolved.

    + +

    Or if you're not into coding, simply create an issue adding steps to let us +reproduce the bug and we will happily fix it.

    + +

    If you have a good idea for a feature or how to improve this module in general, +please create an issue to discuss it. We are very open to feedback. Pull +requests are always welcome.

    + +

    We hate orphaned and unmaintained Puppet modules as much as you do and +therefore promise that we will continue to maintain this module and keep +response times to issues short. If we happen to lose interest, we will write +a big fat warning into this README to let you know.

    + +

    License

    + +

    The project is released under the permissive MIT license.

    + +

    The source can be found at +github.com/voxpupuli/puppet-php.

    + +

    This Puppet module was originally maintained by some fellow puppeteers at +Mayflower GmbH and is now maintained by +Vox Pupuli.

    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/js/app.js b/docs/js/app.js new file mode 100644 index 00000000..b9f21202 --- /dev/null +++ b/docs/js/app.js @@ -0,0 +1,248 @@ +(function() { + +var localStorage = {}, sessionStorage = {}; +try { localStorage = window.localStorage; } catch (e) { } +try { sessionStorage = window.sessionStorage; } catch (e) { } + +function createSourceLinks() { + $('.method_details_list .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().nextAll('.source_code').slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().nextAll('.source_code').slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().css('display', 'inline'); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + }); +} + +function searchFrameButtons() { + $('.full_list_link').click(function() { + toggleSearchFrame(this, $(this).attr('href')); + return false; + }); + window.addEventListener('message', function(e) { + if (e.data === 'navEscape') { + $('#nav').slideUp(100); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); + + $(window).resize(function() { + if ($('#search:visible').length === 0) { + $('#nav').removeAttr('style'); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#nav'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') === link && frame.css('display') !== "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + if (frame.attr('src') !== link) frame.attr('src', link); + frame.slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function(e) { + e.preventDefault(); + localStorage.summaryCollapsed = $(this).text(); + $('.summary_toggle').each(function() { + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll('ul.summary').first(); + if (next.hasClass('compact')) { + next.toggle(); + next.nextAll('ul.summary').first().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('
      '); + list.html(next.html()); + list.find('.summary_desc, .note').remove(); + list.find('a').each(function() { + $(this).html($(this).find('strong').html()); + $(this).parent().html($(this)[0].outerHTML); + }); + next.before(list); + next.toggle(); + } + }); + return false; + }); + if (localStorage.summaryCollapsed == "collapse") { + $('.summary_toggle').first().click(); + } else { localStorage.summaryCollapsed = "expand"; } +} + +function generateTOC() { + if ($('#filecontents').length === 0) return; + var _toc = $('
        '); + var show = false; + var toc = _toc; + var counter = 0; + var tags = ['h2', 'h3', 'h4', 'h5', 'h6']; + var i; + if ($('#filecontents h1').length > 1) tags.unshift('h1'); + for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; } + var lastTag = parseInt(tags[0][1], 10); + $(tags.join(', ')).each(function() { + if ($(this).parents('.method_details .docstring').length != 0) return; + if (this.id == "filecontents") return; + show = true; + var thisTag = parseInt(this.tagName[1], 10); + if (this.id.length === 0) { + var proposedId = $(this).attr('toc-id'); + if (typeof(proposedId) != "undefined") this.id = proposedId; + else { + var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_'); + if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; } + this.id = proposedId; + } + } + if (thisTag > lastTag) { + for (i = 0; i < thisTag - lastTag; i++) { + var tmp = $('
          '); toc.append(tmp); toc = tmp; + } + } + if (thisTag < lastTag) { + for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent(); + } + var title = $(this).attr('toc-title'); + if (typeof(title) == "undefined") title = $(this).text(); + toc.append('
        1. ' + title + '
        2. '); + lastTag = thisTag; + }); + if (!show) return; + html = ''; + $('#content').prepend(html); + $('#toc').append(_toc); + $('#toc .hide_toc').toggle(function() { + $('#toc .top').slideUp('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }, function() { + $('#toc .top').slideDown('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }); +} + +function navResizeFn(e) { + if (e.which !== 1) { + navResizeFnStop(); + return; + } + + sessionStorage.navWidth = e.pageX.toString(); + $('.nav_wrap').css('width', e.pageX); + $('.nav_wrap').css('-ms-flex', 'inherit'); +} + +function navResizeFnStop() { + $(window).unbind('mousemove', navResizeFn); + window.removeEventListener('message', navMessageFn, false); +} + +function navMessageFn(e) { + if (e.data.action === 'mousemove') navResizeFn(e.data.event); + if (e.data.action === 'mouseup') navResizeFnStop(); +} + +function navResizer() { + $('#resizer').mousedown(function(e) { + e.preventDefault(); + $(window).mousemove(navResizeFn); + window.addEventListener('message', navMessageFn, false); + }); + $(window).mouseup(navResizeFnStop); + + if (sessionStorage.navWidth) { + navResizeFn({which: 1, pageX: parseInt(sessionStorage.navWidth, 10)}); + } +} + +function navExpander() { + var done = false, timer = setTimeout(postMessage, 500); + function postMessage() { + if (done) return; + clearTimeout(timer); + var opts = { action: 'expand', path: pathId }; + document.getElementById('nav').contentWindow.postMessage(opts, '*'); + done = true; + } + + window.addEventListener('message', function(event) { + if (event.data === 'navReady') postMessage(); + return false; + }, false); +} + +function mainFocus() { + var hash = window.location.hash; + if (hash !== '' && $(hash)[0]) { + $(hash)[0].scrollIntoView(); + } + + setTimeout(function() { $('#main').focus(); }, 10); +} + +$(document).ready(function() { + navResizer(); + navExpander(); + createSourceLinks(); + createDefineLinks(); + createFullTreeLinks(); + searchFrameButtons(); + linkSummaries(); + summaryToggle(); + generateTOC(); + mainFocus(); +}); + +})(); diff --git a/docs/js/full_list.js b/docs/js/full_list.js new file mode 100644 index 00000000..59069c5e --- /dev/null +++ b/docs/js/full_list.js @@ -0,0 +1,216 @@ +(function() { + +var $clicked = $(null); +var searchTimeout = null; +var searchCache = []; +var caseSensitiveMatch = false; +var ignoreKeyCodeMin = 8; +var ignoreKeyCodeMax = 46; +var commandKey = 91; + +RegExp.escape = function(text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); +} + +function escapeShortcut() { + $(document).keydown(function(evt) { + if (evt.which == 27) { + window.parent.postMessage('navEscape', '*'); + } + }); +} + +function navResizer() { + $(window).mousemove(function(e) { + window.parent.postMessage({ + action: 'mousemove', event: {pageX: e.pageX, which: e.which} + }, '*'); + }).mouseup(function(e) { + window.parent.postMessage({action: 'mouseup'}, '*'); + }); + window.parent.postMessage("navReady", "*"); +} + +function clearSearchTimeout() { + clearTimeout(searchTimeout); + searchTimeout = null; +} + +function enableLinks() { + // load the target page in the parent window + $('#full_list li').on('click', function(evt) { + $('#full_list li').removeClass('clicked'); + $clicked = $(this); + $clicked.addClass('clicked'); + evt.stopPropagation(); + + if (evt.target.tagName === 'A') return true; + + var elem = $clicked.find('> .item .object_link a')[0]; + var e = evt.originalEvent; + var newEvent = new MouseEvent(evt.originalEvent.type); + newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget); + elem.dispatchEvent(newEvent); + evt.preventDefault(); + return false; + }); +} + +function enableToggles() { + // show/hide nested classes on toggle click + $('#full_list a.toggle').on('click', function(evt) { + evt.stopPropagation(); + evt.preventDefault(); + $(this).parent().parent().toggleClass('collapsed'); + highlight(); + }); +} + +function populateSearchCache() { + $('#full_list li .item').each(function() { + var $node = $(this); + var $link = $node.find('.object_link a'); + if ($link.length > 0) { + searchCache.push({ + node: $node, + link: $link, + name: $link.text(), + fullName: $link.attr('title').split(' ')[0] + }); + } + }); +} + +function enableSearch() { + $('#search input').keyup(function(event) { + if (ignoredKeyPress(event)) return; + if (this.value === "") { + clearSearch(); + } else { + performSearch(this.value); + } + }); + + $('#full_list').after(""); +} + +function ignoredKeyPress(event) { + if ( + (event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) || + (event.keyCode == commandKey) + ) { + return true; + } else { + return false; + } +} + +function clearSearch() { + clearSearchTimeout(); + $('#full_list .found').removeClass('found').each(function() { + var $link = $(this).find('.object_link a'); + $link.text($link.text()); + }); + $('#full_list, #content').removeClass('insearch'); + $clicked.parents().removeClass('collapsed'); + highlight(); +} + +function performSearch(searchString) { + clearSearchTimeout(); + $('#full_list, #content').addClass('insearch'); + $('#noresults').text('').hide(); + partialSearch(searchString, 0); +} + +function partialSearch(searchString, offset) { + var lastRowClass = ''; + var i = null; + for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) { + var item = searchCache[i]; + var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); + var matchString = buildMatchString(searchString); + var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); + if (searchName.match(matchRegexp) == null) { + item.node.removeClass('found'); + item.link.text(item.link.text()); + } + else { + item.node.addClass('found'); + item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1'); + lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2'; + item.link.html(item.name.replace(matchRegexp, "$&")); + } + } + if(i == searchCache.length) { + searchDone(); + } else { + searchTimeout = setTimeout(function() { + partialSearch(searchString, i); + }, 0); + } +} + +function searchDone() { + searchTimeout = null; + highlight(); + if ($('#full_list li:visible').size() === 0) { + $('#noresults').text('No results were found.').hide().fadeIn(); + } else { + $('#noresults').text('').hide(); + } + $('#content').removeClass('insearch'); +} + +function buildMatchString(searchString, event) { + caseSensitiveMatch = searchString.match(/[A-Z]/) != null; + var regexSearchString = RegExp.escape(searchString); + if (caseSensitiveMatch) { + regexSearchString += "|" + + $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). + join('.+?'); + } + return regexSearchString; +} + +function highlight() { + $('#full_list li:visible').each(function(n) { + $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even'); + }); +} + +/** + * Expands the tree to the target element and its immediate + * children. + */ +function expandTo(path) { + var $target = $(document.getElementById('object_' + path)); + $target.addClass('clicked'); + $target.removeClass('collapsed'); + $target.parentsUntil('#full_list', 'li').removeClass('collapsed'); + if($target[0]) { + window.scrollTo(window.scrollX, $target.offset().top - 250); + highlight(); + } +} + +function windowEvents(event) { + var msg = event.data; + if (msg.action === "expand") { + expandTo(msg.path); + } + return false; +} + +window.addEventListener("message", windowEvents, false); + +$(document).ready(function() { + escapeShortcut(); + navResizer(); + enableLinks(); + enableToggles(); + populateSearchCache(); + enableSearch(); +}); + +})(); diff --git a/docs/js/jquery.js b/docs/js/jquery.js new file mode 100644 index 00000000..198b3ff0 --- /dev/null +++ b/docs/js/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
    a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
    "+""+"
    ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
    t
    ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
    ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
    ","
    "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
    ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/docs/puppet_class_list.html b/docs/puppet_class_list.html new file mode 100644 index 00000000..7b465fab --- /dev/null +++ b/docs/puppet_class_list.html @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + Puppet Class List + + + +
    +
    +

    Puppet Class List

    + + + +
    + + +
    + + diff --git a/docs/puppet_classes/php.html b/docs/puppet_classes/php.html new file mode 100644 index 00000000..89fe3ec2 --- /dev/null +++ b/docs/puppet_classes/php.html @@ -0,0 +1,906 @@ + + + + + + + Puppet Class: php + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/init.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Base class with global configuration parameters that pulls in all +enabled components.

    + +

    === Parameters

    + +

    [ensure] + Specify which version of PHP packages to install, defaults to 'present'. + Please note that 'absent' to remove packages is not supported!

    + +

    [manage_repos] + Include repository (dotdeb, ppa, etc.) to install recent PHP from

    + +

    [fpm] + Install and configure php-fpm

    + +

    [fpm_service_enable] + Enable/disable FPM service

    + +

    [fpm_service_ensure] + Ensure FPM service is either 'running' or 'stopped'

    + +

    [fpm_service_name] + This is the name of the php-fpm service. It defaults to reasonable OS + defaults but can be different in case of using php7.0/other OS/custom fpm service

    + +

    [fpm_service_provider] + This is the name of the service provider, in case there is a non + OS default service provider used to start FPM. + Defaults to 'undef', pick system defaults.

    + +

    [fpm_pools] + Hash of php::fpm::pool resources that will be created. Defaults + to a single php::fpm::pool named www with default parameters.

    + +

    [fpm_global_pool_settings] + Hash of defaults params php::fpm::pool resources that will be created. + Defaults to empty hash.

    + +

    [fpm_inifile] + Path to php.ini for fpm

    + +

    [fpm_package] + Name of fpm package to install

    + +

    [fpm_user] + The user that php-fpm should run as

    + +

    [fpm_group] + The group that php-fpm should run as

    + +

    [dev] + Install php header files, needed to install pecl modules

    + +

    [composer] + Install and auto-update composer

    + +

    [pear] + Install PEAR

    + +

    [phpunit] + Install phpunit

    + +

    [apache_config] + Manage apache's mod_php configuration

    + +

    [proxy_type] + proxy server type (none|http|https|ftp)

    + +

    [proxy_server] + specify a proxy server, with port number if needed. ie: https://example.com:8080.

    + +

    [extensions] + Install PHP extensions, this is overwritten by hiera hash php::extensions

    + +

    [package_prefix] + This is the prefix for constructing names of php packages. This defaults + to a sensible default depending on your operating system, like 'php-' or + 'php5-'.

    + +

    [config_root_ini] + This is the path to the config .ini files of the extensions. This defaults + to a sensible default depending on your operating system, like + '/etc/php5/mods-available' or '/etc/php5/conf.d'.

    + +

    [config_root_inifile] + The path to the global php.ini file. This defaults to a sensible default + depending on your operating system.

    + +

    [ext_tool_enable] + Absolute path to php tool for enabling extensions in debian/ubuntu systems. + This defaults to '/usr/sbin/php5enmod'.

    + +

    [ext_tool_query] + Absolute path to php tool for querying information about extensions in + debian/ubuntu systems. This defaults to '/usr/sbin/php5query'.

    + +

    [ext_tool_enabled] + Enable or disable the use of php tools on debian based systems + debian/ubuntu systems. This defaults to 'true'.

    + +

    [log_owner] + The php-fpm log owner

    + +

    [log_group] + The group owning php-fpm logs

    + +

    [embedded] + Enable embedded SAPI

    + +

    [pear_ensure] + The package ensure of PHP pear to install and run pear auto_discover

    + +

    [settings]

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: $::php::params::ensure) + + +
    • + +
    • + + manage_repos + + + (Boolean) + + + (defaults to: $::php::params::manage_repos) + + +
    • + +
    • + + fpm + + + (Boolean) + + + (defaults to: true) + + +
    • + +
    • + + fpm_service_enable + + + (Any) + + + (defaults to: $::php::params::fpm_service_enable) + + +
    • + +
    • + + fpm_service_ensure + + + (Any) + + + (defaults to: $::php::params::fpm_service_ensure) + + +
    • + +
    • + + fpm_service_name + + + (Any) + + + (defaults to: $::php::params::fpm_service_name) + + +
    • + +
    • + + fpm_service_provider + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + fpm_pools + + + (Hash) + + + (defaults to: { 'www' => {} }) + + +
    • + +
    • + + fpm_global_pool_settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    • + + fpm_inifile + + + (Any) + + + (defaults to: $::php::params::fpm_inifile) + + +
    • + +
    • + + fpm_package + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + fpm_user + + + (Any) + + + (defaults to: $::php::params::fpm_user) + + +
    • + +
    • + + fpm_group + + + (Any) + + + (defaults to: $::php::params::fpm_group) + + +
    • + +
    • + + embedded + + + (Boolean) + + + (defaults to: false) + + +
    • + +
    • + + dev + + + (Boolean) + + + (defaults to: true) + + +
    • + +
    • + + composer + + + (Boolean) + + + (defaults to: true) + + +
    • + +
    • + + pear + + + (Boolean) + + + (defaults to: true) + + +
    • + +
    • + + pear_ensure + + + (String) + + + (defaults to: $::php::params::pear_ensure) + + +
    • + +
    • + + phpunit + + + (Boolean) + + + (defaults to: false) + + +
    • + +
    • + + apache_config + + + (Boolean) + + + (defaults to: false) + + +
    • + +
    • + + proxy_type + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + proxy_server + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + extensions + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    • + + package_prefix + + + (Any) + + + (defaults to: $::php::params::package_prefix) + + +
    • + +
    • + + config_root_ini + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::config_root_ini) + + +
    • + +
    • + + config_root_inifile + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::config_root_inifile) + + +
    • + +
    • + + ext_tool_enable + + + (Optional[Stdlib::Absolutepath]) + + + (defaults to: $::php::params::ext_tool_enable) + + +
    • + +
    • + + ext_tool_query + + + (Optional[Stdlib::Absolutepath]) + + + (defaults to: $::php::params::ext_tool_query) + + +
    • + +
    • + + ext_tool_enabled + + + (Boolean) + + + (defaults to: $::php::params::ext_tool_enabled) + + +
    • + +
    • + + log_owner + + + (String) + + + (defaults to: $::php::params::fpm_user) + + +
    • + +
    • + + log_group + + + (String) + + + (defaults to: $::php::params::fpm_group) + + +
    • + +
    + + +
    +
    + + + + +
    +
    +
    +
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +237
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +245
    +
    +
    # File 'manifests/init.pp', line 115
    +
    +class php (
    +  String $ensure                                  = $::php::params::ensure,
    +  Boolean $manage_repos                           = $::php::params::manage_repos,
    +  Boolean $fpm                                    = true,
    +  $fpm_service_enable                             = $::php::params::fpm_service_enable,
    +  $fpm_service_ensure                             = $::php::params::fpm_service_ensure,
    +  $fpm_service_name                               = $::php::params::fpm_service_name,
    +  $fpm_service_provider                           = undef,
    +  Hash $fpm_pools                                 = { 'www' => {} },
    +  Hash $fpm_global_pool_settings                  = {},
    +  $fpm_inifile                                    = $::php::params::fpm_inifile,
    +  $fpm_package                                    = undef,
    +  $fpm_user                                       = $::php::params::fpm_user,
    +  $fpm_group                                      = $::php::params::fpm_group,
    +  Boolean $embedded                               = false,
    +  Boolean $dev                                    = true,
    +  Boolean $composer                               = true,
    +  Boolean $pear                                   = true,
    +  String $pear_ensure                             = $::php::params::pear_ensure,
    +  Boolean $phpunit                                = false,
    +  Boolean $apache_config                          = false,
    +  $proxy_type                                     = undef,
    +  $proxy_server                                   = undef,
    +  Hash $extensions                                = {},
    +  Hash $settings                                  = {},
    +  $package_prefix                                 = $::php::params::package_prefix,
    +  Stdlib::Absolutepath $config_root_ini           = $::php::params::config_root_ini,
    +  Stdlib::Absolutepath $config_root_inifile       = $::php::params::config_root_inifile,
    +  Optional[Stdlib::Absolutepath] $ext_tool_enable = $::php::params::ext_tool_enable,
    +  Optional[Stdlib::Absolutepath] $ext_tool_query  = $::php::params::ext_tool_query,
    +  Boolean $ext_tool_enabled                       = $::php::params::ext_tool_enabled,
    +  String $log_owner                               = $::php::params::fpm_user,
    +  String $log_group                               = $::php::params::fpm_group,
    +) inherits ::php::params {
    +
    +  $real_fpm_package = pick($fpm_package, "${package_prefix}${::php::params::fpm_package_suffix}")
    +
    +  # Deep merge global php settings
    +  $real_settings = deep_merge($settings, hiera_hash('php::settings', {}))
    +
    +  # Deep merge global php extensions
    +  $real_extensions = deep_merge($extensions, hiera_hash('php::extensions', {}))
    +
    +  # Deep merge fpm_pools
    +  $real_fpm_pools = deep_merge($fpm_pools, hiera_hash('php::fpm_pools', {}))
    +
    +  # Deep merge fpm_global_pool_settings
    +  $real_fpm_global_pool_settings = deep_merge($fpm_global_pool_settings, hiera_hash('php::fpm_global_pool_settings', {}))
    +
    +  if $manage_repos {
    +    class { '::php::repo': }
    +    -> Anchor['php::begin']
    +  }
    +
    +  anchor { 'php::begin': }
    +    -> class { '::php::packages': }
    +    -> class { '::php::cli':
    +      settings => $real_settings,
    +    }
    +  -> anchor { 'php::end': }
    +
    +  # Configure global PHP settings in php.ini
    +  if $facts['os']['family'] != 'Debian' {
    +    Class['php::packages']
    +    -> class {'::php::global':
    +      settings => $real_settings,
    +    }
    +    -> Anchor['php::end']
    +  }
    +
    +  if $fpm { contain '::php::fpm' }
    +  if $embedded {
    +    if $facts['os']['family'] == 'RedHat' and $fpm {
    +      # Both fpm and embeded SAPIs are using same php.ini
    +      fail('Enabling both cli and embedded sapis is not currently supported')
    +    }
    +
    +    Anchor['php::begin']
    +      -> class { '::php::embedded':
    +        settings => $real_settings,
    +      }
    +    -> Anchor['php::end']
    +  }
    +  if $dev {
    +    Anchor['php::begin']
    +      -> class { '::php::dev': }
    +    -> Anchor['php::end']
    +  }
    +  if $composer {
    +    Anchor['php::begin']
    +      -> class { '::php::composer':
    +        proxy_type   => $proxy_type,
    +        proxy_server => $proxy_server,
    +      }
    +    -> Anchor['php::end']
    +  }
    +  if $pear {
    +    Anchor['php::begin']
    +      -> class { '::php::pear':
    +        ensure => $pear_ensure,
    +      }
    +    -> Anchor['php::end']
    +  }
    +  if $phpunit {
    +    Anchor['php::begin']
    +      -> class { '::php::phpunit': }
    +    -> Anchor['php::end']
    +  }
    +  if $apache_config {
    +    Anchor['php::begin']
    +      -> class { '::php::apache_config':
    +        settings => $real_settings,
    +      }
    +    -> Anchor['php::end']
    +  }
    +
    +  create_resources('::php::extension', $real_extensions, {
    +    require => Class['::php::cli'],
    +    before  => Anchor['php::end']
    +  })
    +
    +  # On FreeBSD purge the system-wide extensions.ini. It is going
    +  # to be replaced with per-module configuration files.
    +  if $::osfamily == 'FreeBSD' {
    +    # Purge the system-wide extensions.ini
    +    file { '/usr/local/etc/php/extensions.ini':
    +      ensure  => absent,
    +      require => Class['::php::packages'],
    +    }
    +  }
    +}
    +
    + + + + + + + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Aapache_config.html b/docs/puppet_classes/php_3A_3Aapache_config.html new file mode 100644 index 00000000..a26cdb1d --- /dev/null +++ b/docs/puppet_classes/php_3A_3Aapache_config.html @@ -0,0 +1,182 @@ + + + + + + + Puppet Class: php::apache_config + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::apache_config

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/apache_config.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install and configure php apache settings

    + +

    === Parameters

    + +

    [inifile] + The path to the ini php-apache ini file

    + +

    [settings] + Hash with nested hash of key => value to set in inifile

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + inifile + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::apache_inifile) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +
    +
    # File 'manifests/apache_config.pp', line 11
    +
    +class php::apache_config(
    +  Stdlib::Absolutepath $inifile = $::php::params::apache_inifile,
    +  Hash $settings                = {}
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::apache_config is private')
    +  }
    +
    +  $real_settings = deep_merge($settings, hiera_hash('php::apache::settings', {}))
    +
    +  ::php::config { 'apache':
    +    file   => $inifile,
    +    config => $real_settings,
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Acli.html b/docs/puppet_classes/php_3A_3Acli.html new file mode 100644 index 00000000..e58cc63c --- /dev/null +++ b/docs/puppet_classes/php_3A_3Acli.html @@ -0,0 +1,182 @@ + + + + + + + Puppet Class: php::cli + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::cli

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/cli.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install and configure php CLI

    + +

    === Parameters

    + +

    [inifile] + The path to the ini php5-cli ini file

    + +

    [settings] + Hash with nested hash of key => value to set in inifile

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + inifile + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::cli_inifile) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +
    +
    # File 'manifests/cli.pp', line 11
    +
    +class php::cli(
    +  Stdlib::Absolutepath $inifile = $::php::params::cli_inifile,
    +  Hash $settings                = {}
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::cli is private')
    +  }
    +
    +  $real_settings = deep_merge($settings, hiera_hash('php::cli::settings', {}))
    +
    +  ::php::config { 'cli':
    +    file   => $inifile,
    +    config => $real_settings,
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Acomposer.html b/docs/puppet_classes/php_3A_3Acomposer.html new file mode 100644 index 00000000..7dd52e23 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Acomposer.html @@ -0,0 +1,302 @@ + + + + + + + Puppet Class: php::composer + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::composer

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/composer.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install composer package manager

    + +

    === Parameters

    + +

    [source] + Holds URL to the Composer source file

    + +

    [path] + Holds path to the Composer executable

    + +

    [proxy_type] + proxy server type (none|http|https|ftp)

    + +

    [proxy_server] + specify a proxy server, with port number if needed. ie: https://example.com:8080.

    + +

    [auto_update] + Defines if composer should be auto updated

    + +

    [max_age] + Defines the time in days after which an auto-update gets executed

    + +

    [root_group] + UNIX group of the root user

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + source + + + (String) + + + (defaults to: $::php::params::composer_source) + + +
    • + +
    • + + path + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::composer_path) + + +
    • + +
    • + + proxy_type + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + proxy_server + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + auto_update + + + (Boolean) + + + (defaults to: true) + + +
    • + +
    • + + max_age + + + (Integer) + + + (defaults to: $::php::params::composer_max_age) + + +
    • + +
    • + + root_group + + + (Variant[Integer, String]) + + + (defaults to: $::php::params::root_group) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +
    +
    # File 'manifests/composer.pp', line 26
    +
    +class php::composer (
    +  String $source                       = $::php::params::composer_source,
    +  Stdlib::Absolutepath $path           = $::php::params::composer_path,
    +  $proxy_type                          = undef,
    +  $proxy_server                        = undef,
    +  Boolean $auto_update                 = true,
    +  Integer $max_age                     = $::php::params::composer_max_age,
    +  Variant[Integer, String] $root_group = $::php::params::root_group,
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::composer is private')
    +  }
    +
    +  archive { 'download composer':
    +    path         => $path,
    +    source       => $source,
    +    proxy_type   => $proxy_type,
    +    proxy_server => $proxy_server,
    +  }
    +  -> file { $path:
    +    mode  => '0555',
    +    owner => root,
    +    group => $root_group,
    +  }
    +
    +  if $auto_update {
    +    class { '::php::composer::auto_update':
    +      max_age      => $max_age,
    +      source       => $source,
    +      path         => $path,
    +      proxy_type   => $proxy_type,
    +      proxy_server => $proxy_server,
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Acomposer_3A_3Aauto_update.html b/docs/puppet_classes/php_3A_3Acomposer_3A_3Aauto_update.html new file mode 100644 index 00000000..16c20858 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Acomposer_3A_3Aauto_update.html @@ -0,0 +1,246 @@ + + + + + + + Puppet Class: php::composer::auto_update + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::composer::auto_update

    +
    + + +
    +
    Defined in:
    +
    + manifests/composer/auto_update.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install composer package manager

    + +

    === Parameters

    + +

    [max_age] + Defines number of days after which Composer should be updated

    + +

    [source] + Holds URL to the Composer source file

    + +

    [path] + Holds path to the Composer executable

    + +

    [proxy_type] + proxy server type (none|http|https|ftp)

    + +

    [proxy_server] + specify a proxy server, with port number if needed. ie: https://example.com:8080.

    + +

    === Examples

    + +

    include php::composer::auto_update + class { "php::composer::auto_update": + "max_age" => 90 + }

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + max_age + + + (Any) + + + +
    • + +
    • + + source + + + (Any) + + + +
    • + +
    • + + path + + + (Any) + + + +
    • + +
    • + + proxy_type + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + proxy_server + + + (Any) + + + (defaults to: undef) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +
    +
    # File 'manifests/composer/auto_update.pp', line 28
    +
    +class php::composer::auto_update (
    +  $max_age,
    +  $source,
    +  $path,
    +  $proxy_type   = undef,
    +  $proxy_server = undef,
    +) {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::composer::auto_update is private')
    +  }
    +
    +  if $proxy_type and $proxy_server {
    +    $env = [ 'HOME=/root', "${proxy_type}_proxy=${proxy_server}" ]
    +  } else {
    +    $env = [ 'HOME=/root' ]
    +  }
    +
    +  exec { 'update composer':
    +    command     => "${path} --no-interaction --quiet self-update",
    +    environment => $env,
    +    onlyif      => "test `find '${path}' -mtime +${max_age}`",
    +    path        => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ],
    +    require     => [File[$path], Class['::php::cli']],
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Adev.html b/docs/puppet_classes/php_3A_3Adev.html new file mode 100644 index 00000000..6e6ddcf8 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Adev.html @@ -0,0 +1,216 @@ + + + + + + + Puppet Class: php::dev + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::dev

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/dev.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install the development package with headers for PHP

    + +

    === Parameters

    + +

    [ensure] + The PHP ensure of PHP dev to install

    + +

    [package] + The package name for the PHP development files

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: $::php::ensure) + + +
    • + +
    • + + package + + + (String) + + + (defaults to: "${::php::package_prefix}${::php::params::dev_package_suffix}") + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +
    +
    # File 'manifests/dev.pp', line 11
    +
    +class php::dev(
    +  String $ensure  = $::php::ensure,
    +  String $package = "${::php::package_prefix}${::php::params::dev_package_suffix}",
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::dev is private')
    +  }
    +
    +  # On FreeBSD there is no 'devel' package.
    +  $real_package = $facts['os']['family'] ? {
    +    'FreeBSD' => [],
    +    default   => $package,
    +  }
    +
    +  # 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  {
    +    ensure_packages(["${php::package_prefix}xml"], {
    +      ensure  => present,
    +      require => Class['::apt::update'],
    +    })
    +
    +    package { $real_package:
    +      ensure  => $ensure,
    +      require => Class['::php::packages'],
    +    }
    +  } else {
    +    package { $real_package:
    +      ensure  => $ensure,
    +      require => Class['::php::packages'],
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Aembedded.html b/docs/puppet_classes/php_3A_3Aembedded.html new file mode 100644 index 00000000..050916d1 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Aembedded.html @@ -0,0 +1,244 @@ + + + + + + + Puppet Class: php::embedded + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::embedded

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/embedded.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install and configure php embedded SAPI

    + +

    === Parameters

    + +

    [inifile] + The path to the ini php5-embeded ini file

    + +

    [settings] + Hash with nested hash of key => value to set in inifile

    + +

    [package] + Specify which package to install

    + +

    [ensure] + Specify which version of the package to install

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: $::php::ensure) + + +
    • + +
    • + + package + + + (String) + + + (defaults to: "${::php::package_prefix}${::php::params::embedded_package_suffix}") + + +
    • + +
    • + + inifile + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::embedded_inifile) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +
    +
    # File 'manifests/embedded.pp', line 17
    +
    +class php::embedded(
    +  String $ensure                = $::php::ensure,
    +  String $package               = "${::php::package_prefix}${::php::params::embedded_package_suffix}",
    +  Stdlib::Absolutepath $inifile = $::php::params::embedded_inifile,
    +  Hash $settings                = {},
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::embedded is private')
    +  }
    +
    +  $real_settings = deep_merge(
    +    $settings,
    +    hiera_hash('php::embedded::settings', {})
    +  )
    +
    +  $real_package = $facts['os']['family'] ? {
    +    'Debian' => "lib${package}",
    +    default   => $package,
    +  }
    +
    +  package { $real_package:
    +    ensure  => $ensure,
    +    require => Class['::php::packages'],
    +  }
    +  -> ::php::config { 'embedded':
    +    file   => $inifile,
    +    config => $real_settings,
    +  }
    +
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Afpm.html b/docs/puppet_classes/php_3A_3Afpm.html new file mode 100644 index 00000000..0652b66f --- /dev/null +++ b/docs/puppet_classes/php_3A_3Afpm.html @@ -0,0 +1,482 @@ + + + + + + + Puppet Class: php::fpm + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::fpm

    +
    + + +
    +
    Defined in:
    +
    + manifests/fpm.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install and configure mod_php for fpm

    + +

    === Parameters

    + +

    [user] + The user that php-fpm should run as

    + +

    [group] + The group that php-fpm should run as

    + +

    [service_enable] + Enable/disable FPM service

    + +

    [service_ensure] + Ensure FPM service is either 'running' or 'stopped'

    + +

    [service_name] + This is the name of the php-fpm service. It defaults to reasonable OS + defaults but can be different in case of using php7.0/other OS/custom fpm service

    + +

    [service_provider] + This is the name of the service provider, in case there is a non + OS default service provider used to start FPM. + Defaults to 'undef', pick system defaults.

    + +

    [pools] + Hash of php::fpm::pool resources that will be created. Defaults + to a single php::fpm::pool named www with default parameters.

    + +

    [log_owner] + The php-fpm log owner

    + +

    [log_group] + The group owning php-fpm logs

    + +

    [package] + Specify which package to install

    + +

    [ensure] + Specify which version of the package to install

    + +

    [inifile] + Path to php.ini for fpm

    + +

    [settings] + fpm settings hash

    + +

    [global_pool_settings] + Hash of defaults params php::fpm::pool resources that will be created. + Defaults is empty hash.

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: $::php::ensure) + + +
    • + +
    • + + user + + + (Any) + + + (defaults to: $::php::fpm_user) + + +
    • + +
    • + + group + + + (Any) + + + (defaults to: $::php::fpm_group) + + +
    • + +
    • + + service_ensure + + + (Any) + + + (defaults to: $::php::fpm_service_ensure) + + +
    • + +
    • + + service_enable + + + (Any) + + + (defaults to: $::php::fpm_service_enable) + + +
    • + +
    • + + service_name + + + (Any) + + + (defaults to: $::php::fpm_service_name) + + +
    • + +
    • + + service_provider + + + (Any) + + + (defaults to: $::php::fpm_service_provider) + + +
    • + +
    • + + package + + + (String) + + + (defaults to: $::php::real_fpm_package) + + +
    • + +
    • + + inifile + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::fpm_inifile) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: $::php::real_settings) + + +
    • + +
    • + + global_pool_settings + + + (Any) + + + (defaults to: $::php::real_fpm_global_pool_settings) + + +
    • + +
    • + + pools + + + (Hash) + + + (defaults to: $::php::real_fpm_pools) + + +
    • + +
    • + + log_owner + + + (Any) + + + (defaults to: $::php::log_owner) + + +
    • + +
    • + + log_group + + + (Any) + + + (defaults to: $::php::log_group) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +
    +
    # File 'manifests/fpm.pp', line 52
    +
    +class php::fpm (
    +  String $ensure                = $::php::ensure,
    +  $user                         = $::php::fpm_user,
    +  $group                        = $::php::fpm_group,
    +  $service_ensure               = $::php::fpm_service_ensure,
    +  $service_enable               = $::php::fpm_service_enable,
    +  $service_name                 = $::php::fpm_service_name,
    +  $service_provider             = $::php::fpm_service_provider,
    +  String $package               = $::php::real_fpm_package,
    +  Stdlib::Absolutepath $inifile = $::php::fpm_inifile,
    +  Hash $settings                = $::php::real_settings,
    +  $global_pool_settings         = $::php::real_fpm_global_pool_settings,
    +  Hash $pools                   = $::php::real_fpm_pools,
    +  $log_owner                    = $::php::log_owner,
    +  $log_group                    = $::php::log_group,
    +) {
    +
    +  if ! defined(Class['php']) {
    +    warning('php::fpm is private')
    +  }
    +
    +  $real_settings = deep_merge($settings, hiera_hash('php::fpm::settings', {}))
    +
    +  # On FreeBSD fpm is not a separate package, but included in the 'php' package.
    +  # Implies that the option SET+=FPM was set when building the port.
    +  $real_package = $facts['os']['family'] ? {
    +    'FreeBSD' => [],
    +    default   => $package,
    +  }
    +
    +  package { $real_package:
    +    ensure  => $ensure,
    +    require => Class['::php::packages'],
    +  }
    +
    +  class { '::php::fpm::config':
    +    user      => $user,
    +    group     => $group,
    +    inifile   => $inifile,
    +    settings  => $real_settings,
    +    log_owner => $log_owner,
    +    log_group => $log_group,
    +    require   => Package[$real_package],
    +  }
    +  contain '::php::fpm::config'
    +  contain '::php::fpm::service'
    +
    +  Class['php::fpm::config'] ~> Class['php::fpm::service']
    +
    +  $real_global_pool_settings = hiera_hash('php::fpm::global_pool_settings', $global_pool_settings)
    +  $real_pools = hiera_hash('php::fpm::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],
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Afpm_3A_3Aconfig.html b/docs/puppet_classes/php_3A_3Afpm_3A_3Aconfig.html new file mode 100644 index 00000000..8dbc6439 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Afpm_3A_3Aconfig.html @@ -0,0 +1,596 @@ + + + + + + + Puppet Class: php::fpm::config + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::fpm::config

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/fpm/config.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure php-fpm service

    + +

    === Parameters

    + +

    [config_file] + The path to the fpm config file

    + +

    [user] + The user that runs php-fpm

    + +

    [group] + The group that runs php-fpm

    + +

    [inifile] + The path to ini file

    + +

    [settings] + Nested hash of key => value to apply to php.ini

    + +

    [pool_base_dir] + The folder that contains the php-fpm pool configs

    + +

    [pool_purge] + Whether to purge pool config files not created + by this module

    + +

    [error_log] + Path to error log file. If it's set to "syslog", log is + sent to syslogd instead of being written in a local file.

    + +

    [log_level] + The php-fpm log level

    + +

    [emergency_restart_threshold] + The php-fpm emergency_restart_threshold

    + +

    [emergency_restart_interval] + The php-fpm emergency_restart_interval

    + +

    [process_control_timeout] + The php-fpm process_control_timeout

    + +

    [process_max] + The maximum number of processes FPM will fork.

    + +

    [rlimit_files] + Set open file descriptor rlimit for the master process.

    + +

    [systemd_interval] + The interval between health report notification to systemd

    + +

    [log_owner] + The php-fpm log owner

    + +

    [log_group] + The group owning php-fpm logs

    + +

    [log_dir_mode] + The octal mode of the directory

    + +

    [syslog_facility] + Used to specify what type of program is logging the message

    + +

    [syslog_ident] + Prepended to every message

    + +

    [root_group] + UNIX group of the root user

    + +

    [pid_file] + Path to fpm pid file

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + config_file + + + (Any) + + + (defaults to: $::php::params::fpm_config_file) + + +
    • + +
    • + + user + + + (String) + + + (defaults to: $::php::params::fpm_user) + + +
    • + +
    • + + group + + + (String) + + + (defaults to: $::php::params::fpm_group) + + +
    • + +
    • + + inifile + + + (String) + + + (defaults to: $::php::params::fpm_inifile) + + +
    • + +
    • + + pid_file + + + (Any) + + + (defaults to: $::php::params::fpm_pid_file) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    • + + pool_base_dir + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::fpm_pool_dir) + + +
    • + +
    • + + pool_purge + + + (Any) + + + (defaults to: false) + + +
    • + +
    • + + error_log + + + (String) + + + (defaults to: $::php::params::fpm_error_log) + + +
    • + +
    • + + log_level + + + (String) + + + (defaults to: 'notice') + + +
    • + +
    • + + emergency_restart_threshold + + + (Integer) + + + (defaults to: 0) + + +
    • + +
    • + + emergency_restart_interval + + + (Variant[Integer, Pattern[/^\d+[smhd]?$/]]) + + + (defaults to: 0) + + +
    • + +
    • + + process_control_timeout + + + (Variant[Integer, Pattern[/^\d+[smhd]?$/]]) + + + (defaults to: 0) + + +
    • + +
    • + + process_max + + + (Integer) + + + (defaults to: 0) + + +
    • + +
    • + + rlimit_files + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + systemd_interval + + + (Optional[Variant[Integer,Pattern[/^\d+[smhd]?$/]]]) + + + (defaults to: undef) + + +
    • + +
    • + + log_owner + + + (String) + + + (defaults to: $::php::params::fpm_user) + + +
    • + +
    • + + log_group + + + (String) + + + (defaults to: $::php::params::fpm_group) + + +
    • + +
    • + + log_dir_mode + + + (Pattern[/^\d+$/]) + + + (defaults to: '0770') + + +
    • + +
    • + + root_group + + + (Any) + + + (defaults to: $::php::params::root_group) + + +
    • + +
    • + + syslog_facility + + + (String) + + + (defaults to: 'daemon') + + +
    • + +
    • + + syslog_ident + + + (String) + + + (defaults to: 'php-fpm') + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +
    +
    # File 'manifests/fpm/config.pp', line 73
    +
    +class php::fpm::config(
    +  $config_file                                                          = $::php::params::fpm_config_file,
    +  String $user                                                          = $::php::params::fpm_user,
    +  String $group                                                         = $::php::params::fpm_group,
    +  String $inifile                                                       = $::php::params::fpm_inifile,
    +  $pid_file                                                             = $::php::params::fpm_pid_file,
    +  Hash $settings                                                        = {},
    +  Stdlib::Absolutepath $pool_base_dir                                   = $::php::params::fpm_pool_dir,
    +  $pool_purge                                                           = false,
    +  String $error_log                                                     = $::php::params::fpm_error_log,
    +  String $log_level                                                     = 'notice',
    +  Integer $emergency_restart_threshold                                  = 0,
    +  Variant[Integer, Pattern[/^\d+[smhd]?$/]] $emergency_restart_interval = 0,
    +  Variant[Integer, Pattern[/^\d+[smhd]?$/]] $process_control_timeout    = 0,
    +  Integer $process_max                                                  = 0,
    +  $rlimit_files                                                         = undef,
    +  Optional[Variant[Integer,Pattern[/^\d+[smhd]?$/]]] $systemd_interval  = undef,
    +  String $log_owner                                                     = $::php::params::fpm_user,
    +  String $log_group                                                     = $::php::params::fpm_group,
    +  Pattern[/^\d+$/] $log_dir_mode                                        = '0770',
    +  $root_group                                                           = $::php::params::root_group,
    +  String $syslog_facility                                               = 'daemon',
    +  String $syslog_ident                                                  = 'php-fpm',
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::fpm::config is private')
    +  }
    +
    +  # Hack-ish to default to user for group too
    +  $log_group_final = $log_group ? {
    +    undef   => $log_owner,
    +    default => $log_group,
    +  }
    +
    +  file { $config_file:
    +    ensure  => file,
    +    content => template('php/fpm/php-fpm.conf.erb'),
    +    owner   => root,
    +    group   => $root_group,
    +    mode    => '0644',
    +  }
    +
    +  file { $pool_base_dir:
    +    ensure => directory,
    +    owner  => root,
    +    group  => $root_group,
    +    mode   => '0755',
    +  }
    +
    +  if $pool_purge {
    +    File[$pool_base_dir] {
    +      purge   => true,
    +      recurse => true,
    +    }
    +  }
    +
    +  ::php::config { 'fpm':
    +    file   => $inifile,
    +    config => $settings,
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Afpm_3A_3Aservice.html b/docs/puppet_classes/php_3A_3Afpm_3A_3Aservice.html new file mode 100644 index 00000000..8bd9175f --- /dev/null +++ b/docs/puppet_classes/php_3A_3Afpm_3A_3Aservice.html @@ -0,0 +1,245 @@ + + + + + + + Puppet Class: php::fpm::service + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::fpm::service

    +
    + + +
    +
    Defined in:
    +
    + manifests/fpm/service.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Manage fpm service

    + +

    === Parameters

    + +

    [service_name] + name of the php-fpm service

    + +

    [ensure] + 'ensure' value for the service

    + +

    [enable] + Defines if the service is enabled

    + +

    [provider] + Defines if the service provider to use

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + service_name + + + (Any) + + + (defaults to: $::php::fpm::service_name) + + +
    • + +
    • + + ensure + + + (Any) + + + (defaults to: $::php::fpm::service_ensure) + + +
    • + +
    • + + enable + + + (Any) + + + (defaults to: $::php::fpm::service_enable) + + +
    • + +
    • + + provider + + + (Any) + + + (defaults to: $::php::fpm::service_provider) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +
    +
    # File 'manifests/fpm/service.pp', line 17
    +
    +class php::fpm::service(
    +  $service_name = $::php::fpm::service_name,
    +  $ensure       = $::php::fpm::service_ensure,
    +  $enable       = $::php::fpm::service_enable,
    +  $provider     = $::php::fpm::service_provider,
    +) {
    +
    +  if ! defined(Class['php::fpm']) {
    +    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
    +  }
    +
    +  service { $service_name:
    +    ensure     => $ensure,
    +    enable     => $enable,
    +    provider   => $provider,
    +    hasrestart => true,
    +    restart    => $restart,
    +    hasstatus  => true,
    +  }
    +
    +  ::Php::Extension <| |> ~> Service[$service_name]
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Aglobal.html b/docs/puppet_classes/php_3A_3Aglobal.html new file mode 100644 index 00000000..cf160e7a --- /dev/null +++ b/docs/puppet_classes/php_3A_3Aglobal.html @@ -0,0 +1,175 @@ + + + + + + + Puppet Class: php::global + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::global

    +
    + +
    +
    Inherits:
    +
    ::php
    +
    + + +
    +
    Defined in:
    +
    + manifests/global.pp +
    +
    +
    + +

    Overview

    +
    +
    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + inifile + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::config_root_inifile) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +
    +
    # File 'manifests/global.pp', line 14
    +
    +class php::global(
    +  Stdlib::Absolutepath $inifile = $::php::config_root_inifile,
    +  Hash $settings                = {}
    +) inherits ::php {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::global is private')
    +  }
    +
    +  # No deep merging required since the settings we have are the global settings.
    +  $real_settings = $settings
    +
    +  ::php::config { 'global':
    +    file   => $inifile,
    +    config => $real_settings,
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Aglobals.html b/docs/puppet_classes/php_3A_3Aglobals.html new file mode 100644 index 00000000..445b935e --- /dev/null +++ b/docs/puppet_classes/php_3A_3Aglobals.html @@ -0,0 +1,384 @@ + + + + + + + Puppet Class: php::globals + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::globals

    +
    + + +
    +
    Inherited by:
    +
    + + php::params
    + +
    +
    + +
    +
    Defined in:
    +
    + manifests/globals.pp +
    +
    +
    + +

    Overview

    +
    +
    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + php_version + + + (Optional[Pattern[/^[57].[0-9]/]]) + + + (defaults to: undef) + + +
    • + +
    • + + config_root + + + (Optional[Stdlib::Absolutepath]) + + + (defaults to: undef) + + +
    • + +
    • + + fpm_pid_file + + + (Optional[Stdlib::Absolutepath]) + + + (defaults to: undef) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +
    +
    # File 'manifests/globals.pp', line 14
    +
    +class php::globals (
    +  Optional[Pattern[/^[57].[0-9]/]] $php_version = undef,
    +  Optional[Stdlib::Absolutepath] $config_root   = undef,
    +  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 => '5.x',
    +    },
    +    default => '5.x',
    +  }
    +
    +  $globals_php_version = pick($php_version, $default_php_version)
    +
    +  case $facts['os']['family'] {
    +    '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"
    +            $fpm_error_log        = "/var/log/php${globals_php_version}-fpm.log"
    +            $fpm_service_name     = "php${globals_php_version}-fpm"
    +            $ext_tool_enable      = "/usr/sbin/phpenmod -v ${globals_php_version}"
    +            $ext_tool_query       = "/usr/sbin/phpquery -v ${globals_php_version}"
    +            $package_prefix       = "php${globals_php_version}-"
    +          }
    +          default: {
    +            # Default php installation from Ubuntu official repository use the following paths until 16.04
    +            # For PPA please use the $php_version to override it.
    +            $default_config_root  = '/etc/php5'
    +            $default_fpm_pid_file = '/var/run/php5-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-'
    +          }
    +        }
    +      } else {
    +        case $globals_php_version {
    +          /^7/: {
    +            $default_config_root  = "/etc/php/${globals_php_version}"
    +            $default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
    +            $fpm_error_log        = "/var/log/php${globals_php_version}-fpm.log"
    +            $fpm_service_name     = "php${globals_php_version}-fpm"
    +            $ext_tool_enable      = "/usr/sbin/phpenmod -v ${globals_php_version}"
    +            $ext_tool_query       = "/usr/sbin/phpquery -v ${globals_php_version}"
    +            $package_prefix       = "php${globals_php_version}-"
    +          }
    +          default: {
    +            $default_config_root  = '/etc/php5'
    +            $default_fpm_pid_file = '/var/run/php5-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-'
    +          }
    +        }
    +      }
    +    }
    +    'Suse': {
    +      case $globals_php_version {
    +        /^7/: {
    +          $default_config_root  = '/etc/php7'
    +          $package_prefix       = 'php7-'
    +          $default_fpm_pid_file = '/var/run/php7-fpm.pid'
    +          $fpm_error_log        = '/var/log/php7-fpm.log'
    +        }
    +        default: {
    +          $default_config_root  = '/etc/php5'
    +          $package_prefix       = 'php5-'
    +          $default_fpm_pid_file = '/var/run/php5-fpm.pid'
    +          $fpm_error_log        = '/var/log/php5-fpm.log'
    +        }
    +      }
    +    }
    +    'RedHat': {
    +      $default_config_root  = '/etc/php.d'
    +      $default_fpm_pid_file = '/var/run/php-fpm/php-fpm.pid'
    +    }
    +    'FreeBSD': {
    +      $default_config_root  = '/usr/local/etc'
    +      $default_fpm_pid_file = '/var/run/php-fpm.pid'
    +    }
    +    'Archlinux': {
    +      $default_config_root  =  '/etc/php'
    +      $default_fpm_pid_file = '/run/php-fpm/php-fpm.pid'
    +    }
    +    default: {
    +      fail("Unsupported osfamily: ${facts['os']['family']}")
    +    }
    +  }
    +
    +  $globals_config_root = pick($config_root, $default_config_root)
    +
    +  $globals_fpm_pid_file = pick($fpm_pid_file, $default_fpm_pid_file)
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Apackages.html b/docs/puppet_classes/php_3A_3Apackages.html new file mode 100644 index 00000000..47cf51e0 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Apackages.html @@ -0,0 +1,232 @@ + + + + + + + Puppet Class: php::packages + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::packages

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/packages.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install common PHP packages

    + +

    === Parameters

    + +

    [ensure] + Specify which version of PHP packages to install

    + +

    [names] + List of the names of the package to install

    + +

    [names_to_prefix] + List of packages names that should be prefixed with the common + package prefix $php::package_prefix

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: $::php::ensure) + + +
    • + +
    • + + manage_repos + + + (Boolean) + + + (defaults to: $::php::manage_repos) + + +
    • + +
    • + + names_to_prefix + + + (Array) + + + (defaults to: prefix($::php::params::common_package_suffixes, $::php::package_prefix)) + + +
    • + +
    • + + names + + + (Array) + + + (defaults to: $::php::params::common_package_names) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +
    +
    # File 'manifests/packages.pp', line 15
    +
    +class php::packages (
    +  String $ensure         = $::php::ensure,
    +  Boolean $manage_repos  = $::php::manage_repos,
    +  Array $names_to_prefix = prefix($::php::params::common_package_suffixes, $::php::package_prefix),
    +  Array $names           = $::php::params::common_package_names,
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::packages is private')
    +  }
    +
    +  $real_names = union($names, $names_to_prefix)
    +  if $facts['os']['family'] == 'debian' {
    +    if $manage_repos {
    +      include ::apt
    +      Class['::apt::update'] -> Package[$real_names]
    +    }
    +    package { $real_names:
    +      ensure => $ensure,
    +    }
    +  } else {
    +    package { $real_names:
    +      ensure => $ensure,
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Aparams.html b/docs/puppet_classes/php_3A_3Aparams.html new file mode 100644 index 00000000..5092403d --- /dev/null +++ b/docs/puppet_classes/php_3A_3Aparams.html @@ -0,0 +1,490 @@ + + + + + + + Puppet Class: php::params + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::params

    +
    + +
    +
    Inherits:
    +
    php::globals
    +
    + + +
    +
    Defined in:
    +
    + manifests/params.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    PHP params class

    + +
    +
    +
    + + +
    + + + + + +
    +
    +
    +
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +
    +
    # File 'manifests/params.pp', line 3
    +
    +class php::params inherits php::globals {
    +
    +  $ensure              = 'present'
    +  $fpm_service_enable  = true
    +  $fpm_service_ensure  = 'running'
    +  $composer_source     = 'https://getcomposer.org/composer.phar'
    +  $composer_path       = '/usr/local/bin/composer'
    +  $composer_max_age    = 30
    +  $pear_ensure         = 'present'
    +  $pear_package_suffix = 'pear'
    +  $phpunit_source      = 'https://phar.phpunit.de/phpunit.phar'
    +  $phpunit_path        = '/usr/local/bin/phpunit'
    +  $phpunit_max_age     = 30
    +
    +  case $facts['os']['family'] {
    +    'Debian': {
    +      $config_root             = $php::globals::globals_config_root
    +      $config_root_ini         = "${config_root}/mods-available"
    +      $config_root_inifile     = "${config_root}/php.ini"
    +      $common_package_names    = []
    +      $common_package_suffixes = ['cli', 'common']
    +      $cli_inifile             = "${config_root}/cli/php.ini"
    +      $dev_package_suffix      = 'dev'
    +      $fpm_pid_file            = $php::globals::globals_fpm_pid_file
    +      $fpm_config_file         = "${config_root}/fpm/php-fpm.conf"
    +      $fpm_error_log           = $php::globals::fpm_error_log
    +      $fpm_inifile             = "${config_root}/fpm/php.ini"
    +      $fpm_package_suffix      = 'fpm'
    +      $fpm_pool_dir            = "${config_root}/fpm/pool.d"
    +      $fpm_service_name        = $php::globals::fpm_service_name
    +      $fpm_user                = 'www-data'
    +      $fpm_group               = 'www-data'
    +      $apache_inifile          = "${config_root}/apache2/php.ini"
    +      $embedded_package_suffix = 'embed'
    +      $embedded_inifile        = "${config_root}/embed/php.ini"
    +      $package_prefix          = $php::globals::package_prefix
    +      $compiler_packages       = 'build-essential'
    +      $root_group              = 'root'
    +      $ext_tool_enable         = $php::globals::ext_tool_enable
    +      $ext_tool_query          = $php::globals::ext_tool_query
    +      $ext_tool_enabled        = true
    +
    +      case $facts['os']['name'] {
    +        'Debian': {
    +          $manage_repos = (versioncmp($facts['os']['release']['major'], '8') < 0)
    +        }
    +
    +        'Ubuntu': {
    +          $manage_repos = false
    +        }
    +
    +        default: {
    +          $manage_repos = false
    +        }
    +      }
    +    }
    +
    +    'Suse': {
    +      if ($php::globals::php_version != undef) {
    +        $php_version_major = regsubst($php::globals::php_version, '^(\d+)\.(\d+)$','\1')
    +      } else {
    +        $php_version_major = 5
    +      }
    +
    +      $config_root             = $php::globals::globals_config_root
    +      $config_root_ini         = "${config_root}/conf.d"
    +      $config_root_inifile     = "${config_root}/php.ini"
    +      $common_package_names    = ["php${php_version_major}"]
    +      $common_package_suffixes = []
    +      $cli_inifile             = "${config_root}/cli/php.ini"
    +      $dev_package_suffix      = 'devel'
    +      $fpm_pid_file            = $php::globals::globals_fpm_pid_file
    +      $fpm_config_file         = "${config_root}/fpm/php-fpm.conf"
    +      $fpm_error_log           = $php::globals::fpm_error_log
    +      $fpm_inifile             = "${config_root}/fpm/php.ini"
    +      $fpm_package_suffix      = 'fpm'
    +      $fpm_pool_dir            = "${config_root}/fpm/pool.d"
    +      $fpm_service_name        = 'php-fpm'
    +      $fpm_user                = 'wwwrun'
    +      $fpm_group               = 'www'
    +      $embedded_package_suffix = 'embed'
    +      $embedded_inifile        = "${config_root}/embed/php.ini"
    +      $package_prefix          = $php::globals::package_prefix
    +      $manage_repos            = true
    +      $root_group              = 'root'
    +      $ext_tool_enable         = undef
    +      $ext_tool_query          = undef
    +      $ext_tool_enabled        = false
    +      case $facts['os']['name'] {
    +        'SLES': {
    +          $compiler_packages = []
    +        }
    +        'OpenSuSE': {
    +          $compiler_packages = 'devel_basis'
    +        }
    +        default: {
    +          fail("Unsupported operating system ${facts['os']['name']}")
    +        }
    +      }
    +    }
    +    'RedHat': {
    +      $config_root_ini         = '/etc/php.d'
    +      $config_root_inifile     = '/etc/php.ini'
    +      $common_package_names    = []
    +      $common_package_suffixes = ['cli', 'common']
    +      $cli_inifile             = '/etc/php-cli.ini'
    +      $dev_package_suffix      = 'devel'
    +      $fpm_pid_file            = $php::globals::globals_fpm_pid_file
    +      $fpm_config_file         = '/etc/php-fpm.conf'
    +      $fpm_error_log           = '/var/log/php-fpm/error.log'
    +      $fpm_inifile             = '/etc/php-fpm.ini'
    +      $fpm_package_suffix      = 'fpm'
    +      $fpm_pool_dir            = '/etc/php-fpm.d'
    +      $fpm_service_name        = 'php-fpm'
    +      $fpm_user                = 'apache'
    +      $fpm_group               = 'apache'
    +      $apache_inifile          = '/etc/php.ini'
    +      $embedded_package_suffix = 'embedded'
    +      $embedded_inifile        = '/etc/php.ini'
    +      $package_prefix          = 'php-'
    +      $compiler_packages       = ['gcc', 'gcc-c++', 'make']
    +      $manage_repos            = false
    +      $root_group              = 'root'
    +      $ext_tool_enable         = undef
    +      $ext_tool_query          = undef
    +      $ext_tool_enabled        = false
    +    }
    +    'FreeBSD': {
    +      $config_root             = $php::globals::globals_config_root
    +      $config_root_ini         = "${config_root}/php"
    +      $config_root_inifile     = "${config_root}/php.ini"
    +      # No common packages, because the required PHP base package will be
    +      # pulled in as a dependency. This preserves the ability to choose
    +      # any available PHP version by setting the 'package_prefix' parameter.
    +      $common_package_names    = []
    +      $common_package_suffixes = ['extensions']
    +      $cli_inifile             = "${config_root}/php-cli.ini"
    +      $dev_package_suffix      = undef
    +      $fpm_pid_file            = $php::globals::globals_fpm_pid_file
    +      $fpm_config_file         = "${config_root}/php-fpm.conf"
    +      $fpm_error_log           = '/var/log/php-fpm.log'
    +      $fpm_inifile             = "${config_root}/php-fpm.ini"
    +      $fpm_package_suffix      = undef
    +      $fpm_pool_dir            = "${config_root}/php-fpm.d"
    +      $fpm_service_name        = 'php-fpm'
    +      $fpm_user                = 'www'
    +      $fpm_group               = 'www'
    +      $embedded_package_suffix = 'embed'
    +      $embedded_inifile        = "${config_root}/php-embed.ini"
    +      $package_prefix          = 'php56-'
    +      $compiler_packages       = ['gcc']
    +      $manage_repos            = false
    +      $root_group              = 'wheel'
    +      $ext_tool_enable         = undef
    +      $ext_tool_query          = undef
    +      $ext_tool_enabled        = false
    +    }
    +    'Archlinux': {
    +      $config_root_ini         = '/etc/php/conf.d'
    +      $config_root_inifile     = '/etc/php/php.ini'
    +      $common_package_names    = []
    +      $common_package_suffixes = ['cli', 'common']
    +      $cli_inifile             = '/etc/php/php.ini'
    +      $dev_package_suffix      = undef
    +      $fpm_pid_file            = '/run/php-fpm/php-fpm.pid'
    +      $fpm_config_file         = '/etc/php/php-fpm.conf'
    +      $fpm_error_log           = '/var/log/php-fpm/error.log'
    +      $fpm_inifile             = '/etc/php/php.ini'
    +      $fpm_package_suffix      = 'fpm'
    +      $fpm_pool_dir            = '/etc/php/php-fpm.d'
    +      $fpm_service_name        = 'php-fpm'
    +      $fpm_user                = 'root'
    +      $fpm_group               = 'root'
    +      $apache_inifile          = '/etc/php/php.ini'
    +      $embedded_package_suffix = 'embedded'
    +      $embedded_inifile        = '/etc/php/php.ini'
    +      $package_prefix          = 'php-'
    +      $compiler_packages       = ['gcc', 'make']
    +      $manage_repos            = false
    +      $root_group              = 'root'
    +      $ext_tool_enable         = undef
    +      $ext_tool_query          = undef
    +      $ext_tool_enabled        = false
    +    }
    +    default: {
    +      fail("Unsupported osfamily: ${facts['os']['family']}")
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Apear.html b/docs/puppet_classes/php_3A_3Apear.html new file mode 100644 index 00000000..29b72d5c --- /dev/null +++ b/docs/puppet_classes/php_3A_3Apear.html @@ -0,0 +1,258 @@ + + + + + + + Puppet Class: php::pear + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::pear

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/pear.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install PEAR package manager

    + +

    === Parameters

    + +

    [ensure] + The package ensure of PHP pear to install and run pear auto_discover

    + +

    [package] + The package name for PHP pear

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: $::php::pear_ensure) + + +
    • + +
    • + + package + + + (Optional[String]) + + + (defaults to: undef) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +
    +
    # File 'manifests/pear.pp', line 11
    +
    +class php::pear (
    +  String $ensure            = $::php::pear_ensure,
    +  Optional[String] $package = undef,
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::pear is private')
    +  }
    +
    +  # Defaults for the pear package name
    +  if $package {
    +    $package_name = $package
    +  } else {
    +    case $facts['os']['family'] {
    +      'Debian': {
    +        # Debian is a litte stupid: The pear package is called 'php-pear'
    +        # even though others are called 'php5-fpm' or 'php5-dev'
    +        $package_name = "php-${::php::params::pear_package_suffix}"
    +      }
    +      'Amazon': {
    +        # On Amazon Linux the package name is also just 'php-pear'.
    +        # This would normally not be problematic but if you specify a
    +        # package_prefix other than 'php' then it will fail.
    +        $package_name = "php-${::php::params::pear_package_suffix}"
    +      }
    +      'FreeBSD': {
    +        # On FreeBSD the package name is just 'pear'.
    +        $package_name = $::php::params::pear_package_suffix
    +      }
    +      default: {
    +        # This is the default for all other architectures
    +        $package_name = "${::php::package_prefix}${::php::params::pear_package_suffix}"
    +      }
    +    }
    +  }
    +
    +  # 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 {
    +    ensure_packages(["${php::package_prefix}xml"], {
    +      ensure  => present,
    +      require => Class['::apt::update'],
    +    })
    +
    +    package { $package_name:
    +      ensure  => $ensure,
    +      require => [Class['::apt::update'],Class['::php::cli'],Package["${php::package_prefix}xml"]],
    +    }
    +  } else {
    +    package { $package_name:
    +      ensure  => $ensure,
    +      require => Class['::php::cli'],
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Aphpunit.html b/docs/puppet_classes/php_3A_3Aphpunit.html new file mode 100644 index 00000000..582bc416 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Aphpunit.html @@ -0,0 +1,248 @@ + + + + + + + Puppet Class: php::phpunit + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::phpunit

    +
    + +
    +
    Inherits:
    +
    ::php::params
    +
    + + +
    +
    Defined in:
    +
    + manifests/phpunit.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install phpunit, PHP testing framework

    + +

    === Parameters

    + +

    [source] + Holds URL to the phpunit source file

    + +

    [path] + Holds path to the phpunit executable

    + +

    [auto_update] + Defines if phpunit should be auto updated

    + +

    [max_age] + Defines the time in days after which an auto-update gets executed

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + source + + + (String) + + + (defaults to: $::php::params::phpunit_source) + + +
    • + +
    • + + path + + + (Stdlib::Absolutepath) + + + (defaults to: $::php::params::phpunit_path) + + +
    • + +
    • + + auto_update + + + (Boolean) + + + (defaults to: true) + + +
    • + +
    • + + max_age + + + (Integer) + + + (defaults to: $::php::params::phpunit_max_age) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +
    +
    # File 'manifests/phpunit.pp', line 17
    +
    +class php::phpunit (
    +  String $source             = $::php::params::phpunit_source,
    +  Stdlib::Absolutepath $path = $::php::params::phpunit_path,
    +  Boolean $auto_update       = true,
    +  Integer $max_age           = $::php::params::phpunit_max_age,
    +) inherits ::php::params {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::phpunit is private')
    +  }
    +
    +  ensure_packages(['wget'])
    +
    +  exec { 'download phpunit':
    +    command => "wget ${source} -O ${path}",
    +    creates => $path,
    +    path    => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/'],
    +    require => [Class['::php::cli'],Package['wget']],
    +  }
    +  -> file { $path:
    +    mode  => '0555',
    +    owner => root,
    +    group => root,
    +  }
    +
    +  if $auto_update {
    +    class { '::php::phpunit::auto_update':
    +      max_age => $max_age,
    +      source  => $source,
    +      path    => $path,
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Aphpunit_3A_3Aauto_update.html b/docs/puppet_classes/php_3A_3Aphpunit_3A_3Aauto_update.html new file mode 100644 index 00000000..8f18a304 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Aphpunit_3A_3Aauto_update.html @@ -0,0 +1,189 @@ + + + + + + + Puppet Class: php::phpunit::auto_update + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::phpunit::auto_update

    +
    + + +
    +
    Defined in:
    +
    + manifests/phpunit/auto_update.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install phpunit package manager

    + +

    === Parameters

    + +

    [max_age] + Defines number of days after which phpunit should be updated

    + +

    [source] + Holds URL to the phpunit source file

    + +

    [path] + Holds path to the phpunit executable

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + max_age + + + (Any) + + + +
    • + +
    • + + source + + + (Any) + + + +
    • + +
    • + + path + + + (Any) + + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +
    +
    # File 'manifests/phpunit/auto_update.pp', line 14
    +
    +class php::phpunit::auto_update (
    +  $max_age,
    +  $source,
    +  $path,
    +) {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::phpunit::auto_update is private')
    +  }
    +
    +  exec { 'update phpunit':
    +    command => "wget ${source} -O ${path}",
    +    onlyif  => "test `find '${path}' -mtime +${max_age}`",
    +    path    => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ],
    +    require => File[$path],
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Arepo.html b/docs/puppet_classes/php_3A_3Arepo.html new file mode 100644 index 00000000..21009ea7 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Arepo.html @@ -0,0 +1,169 @@ + + + + + + + Puppet Class: php::repo + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::repo

    +
    + + +
    +
    Defined in:
    +
    + manifests/repo.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure package repository

    + +
    +
    +
    + + +
    + + + + + +
    +
    +
    +
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +
    +
    # File 'manifests/repo.pp', line 3
    +
    +class php::repo {
    +
    +  $msg_no_repo = "No repo available for ${facts['os']['family']}/${facts['os']['name']}"
    +
    +  case $facts['os']['family'] {
    +    'Debian': {
    +      # no contain here because apt does that already
    +      case $facts['os']['name'] {
    +        'Debian': {
    +          include ::php::repo::debian
    +        }
    +        'Ubuntu': {
    +          include ::php::repo::ubuntu
    +        }
    +        default: {
    +          fail($msg_no_repo)
    +        }
    +      }
    +    }
    +    'FreeBSD': {}
    +    'Suse': {
    +      contain ::php::repo::suse
    +    }
    +    'RedHat': {
    +      contain '::php::repo::redhat'
    +    }
    +    default: {
    +      fail($msg_no_repo)
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Arepo_3A_3Adebian.html b/docs/puppet_classes/php_3A_3Arepo_3A_3Adebian.html new file mode 100644 index 00000000..d58c119f --- /dev/null +++ b/docs/puppet_classes/php_3A_3Arepo_3A_3Adebian.html @@ -0,0 +1,312 @@ + + + + + + + Puppet Class: php::repo::debian + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::repo::debian

    +
    + + +
    +
    Defined in:
    +
    + manifests/repo/debian.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure debian apt repo

    + +

    === Parameters

    + +

    [location] + Location of the apt repository

    + +

    [release] + Release of the apt repository

    + +

    [repos] + Apt repository names

    + +

    [include_src] + Add source source repository

    + +

    [key] + Public key in apt::key format

    + +

    [dotdeb] + Enable special dotdeb handling

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + location + + + (Any) + + + (defaults to: 'http://packages.dotdeb.org') + + +
    • + +
    • + + release + + + (Any) + + + (defaults to: 'wheezy-php56') + + +
    • + +
    • + + repos + + + (Any) + + + (defaults to: 'all') + + +
    • + +
    • + + include_src + + + (Any) + + + (defaults to: false) + + +
    • + +
    • + + key + + + (Any) + + + (defaults to: { + 'id' => '6572BBEF1B5FF28B28B706837E3F070089DF5277', + 'source' => 'http://www.dotdeb.org/dotdeb.gpg', + }) + + +
    • + +
    • + + dotdeb + + + (Any) + + + (defaults to: true) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +
    +
    # File 'manifests/repo/debian.pp', line 23
    +
    +class php::repo::debian(
    +  $location     = 'http://packages.dotdeb.org',
    +  $release      = 'wheezy-php56',
    +  $repos        = 'all',
    +  $include_src  = false,
    +  $key          = {
    +    'id'     => '6572BBEF1B5FF28B28B706837E3F070089DF5277',
    +    'source' => 'http://www.dotdeb.org/dotdeb.gpg',
    +  },
    +  $dotdeb       = true,
    +) {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::repo::debian is private')
    +  }
    +
    +  include '::apt'
    +
    +  create_resources(::apt::key, { 'php::repo::debian' => {
    +    id     => $key['id'],
    +    source => $key['source'],
    +  }})
    +
    +  ::apt::source { "source_php_${release}":
    +    location => $location,
    +    release  => $release,
    +    repos    => $repos,
    +    include  => {
    +      'src' => $include_src,
    +      'deb' => true,
    +    },
    +    require  => Apt::Key['php::repo::debian'],
    +  }
    +
    +  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,
    +        },
    +      }
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Arepo_3A_3Aredhat.html b/docs/puppet_classes/php_3A_3Arepo_3A_3Aredhat.html new file mode 100644 index 00000000..05734b32 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Arepo_3A_3Aredhat.html @@ -0,0 +1,177 @@ + + + + + + + Puppet Class: php::repo::redhat + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::repo::redhat

    +
    + + +
    +
    Defined in:
    +
    + manifests/repo/redhat.pp +
    +
    +
    + +

    Overview

    +
    +
    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + yum_repo + + + (Any) + + + (defaults to: 'remi_php56') + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +
    +
    # File 'manifests/repo/redhat.pp', line 9
    +
    +class php::repo::redhat (
    +  $yum_repo = 'remi_php56',
    +) {
    +
    +  $releasever = $facts['os']['name'] ? {
    +    /(?i:Amazon)/ => '6',
    +    default       => '$releasever',  # Yum var
    +  }
    +
    +  yumrepo { 'remi':
    +    descr      => 'Remi\'s RPM repository for Enterprise Linux $releasever - $basearch',
    +    mirrorlist => "https://rpms.remirepo.net/enterprise/${releasever}/remi/mirror",
    +    enabled    => 1,
    +    gpgcheck   => 1,
    +    gpgkey     => 'https://rpms.remirepo.net/RPM-GPG-KEY-remi',
    +    priority   => 1,
    +  }
    +
    +  yumrepo { 'remi-php56':
    +    descr      => 'Remi\'s PHP 5.6 RPM repository for Enterprise Linux $releasever - $basearch',
    +    mirrorlist => "https://rpms.remirepo.net/enterprise/${releasever}/php56/mirror",
    +    enabled    => 1,
    +    gpgcheck   => 1,
    +    gpgkey     => 'https://rpms.remirepo.net/RPM-GPG-KEY-remi',
    +    priority   => 1,
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Arepo_3A_3Asuse.html b/docs/puppet_classes/php_3A_3Arepo_3A_3Asuse.html new file mode 100644 index 00000000..43e07075 --- /dev/null +++ b/docs/puppet_classes/php_3A_3Arepo_3A_3Asuse.html @@ -0,0 +1,175 @@ + + + + + + + Puppet Class: php::repo::suse + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::repo::suse

    +
    + + +
    +
    Defined in:
    +
    + manifests/repo/suse.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure suse repo

    + +

    === Parameters

    + +

    [reponame] + Name of the Zypper repository

    + +

    [baseurl] + Base URL of the Zypper repository

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + reponame + + + (Any) + + + (defaults to: 'mayflower-php56') + + +
    • + +
    • + + baseurl + + + (Any) + + + (defaults to: 'http://download.opensuse.org/repositories/home:/mayflower:/php5.6_based/SLE_11_SP3/') + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +
    +
    # File 'manifests/repo/suse.pp', line 11
    +
    +class php::repo::suse (
    +  $reponame = 'mayflower-php56',
    +  $baseurl  = 'http://download.opensuse.org/repositories/home:/mayflower:/php5.6_based/SLE_11_SP3/',
    +) {
    +  zypprepo { $reponame:
    +    baseurl     => $baseurl,
    +    enabled     => 1,
    +    autorefresh => 1,
    +  }
    +  ~> exec { 'zypprepo-accept-key':
    +    command     => 'zypper --gpg-auto-import-keys update -y',
    +    path        => '/usr/bin:/bin',
    +    refreshonly => true,
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_classes/php_3A_3Arepo_3A_3Aubuntu.html b/docs/puppet_classes/php_3A_3Arepo_3A_3Aubuntu.html new file mode 100644 index 00000000..f41785ac --- /dev/null +++ b/docs/puppet_classes/php_3A_3Arepo_3A_3Aubuntu.html @@ -0,0 +1,177 @@ + + + + + + + Puppet Class: php::repo::ubuntu + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Class: php::repo::ubuntu

    +
    + + +
    +
    Defined in:
    +
    + manifests/repo/ubuntu.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure ubuntu ppa

    + +

    === Parameters

    + +

    [version] + PHP version to manage (e.g. 5.6)

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + version + + + (Any) + + + (defaults to: undef) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +
    +
    # File 'manifests/repo/ubuntu.pp', line 8
    +
    +class php::repo::ubuntu (
    +  $version   = undef,
    +) {
    +  include '::apt'
    +
    +  if($version == undef) {
    +    $version_real = '5.6'
    +  } else {
    +    $version_real = $version
    +  }
    +
    +  if ($version_real == '5.5') {
    +    fail('PHP 5.5 is no longer available for download')
    +  }
    +  assert_type(Pattern[/^\d\.\d/], $version_real)
    +
    +  $version_repo = $version_real ? {
    +    '5.4' => 'ondrej/php5-oldstable',
    +    '5.6' => 'ondrej/php',
    +    '7.0' => 'ondrej/php'
    +  }
    +
    +  ::apt::ppa { "ppa:${version_repo}": }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_defined_type_list.html b/docs/puppet_defined_type_list.html new file mode 100644 index 00000000..344a86a7 --- /dev/null +++ b/docs/puppet_defined_type_list.html @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + Defined Type List + + + +
    +
    +

    Defined Type List

    + + + +
    + + +
    + + diff --git a/docs/puppet_defined_types/php_3A_3Aapache_vhost.html b/docs/puppet_defined_types/php_3A_3Aapache_vhost.html new file mode 100644 index 00000000..03dea06f --- /dev/null +++ b/docs/puppet_defined_types/php_3A_3Aapache_vhost.html @@ -0,0 +1,223 @@ + + + + + + + Defined Type: php::apache_vhost + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Defined Type: php::apache_vhost

    +
    +
    +
    Defined in:
    +
    + manifests/apache_vhost.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configures an apache vhost for php

    + +

    === Parameters

    + +

    [vhost] + The vhost address

    + +

    [docroot] + The vhost docroot

    + +

    [port] + The vhost port

    + +

    [default_vhost] + defines if vhost is the default vhost

    + +

    [fastcgi_socket] + address of the fastcgi socket

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + vhost + + + (Any) + + + (defaults to: 'example.com') + + +
    • + +
    • + + docroot + + + (Any) + + + (defaults to: '/var/www') + + +
    • + +
    • + + port + + + (Any) + + + (defaults to: 80) + + +
    • + +
    • + + default_vhost + + + (Any) + + + (defaults to: true) + + +
    • + +
    • + + fastcgi_socket + + + (Any) + + + (defaults to: 'fcgi://127.0.0.1:9000/$1') + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +
    +
    # File 'manifests/apache_vhost.pp', line 20
    +
    +define php::apache_vhost(
    +  $vhost          = 'example.com',
    +  $docroot        = '/var/www',
    +  $port           = 80,
    +  $default_vhost  = true,
    +  $fastcgi_socket = 'fcgi://127.0.0.1:9000/$1'
    +) {
    +
    +  ::apache::vhost { $vhost:
    +    docroot         => $docroot,
    +    default_vhost   => $default_vhost,
    +    port            => $port,
    +    override        => 'all',
    +    custom_fragment => "ProxyPassMatch ^/(.*\\.php(/.*)?)$ ${fastcgi_socket}",
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_defined_types/php_3A_3Aconfig.html b/docs/puppet_defined_types/php_3A_3Aconfig.html new file mode 100644 index 00000000..4dcdc194 --- /dev/null +++ b/docs/puppet_defined_types/php_3A_3Aconfig.html @@ -0,0 +1,174 @@ + + + + + + + Defined Type: php::config + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Defined Type: php::config

    +
    +
    +
    Defined in:
    +
    + manifests/config.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure php.ini settings for a PHP SAPI

    + +

    === Parameters

    + +

    [file] + The path to ini file

    + +

    [config] + Nested hash of key => value to apply to php.ini

    + +

    === Examples

    + +

    php::config { '$unique-name': + file => '$full_path_to_ini_file' + config => { + => 'Europe/Berlin' + } + }

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + file + + + (Stdlib::Absolutepath) + + + +
    • + +
    • + + config + + + (Hash) + + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +
    +
    # File 'manifests/config.pp', line 20
    +
    +define php::config(
    +  Stdlib::Absolutepath $file,
    +  Hash $config
    +) {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::config is private')
    +  }
    +
    +  create_resources(::php::config::setting, to_hash_settings($config, $file), {
    +    file => $file
    +  })
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_defined_types/php_3A_3Aconfig_3A_3Asetting.html b/docs/puppet_defined_types/php_3A_3Aconfig_3A_3Asetting.html new file mode 100644 index 00000000..c7b487bd --- /dev/null +++ b/docs/puppet_defined_types/php_3A_3Aconfig_3A_3Asetting.html @@ -0,0 +1,226 @@ + + + + + + + Defined Type: php::config::setting + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Defined Type: php::config::setting

    +
    +
    +
    Defined in:
    +
    + manifests/config/setting.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure php.ini settings

    + +

    === Parameters

    + +

    [key] + The key of the value, like ini_setting

    + +

    [file] + The path to ini file

    + +

    [value] + The value to set

    + +

    === Examples

    + +

    php::config::setting { 'Date/date.timezone': + file => '$full_path_to_ini_file' + value => 'Europe/Berlin' + }

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + key + + + (Any) + + + +
    • + +
    • + + value + + + (Any) + + + +
    • + +
    • + + file + + + (Stdlib::Absolutepath) + + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +
    +
    # File 'manifests/config/setting.pp', line 21
    +
    +define php::config::setting(
    +  $key,
    +  $value,
    +  Stdlib::Absolutepath $file,
    +) {
    +
    +  if $caller_module_name != $module_name {
    +    warning('php::config::setting is private')
    +  }
    +
    +  $split_name = split($key, '/')
    +  if count($split_name) == 1 {
    +    $section = '' # lint:ignore:empty_string_assignment
    +    $setting = $split_name[0]
    +  } else {
    +    $section = $split_name[0]
    +    $setting = $split_name[1]
    +  }
    +
    +  if $value == undef {
    +    $ensure = 'absent'
    +  } else {
    +    $ensure = 'present'
    +  }
    +
    +  ini_setting { $name:
    +    ensure  => $ensure,
    +    value   => $value,
    +    path    => $file,
    +    section => $section,
    +    setting => $setting,
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_defined_types/php_3A_3Aextension.html b/docs/puppet_defined_types/php_3A_3Aextension.html new file mode 100644 index 00000000..163e0674 --- /dev/null +++ b/docs/puppet_defined_types/php_3A_3Aextension.html @@ -0,0 +1,460 @@ + + + + + + + Defined Type: php::extension + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Defined Type: php::extension

    +
    +
    +
    Defined in:
    +
    + manifests/extension.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install a PHP extension package

    + +

    === Parameters

    + +

    [ensure] + The ensure of the package to install + Could be "latest", "installed" or a pinned version

    + +

    [package_prefix] + Prefix to prepend to the package name for the package provider

    + +

    [provider] + The provider used to install the package + Could be "pecl", "apt", "dpkg" or any other OS package provider + If set to "none", no package will be installed

    + +

    [source] + The source to install the extension from. Possible values + depend on the provider used

    + +

    [so_name] + The DSO name of the package (e.g. opcache for zendopcache)

    + +

    [ini_prefix] + An optional filename prefix for the settings file of the extension

    + +

    [php_api_version] + This parameter is used to build the full path to the extension + directory for zend_extension in PHP < 5.5 (e.g. 20100525)

    + +

    [header_packages] + System packages dependencies to install for extensions (e.g. for + memcached libmemcached-dev on Debian)

    + +

    [compiler_packages] + System packages dependencies to install for compiling extensions + (e.g. build-essential on Debian)

    + +

    [zend] + Boolean parameter, whether to load extension as zend_extension. + Defaults to false.

    + +

    [settings] + Nested hash of global config parameters for php.ini

    + +

    [settings_prefix] + Boolean/String parameter, whether to prefix all setting keys with + the extension name or specified name. Defaults to false.

    + +

    [sapi] + String parameter, whether to specify ALL sapi or a specific sapi. + Defaults to ALL.

    + +

    [responsefile] + File containing answers for interactive extension setup. Supported + providers: pear, pecl.

    + +

    [install_options] + Array of String or Hash options to pass to the provider.

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: 'installed') + + +
    • + +
    • + + provider + + + (Optional[Php::Provider]) + + + (defaults to: undef) + + +
    • + +
    • + + source + + + (Optional[String]) + + + (defaults to: undef) + + +
    • + +
    • + + so_name + + + (Optional[String]) + + + (defaults to: downcase($name)) + + +
    • + +
    • + + ini_prefix + + + (Optional[String]) + + + (defaults to: undef) + + +
    • + +
    • + + php_api_version + + + (Optional[String]) + + + (defaults to: undef) + + +
    • + +
    • + + package_prefix + + + (String) + + + (defaults to: $::php::package_prefix) + + +
    • + +
    • + + zend + + + (Boolean) + + + (defaults to: false) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    • + + sapi + + + (Php::Sapi) + + + (defaults to: 'ALL') + + +
    • + +
    • + + settings_prefix + + + (Variant[Boolean, String]) + + + (defaults to: false) + + +
    • + +
    • + + responsefile + + + (Optional[Stdlib::AbsolutePath]) + + + (defaults to: undef) + + +
    • + +
    • + + header_packages + + + (Variant[String, Array[String]]) + + + (defaults to: []) + + +
    • + +
    • + + compiler_packages + + + (Variant[String, Array[String]]) + + + (defaults to: $::php::params::compiler_packages) + + +
    • + +
    • + + install_options + + + (Php::InstallOptions) + + + (defaults to: undef) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +
    +
    # File 'manifests/extension.pp', line 61
    +
    +define php::extension (
    +  String           $ensure                          = 'installed',
    +  Optional[Php::Provider] $provider                 = undef,
    +  Optional[String] $source                          = undef,
    +  Optional[String] $so_name                         = downcase($name),
    +  Optional[String] $ini_prefix                      = undef,
    +  Optional[String] $php_api_version                 = undef,
    +  String           $package_prefix                  = $::php::package_prefix,
    +  Boolean          $zend                            = false,
    +  Hash             $settings                        = {},
    +  Php::Sapi        $sapi                            = 'ALL',
    +  Variant[Boolean, String]       $settings_prefix   = false,
    +  Optional[Stdlib::AbsolutePath] $responsefile      = undef,
    +  Variant[String, Array[String]] $header_packages   = [],
    +  Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages,
    +  Php::InstallOptions $install_options              = undef,
    +) {
    +
    +  if ! defined(Class['php']) {
    +    warning('php::extension is private')
    +  }
    +
    +  php::extension::install { $title:
    +    ensure            => $ensure,
    +    provider          => $provider,
    +    source            => $source,
    +    responsefile      => $responsefile,
    +    package_prefix    => $package_prefix,
    +    header_packages   => $header_packages,
    +    compiler_packages => $compiler_packages,
    +    install_options   => $install_options,
    +  }
    +
    +  # PEAR packages don't require any further configuration, they just need to "be there".
    +  if $provider != 'pear' {
    +    php::extension::config { $title:
    +      ensure          => $ensure,
    +      provider        => $provider,
    +      so_name         => $so_name,
    +      ini_prefix      => $ini_prefix,
    +      php_api_version => $php_api_version,
    +      zend            => $zend,
    +      settings        => $settings,
    +      settings_prefix => $settings_prefix,
    +      sapi            => $sapi,
    +      subscribe       => Php::Extension::Install[$title],
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_defined_types/php_3A_3Aextension_3A_3Aconfig.html b/docs/puppet_defined_types/php_3A_3Aextension_3A_3Aconfig.html new file mode 100644 index 00000000..8b595692 --- /dev/null +++ b/docs/puppet_defined_types/php_3A_3Aextension_3A_3Aconfig.html @@ -0,0 +1,418 @@ + + + + + + + Defined Type: php::extension::config + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Defined Type: php::extension::config

    +
    +
    +
    Defined in:
    +
    + manifests/extension/config.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure a PHP extension package

    + +

    === Parameters

    + +

    [ensure] + The ensure of the package to install + Could be "latest", "installed" or a pinned version

    + +

    [provider] + The provider used to install the package + Could be "pecl", "apt", "dpkg" or any other OS package provider + If set to "none", no package will be installed

    + +

    [so_name] + The DSO name of the package (e.g. opcache for zendopcache)

    + +

    [ini_prefix] + An optional filename prefix for the settings file of the extension

    + +

    [php_api_version] + This parameter is used to build the full path to the extension + directory for zend_extension in PHP < 5.5 (e.g. 20100525)

    + +

    [header_packages] + System packages dependencies to install for extensions (e.g. for + memcached libmemcached-dev on Debian)

    + +

    [compiler_packages] + System packages dependencies to install for compiling extensions + (e.g. build-essential on Debian)

    + +

    [zend] + Boolean parameter, whether to load extension as zend_extension. + Defaults to false.

    + +

    [settings] + Nested hash of global config parameters for php.ini

    + +

    [settings_prefix] + Boolean/String parameter, whether to prefix all setting keys with + the extension name or specified name. Defaults to false.

    + +

    [sapi] + String parameter, whether to specify ALL sapi or a specific sapi. + Defaults to ALL.

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: 'installed') + + +
    • + +
    • + + provider + + + (Optional[Php::Provider]) + + + (defaults to: undef) + + +
    • + +
    • + + so_name + + + (Optional[String]) + + + (defaults to: downcase($name)) + + +
    • + +
    • + + ini_prefix + + + (Optional[String]) + + + (defaults to: undef) + + +
    • + +
    • + + php_api_version + + + (Optional[String]) + + + (defaults to: undef) + + +
    • + +
    • + + zend + + + (Boolean) + + + (defaults to: false) + + +
    • + +
    • + + settings + + + (Hash) + + + (defaults to: {}) + + +
    • + +
    • + + settings_prefix + + + (Variant[Boolean, String]) + + + (defaults to: false) + + +
    • + +
    • + + sapi + + + (Php::Sapi) + + + (defaults to: 'ALL') + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +
    +
    # File 'manifests/extension/config.pp', line 47
    +
    +define php::extension::config (
    +  String                   $ensure          = 'installed',
    +  Optional[Php::Provider]  $provider        = undef,
    +  Optional[String]         $so_name         = downcase($name),
    +  Optional[String]         $ini_prefix      = undef,
    +  Optional[String]         $php_api_version = undef,
    +  Boolean                  $zend            = false,
    +  Hash                     $settings        = {},
    +  Variant[Boolean, String] $settings_prefix = false,
    +  Php::Sapi                $sapi            = 'ALL',
    +) {
    +
    +  if ! defined(Class['php']) {
    +    warning('php::extension::config is private')
    +  }
    +
    +  if $zend == true {
    +    $extension_key = 'zend_extension'
    +    $module_path = $php_api_version? {
    +      undef   => undef,
    +      default => "/usr/lib/php5/${php_api_version}/",
    +    }
    +  } else {
    +    $extension_key = 'extension'
    +    $module_path = undef
    +  }
    +
    +  $ini_name = downcase($so_name)
    +
    +  # Ensure "<extension>." prefix is present in setting keys if requested
    +  $full_settings = $settings_prefix? {
    +    true   => ensure_prefix($settings, "${so_name}."),
    +    false  => $settings,
    +    String => ensure_prefix($settings, "${settings_prefix}."),
    +  }
    +
    +  if $provider != 'pear' {
    +    $final_settings = deep_merge(
    +      {"${extension_key}" => "${module_path}${so_name}.so"},
    +      $full_settings
    +    )
    +  } else {
    +    $final_settings = $full_settings
    +  }
    +
    +  $config_root_ini = pick_default($::php::config_root_ini, $::php::params::config_root_ini)
    +  ::php::config { $title:
    +    file   => "${config_root_ini}/${ini_prefix}${ini_name}.ini",
    +    config => $final_settings,
    +  }
    +
    +  # Ubuntu/Debian systems use the mods-available folder. We need to enable
    +  # settings files ourselves with php5enmod command.
    +  $ext_tool_enable   = pick_default($::php::ext_tool_enable, $::php::params::ext_tool_enable)
    +  $ext_tool_query    = pick_default($::php::ext_tool_query, $::php::params::ext_tool_query)
    +  $ext_tool_enabled  = pick_default($::php::ext_tool_enabled, $::php::params::ext_tool_enabled)
    +
    +  if $facts['os']['family'] == 'Debian' and $ext_tool_enabled {
    +    $cmd = "${ext_tool_enable} -s ${sapi} ${so_name}"
    +
    +    $_sapi = $sapi? {
    +      'ALL' => 'cli',
    +      default => $sapi,
    +    }
    +    exec { $cmd:
    +      onlyif  => "${ext_tool_query} -s ${_sapi} -m ${so_name} | /bin/grep 'No module matches ${so_name}'",
    +      require => ::Php::Config[$title],
    +    }
    +
    +    if $::php::fpm {
    +      Package[$::php::fpm::package] ~> Exec[$cmd]
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_defined_types/php_3A_3Aextension_3A_3Ainstall.html b/docs/puppet_defined_types/php_3A_3Aextension_3A_3Ainstall.html new file mode 100644 index 00000000..3c73f7bf --- /dev/null +++ b/docs/puppet_defined_types/php_3A_3Aextension_3A_3Ainstall.html @@ -0,0 +1,356 @@ + + + + + + + Defined Type: php::extension::install + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Defined Type: php::extension::install

    +
    +
    +
    Defined in:
    +
    + manifests/extension/install.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Install a PHP extension package

    + +

    === Parameters

    + +

    [ensure] + The ensure of the package to install + Could be "latest", "installed" or a pinned version

    + +

    [package_prefix] + Prefix to prepend to the package name for the package provider

    + +

    [provider] + The provider used to install the package + Could be "pecl", "apt", "dpkg" or any other OS package provider + If set to "none", no package will be installed

    + +

    [source] + The source to install the extension from. Possible values + depend on the provider used

    + +

    [header_packages] + System packages dependencies to install for extensions (e.g. for + memcached libmemcached-dev on Debian)

    + +

    [compiler_packages] + System packages dependencies to install for compiling extensions + (e.g. build-essential on Debian)

    + +

    [responsefile] + File containing answers for interactive extension setup. Supported + providers: pear, pecl.

    + +

    [install_options] + Array of String or Hash options to pass to the provider.

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (String) + + + (defaults to: 'installed') + + +
    • + +
    • + + provider + + + (Optional[Php::Provider]) + + + (defaults to: undef) + + +
    • + +
    • + + source + + + (Optional[String]) + + + (defaults to: undef) + + +
    • + +
    • + + package_prefix + + + (String) + + + (defaults to: $::php::package_prefix) + + +
    • + +
    • + + responsefile + + + (Optional[Stdlib::AbsolutePath]) + + + (defaults to: undef) + + +
    • + +
    • + + header_packages + + + (Variant[String, Array[String]]) + + + (defaults to: []) + + +
    • + +
    • + + compiler_packages + + + (Variant[String, Array[String]]) + + + (defaults to: $::php::params::compiler_packages) + + +
    • + +
    • + + install_options + + + (Php::InstallOptions) + + + (defaults to: undef) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +
    +
    # File 'manifests/extension/install.pp', line 36
    +
    +define php::extension::install (
    +  String           $ensure                          = 'installed',
    +  Optional[Php::Provider] $provider                 = undef,
    +  Optional[String] $source                          = undef,
    +  String           $package_prefix                  = $::php::package_prefix,
    +  Optional[Stdlib::AbsolutePath] $responsefile      = undef,
    +  Variant[String, Array[String]] $header_packages   = [],
    +  Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages,
    +  Php::InstallOptions $install_options              = undef,
    +) {
    +
    +  if ! defined(Class['php']) {
    +    warning('php::extension::install is private')
    +  }
    +
    +  case $provider {
    +    /pecl|pear/: {
    +      $real_package = $title
    +
    +      unless empty($header_packages) {
    +        ensure_resource('package', $header_packages)
    +        Package[$header_packages] -> Package[$real_package]
    +      }
    +      unless empty($compiler_packages) {
    +        ensure_resource('package', $compiler_packages)
    +        Package[$compiler_packages] -> Package[$real_package]
    +      }
    +
    +      $package_require      = [
    +        Class['::php::pear'],
    +        Class['::php::dev'],
    +      ]
    +    }
    +
    +    'none' : {
    +      debug("No package installed for php::extension: `${title}`.")
    +    }
    +
    +    default: {
    +      $real_package = "${package_prefix}${title}"
    +      $package_require = undef
    +    }
    +  }
    +
    +  unless $provider == 'none' {
    +    package { $real_package:
    +      ensure          => $ensure,
    +      provider        => $provider,
    +      source          => $source,
    +      responsefile    => $responsefile,
    +      install_options => $install_options,
    +      require         => $package_require,
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_defined_types/php_3A_3Afpm_3A_3Apool.html b/docs/puppet_defined_types/php_3A_3Afpm_3A_3Apool.html new file mode 100644 index 00000000..c0e510c3 --- /dev/null +++ b/docs/puppet_defined_types/php_3A_3Afpm_3A_3Apool.html @@ -0,0 +1,935 @@ + + + + + + + Defined Type: php::fpm::pool + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Defined Type: php::fpm::pool

    +
    +
    +
    Defined in:
    +
    + manifests/fpm/pool.pp +
    +
    +
    + +

    Overview

    +
    +
    +

    Configure fpm pools

    + +

    === Parameters

    + +

    See the official php-fpm documentation for parameters that are not +documented here: http://php.net/manual/en/install.fpm.configuration.php.

    + +

    [ensure] + Remove pool if set to 'absent', add otherwise

    + +

    [listen] + On what socket to listen for FastCGI connections, i.e. + '127.0.0.1:9000'' or'/var/run/php5-fpm.sock'`

    + +

    [listen_backlog]

    + +

    [listen_allowed_clients]

    + +

    [listen_owner] + Set owner of the Unix socket

    + +

    [listen_group] + Set the group of the Unix socket

    + +

    [listen_mode]

    + +

    [user] + The user that php-fpm should run as

    + +

    [group] + The group that php-fpm should run as

    + +

    [pm]

    + +

    [pm_max_children]

    + +

    [pm_start_servers]

    + +

    [pm_min_spare_servers]

    + +

    [pm_max_spare_servers]

    + +

    [pm_max_requests]

    + +

    [pm_process_idle_timeout]

    + +

    [pm_status_path]

    + +

    [ping_path]

    + +

    [ping_response]

    + +

    [access_log] + The path to the file to write access log requests to

    + +

    [access_log_format] + The format to save the access log entries as

    + +

    [request_terminate_timeout]

    + +

    [request_slowlog_timeout]

    + +

    [security_limit_extensions]

    + +

    [slowlog]

    + +

    [template] + The template to use for the pool

    + +

    [rlimit_files]

    + +

    [rlimit_core]

    + +

    [chroot]

    + +

    [chdir]

    + +

    [catch_workers_output]

    + +

    [include] + Other configuration files to include on this pool

    + +

    [env] + List of environment variables that are passed to the php-fpm from the + outside and will be available to php scripts in this pool

    + +

    [env_value] + Hash of environment variables and values as strings to use in php + scripts in this pool

    + +

    [options] + An optional hash for any other data.

    + +

    [php_value] + Hash of php_value directives

    + +

    [php_flag] + Hash of php_flag directives

    + +

    [php_admin_value] + Hash of php_admin_value directives

    + +

    [php_admin_flag] + Hash of php_admin_flag directives

    + +

    [php_directives] + List of custom directives that are appended to the pool config

    + +

    [root_group] + UNIX group of the root user

    + +

    [base_dir] + The folder that contains the php-fpm pool configs. This defaults to a + sensible default depending on your operating system, like + '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d'

    + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + ensure + + + (Any) + + + (defaults to: 'present') + + +
    • + +
    • + + listen + + + (Any) + + + (defaults to: '127.0.0.1:9000') + + +
    • + +
    • + + listen_backlog + + + (Any) + + + (defaults to: '-1') + + +
    • + +
    • + + listen_allowed_clients + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + listen_owner + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + listen_group + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + listen_mode + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + user + + + (Any) + + + (defaults to: $::php::fpm::config::user) + + +
    • + +
    • + + group + + + (Any) + + + (defaults to: $::php::fpm::config::group) + + +
    • + +
    • + + pm + + + (Any) + + + (defaults to: 'dynamic') + + +
    • + +
    • + + pm_max_children + + + (Any) + + + (defaults to: '50') + + +
    • + +
    • + + pm_start_servers + + + (Any) + + + (defaults to: '5') + + +
    • + +
    • + + pm_min_spare_servers + + + (Any) + + + (defaults to: '5') + + +
    • + +
    • + + pm_max_spare_servers + + + (Any) + + + (defaults to: '35') + + +
    • + +
    • + + pm_max_requests + + + (Any) + + + (defaults to: '0') + + +
    • + +
    • + + pm_process_idle_timeout + + + (Any) + + + (defaults to: '10s') + + +
    • + +
    • + + pm_status_path + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + ping_path + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + ping_response + + + (Any) + + + (defaults to: 'pong') + + +
    • + +
    • + + access_log + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + access_log_format + + + (Any) + + + (defaults to: '"%R - %u %t \"%m %r\" %s"') + + +
    • + +
    • + + request_terminate_timeout + + + (Any) + + + (defaults to: '0') + + +
    • + +
    • + + request_slowlog_timeout + + + (Any) + + + (defaults to: '0') + + +
    • + +
    • + + security_limit_extensions + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + slowlog + + + (Any) + + + (defaults to: "/var/log/php-fpm/${name}-slow.log") + + +
    • + +
    • + + template + + + (Any) + + + (defaults to: 'php/fpm/pool.conf.erb') + + +
    • + +
    • + + rlimit_files + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + rlimit_core + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + chroot + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + chdir + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + catch_workers_output + + + (Any) + + + (defaults to: 'no') + + +
    • + +
    • + + include + + + (Any) + + + (defaults to: undef) + + +
    • + +
    • + + env + + + (Any) + + + (defaults to: []) + + +
    • + +
    • + + env_value + + + (Any) + + + (defaults to: {}) + + +
    • + +
    • + + options + + + (Any) + + + (defaults to: {}) + + +
    • + +
    • + + php_value + + + (Any) + + + (defaults to: {}) + + +
    • + +
    • + + php_flag + + + (Any) + + + (defaults to: {}) + + +
    • + +
    • + + php_admin_value + + + (Any) + + + (defaults to: {}) + + +
    • + +
    • + + php_admin_flag + + + (Any) + + + (defaults to: {}) + + +
    • + +
    • + + php_directives + + + (Any) + + + (defaults to: []) + + +
    • + +
    • + + root_group + + + (Any) + + + (defaults to: $::php::params::root_group) + + +
    • + +
    • + + base_dir + + + (Optional[Stdlib::Absolutepath]) + + + (defaults to: undef) + + +
    • + +
    + + +
    + + + + + +
    +
    +
    +
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +
    +
    # File 'manifests/fpm/pool.pp', line 117
    +
    +define php::fpm::pool (
    +  $ensure                                  = 'present',
    +  $listen                                  = '127.0.0.1:9000',
    +  $listen_backlog                          = '-1',
    +  $listen_allowed_clients                  = undef,
    +  $listen_owner                            = undef,
    +  $listen_group                            = undef,
    +  $listen_mode                             = undef,
    +  $user                                    = $::php::fpm::config::user,
    +  $group                                   = $::php::fpm::config::group,
    +  $pm                                      = 'dynamic',
    +  $pm_max_children                         = '50',
    +  $pm_start_servers                        = '5',
    +  $pm_min_spare_servers                    = '5',
    +  $pm_max_spare_servers                    = '35',
    +  $pm_max_requests                         = '0',
    +  $pm_process_idle_timeout                 = '10s',
    +  $pm_status_path                          = undef,
    +  $ping_path                               = undef,
    +  $ping_response                           = 'pong',
    +  $access_log                              = undef,
    +  $access_log_format                       = '"%R - %u %t \"%m %r\" %s"',
    +  $request_terminate_timeout               = '0',
    +  $request_slowlog_timeout                 = '0',
    +  $security_limit_extensions               = undef,
    +  $slowlog                                 = "/var/log/php-fpm/${name}-slow.log",
    +  $template                                = 'php/fpm/pool.conf.erb',
    +  $rlimit_files                            = undef,
    +  $rlimit_core                             = undef,
    +  $chroot                                  = undef,
    +  $chdir                                   = undef,
    +  $catch_workers_output                    = 'no',
    +  $include                                 = undef,
    +  $env                                     = [],
    +  $env_value                               = {},
    +  $options                                 = {},
    +  $php_value                               = {},
    +  $php_flag                                = {},
    +  $php_admin_value                         = {},
    +  $php_admin_flag                          = {},
    +  $php_directives                          = [],
    +  $root_group                              = $::php::params::root_group,
    +  Optional[Stdlib::Absolutepath] $base_dir = undef,
    +) {
    +
    +  # The base class must be included first because it is used by parameter defaults
    +  if ! defined(Class['php']) {
    +    warning('You must include the php base class before using any php defined resources')
    +  }
    +
    +  $pool = $title
    +
    +  # Hack-ish to default to user for group too
    +  $group_final = $group ? {
    +    undef   => $user,
    +    default => $group
    +  }
    +
    +  # On FreeBSD fpm is not a separate package, but included in the 'php' package.
    +  # Implies that the option SET+=FPM was set when building the port.
    +  $real_package = $facts['os']['name'] ? {
    +    'FreeBSD' => [],
    +    default   => $::php::fpm::package,
    +  }
    +
    +  $pool_base_dir = pick_default($base_dir, $::php::fpm::config::pool_base_dir, $::php::params::fpm_pool_dir)
    +  if ($ensure == 'absent') {
    +    file { "${pool_base_dir}/${pool}.conf":
    +      ensure => absent,
    +      notify => Class['::php::fpm::service'],
    +    }
    +  } else {
    +    file { "${pool_base_dir}/${pool}.conf":
    +      ensure  => file,
    +      notify  => Class['::php::fpm::service'],
    +      require => Package[$real_package],
    +      content => template($template),
    +      owner   => root,
    +      group   => $root_group,
    +      mode    => '0644',
    +    }
    +  }
    +}
    +
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_function_list.html b/docs/puppet_function_list.html new file mode 100644 index 00000000..10ceb73b --- /dev/null +++ b/docs/puppet_function_list.html @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + Puppet Function List + + + +
    +
    +

    Puppet Function List

    + + + +
    + + +
    + + diff --git a/docs/puppet_functions_ruby3x/ensure_prefix.html b/docs/puppet_functions_ruby3x/ensure_prefix.html new file mode 100644 index 00000000..c7601201 --- /dev/null +++ b/docs/puppet_functions_ruby3x/ensure_prefix.html @@ -0,0 +1,259 @@ + + + + + + + Puppet Function: ensure_prefix (Ruby 3.x API) + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Function: ensure_prefix

    +
    +
    +
    Defined in:
    +
    + lib/puppet/parser/functions/ensure_prefix.rb +
    +
    +
    +
    Function type:
    +
    Ruby 3.x API
    +
    +
    + +

    Overview

    +
    + +
    + + + ensure_prefix()Any + + +
    + +
    +
    +

    This function ensures a prefix for all elements in an array or the keys in a hash.

    + +

    Examples:

    + +

    ensure_prefix(=> 1, 'b' => 2, 'p.c' => 3, 'p.')

    + +

    Will return: + { + 'p.a' => 1, + 'p.b' => 2, + 'p.c' => 3, + }

    + +

    ensure_prefix(['a', 'p.b', 'c'], 'p.')

    + +

    Will return: + ['p.a', 'p.b', 'p.c']

    + +
    +
    +
    + + +

    Returns:

    +
      + +
    • + + + (Any) + + + +
    • + +
    + +
    + + + + + +
    +
    +
    +
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +
    +
    # File 'lib/puppet/parser/functions/ensure_prefix.rb', line 3
    +
    +newfunction(:ensure_prefix, type: :rvalue, doc: <<-EOS
    +  This function ensures a prefix for all elements in an array or the keys in a hash.
    +
    +  *Examples:*
    +
    +    ensure_prefix({'a' => 1, 'b' => 2, 'p.c' => 3}, 'p.')
    +
    +  Will return:
    +    {
    +      'p.a' => 1,
    +      'p.b' => 2,
    +      'p.c' => 3,
    +    }
    +
    +    ensure_prefix(['a', 'p.b', 'c'], 'p.')
    +
    +  Will return:
    +    ['p.a', 'p.b', 'p.c']
    +EOS
    +           ) do |arguments|
    +  if arguments.size < 2
    +    raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' \
    +      "given (#{arguments.size} for 2)")
    +  end
    +
    +  enumerable = arguments[0]
    +
    +  unless enumerable.is_a?(Array) || enumerable.is_a?(Hash)
    +    raise Puppet::ParseError, "ensure_prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}"
    +  end
    +
    +  prefix = arguments[1] if arguments[1]
    +
    +  if prefix
    +    unless prefix.is_a?(String)
    +      raise Puppet::ParseError, "ensure_prefix(): expected second argument to be a String, got #{prefix.inspect}"
    +    end
    +  end
    +
    +  result = if enumerable.is_a?(Array)
    +             # Turn everything into string same as join would do ...
    +             enumerable.map do |i|
    +               i = i.to_s
    +               prefix && !i.start_with?(prefix) ? prefix + i : i
    +             end
    +           else
    +             Hash[enumerable.map do |k, v|
    +               k = k.to_s
    +               [prefix && !k.start_with?(prefix) ? prefix + k : k, v]
    +             end]
    +           end
    +
    +  return result
    +end
    +
    +
    + +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_functions_ruby3x/to_hash_settings.html b/docs/puppet_functions_ruby3x/to_hash_settings.html new file mode 100644 index 00000000..973706b7 --- /dev/null +++ b/docs/puppet_functions_ruby3x/to_hash_settings.html @@ -0,0 +1,224 @@ + + + + + + + Puppet Function: to_hash_settings (Ruby 3.x API) + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Puppet Function: to_hash_settings

    +
    +
    +
    Defined in:
    +
    + lib/puppet/parser/functions/to_hash_settings.rb +
    +
    +
    +
    Function type:
    +
    Ruby 3.x API
    +
    +
    + +

    Overview

    +
    + +
    + + + to_hash_settings()Any + + +
    + +
    +
    +

    This function converts a +=> value+ hash into a nested hash and can add an id to the outer key. +The optional id string as second parameter is prepended to the resource name.

    + +

    Examples:

    + +

    to_hash_settings(=> 1, 'b' => 2)

    + +

    Would return: + { + 'a' => => 'a', 'value' => 1, + 'b' => => 'b', 'value' => 2 + }

    + +

    and:

    + +

    to_hash_settings(=> 1, 'b' => 2, 'foo')

    + +

    Would return: + { + 'foo: a' => => 'a', 'value' => 1, + 'foo: b' => => 'b', 'value' => 2 + }

    + +
    +
    +
    + + +

    Returns:

    +
      + +
    • + + + (Any) + + + +
    • + +
    + +
    + + + + + +
    +
    +
    +
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +
    +
    # File 'lib/puppet/parser/functions/to_hash_settings.rb', line 3
    +
    +newfunction(:to_hash_settings, type: :rvalue, doc: <<-EOS
    +  This function converts a +{key => value}+ hash into a nested hash and can add an id to the outer key.
    +  The optional id string as second parameter is prepended to the resource name.
    +
    +  *Examples:*
    +
    +    to_hash_settings({'a' => 1, 'b' => 2})
    +
    +  Would return:
    +    {
    +      'a' => {'key' => 'a', 'value' => 1},
    +      'b' => {'key' => 'b', 'value' => 2}
    +    }
    +
    +  and:
    +
    +    to_hash_settings({'a' => 1, 'b' => 2}, 'foo')
    +
    +  Would return:
    +    {
    +      'foo: a' => {'key' => 'a', 'value' => 1},
    +      'foo: b' => {'key' => 'b', 'value' => 2}
    +    }
    +EOS
    +           ) do |arguments|
    +  hash, id = arguments
    +  id = (id.nil? ? '' : "#{id}: ")
    +
    +  raise(Puppet::ParseError, 'to_hash_settings(): Requires hash to work with') unless hash.is_a?(Hash)
    +
    +  return hash.each_with_object({}) do |kv, acc|
    +    acc[id + kv[0]] = { 'key' => kv[0], 'value' => kv[1] }
    +  end
    +end
    +
    +
    + +
    +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_provider_list.html b/docs/puppet_provider_list.html new file mode 100644 index 00000000..7881a220 --- /dev/null +++ b/docs/puppet_provider_list.html @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + Provider List + + + +
    + + +
      + + +
    • +
      + pear + Resource type: package +
      +
    • + + +
    • +
      + pecl + Resource type: package +
      +
    • + + + +
    +
    + + diff --git a/docs/puppet_providers_package/pear.html b/docs/puppet_providers_package/pear.html new file mode 100644 index 00000000..5621549a --- /dev/null +++ b/docs/puppet_providers_package/pear.html @@ -0,0 +1,129 @@ + + + + + + + Provider: pear + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Provider: pear

    +
    +
    +
    Defined in:
    +
    + lib/puppet/provider/package/pear.rb +
    +
    +
    +
    Resource type:
    +
    package
    +
    +
    + +

    Overview

    +
    +
    +

    Package management via pear.

    + +
    +
    +
    + + +
    +
    +

    Features

    +
      + +
    • + versionable +
    • + +
    • + upgradeable +
    • + +
    • + install_options +
    • + +
    +
    + + + + +
    +

    Commands

    +
      + + + +
    • pear — pear
    • + + +
    +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/puppet_providers_package/pecl.html b/docs/puppet_providers_package/pecl.html new file mode 100644 index 00000000..29c68d69 --- /dev/null +++ b/docs/puppet_providers_package/pecl.html @@ -0,0 +1,129 @@ + + + + + + + Provider: pecl + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Provider: pecl

    +
    +
    +
    Defined in:
    +
    + lib/puppet/provider/package/pecl.rb +
    +
    +
    +
    Resource type:
    +
    package
    +
    +
    + +

    Overview

    +
    +
    +

    Package management via pecl.

    + +
    +
    +
    + + +
    +
    +

    Features

    +
      + +
    • + versionable +
    • + +
    • + upgradeable +
    • + +
    • + install_options +
    • + +
    +
    + + + + +
    +

    Commands

    +
      + + + +
    • pear — pear
    • + + +
    +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/top-level-namespace.html b/docs/top-level-namespace.html new file mode 100644 index 00000000..a5696897 --- /dev/null +++ b/docs/top-level-namespace.html @@ -0,0 +1,98 @@ + + + + + + + Top Level Namespace + + — Documentation by YARD 0.9.9 + + + + + + + + + + + + + + + + + + + +
    + + +

    Top Level Namespace + + + +

    +
    + + + + + + + + + + + +
    + + + + + + + + + + +
    + + + +
    + + \ No newline at end of file From 0c6f7e88dcb050ad56d883cc7ddc38a5199d44f9 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Nov 2017 00:08:55 +0100 Subject: [PATCH 215/221] release 5.1.0 --- CHANGELOG.md | 37 ++++++++- Gemfile | 2 +- HISTORY.md | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++ Rakefile | 13 +++ metadata.json | 2 +- 5 files changed, 273 insertions(+), 3 deletions(-) create mode 100644 HISTORY.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 4133d563..33fc3043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,38 @@ # Changelog -## 2017-08-02 Release [5.0.0] +All notable changes to this project will be documented in this file. +Each new release typically also includes the latest modulesync defaults. +These should not affect the functionality of the module. + +## [v5.1.0](https://github.com/voxpupuli/puppet-php/tree/v5.1.0) (2017-11-10) + +[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v5.0.0...v5.1.0) + +**Fixed bugs:** + +- Fix syntax issues with data types [\#385](https://github.com/voxpupuli/puppet-php/pull/385) ([craigwatson](https://github.com/craigwatson)) +- fix ubuntu 17.04 version for php7 [\#383](https://github.com/voxpupuli/puppet-php/pull/383) ([arudat](https://github.com/arudat)) +- Fix OS fact comparison for Ubuntu 12 and 14 [\#375](https://github.com/voxpupuli/puppet-php/pull/375) ([dbeckham](https://github.com/dbeckham)) +- Fix OS facts usage when selecting repo class for Ubuntu systems [\#374](https://github.com/voxpupuli/puppet-php/pull/374) ([dbeckham](https://github.com/dbeckham)) +- Confine pecl provider to where pear command is available [\#364](https://github.com/voxpupuli/puppet-php/pull/364) ([walkamongus](https://github.com/walkamongus)) +- fix default value of php::fpm::pool::access\_log\_format [\#361](https://github.com/voxpupuli/puppet-php/pull/361) ([lesinigo](https://github.com/lesinigo)) + +**Closed issues:** + +- Debian repository classes are being selected on Ubuntu systems [\#373](https://github.com/voxpupuli/puppet-php/issues/373) +- Changes in \#357 break Ubuntu version dependent resources [\#372](https://github.com/voxpupuli/puppet-php/issues/372) + +**Merged pull requests:** + +- Proposed fix for failing parallel spec tests [\#386](https://github.com/voxpupuli/puppet-php/pull/386) ([wyardley](https://github.com/wyardley)) +- update dependencies in metadata [\#379](https://github.com/voxpupuli/puppet-php/pull/379) ([mmoll](https://github.com/mmoll)) +- Bump metadata.json version to 5.0.1-rc [\#377](https://github.com/voxpupuli/puppet-php/pull/377) ([dhollinger](https://github.com/dhollinger)) +- bump dep on puppet/archive to '\< 3.0.0' [\#376](https://github.com/voxpupuli/puppet-php/pull/376) ([costela](https://github.com/costela)) +- Release 5.0.0 [\#371](https://github.com/voxpupuli/puppet-php/pull/371) ([hunner](https://github.com/hunner)) +- Backport of \#355 remove example42/yum dependency on puppet3 branch [\#366](https://github.com/voxpupuli/puppet-php/pull/366) ([LEDfan](https://github.com/LEDfan)) +- Add missing php-fpm user and group class param docs [\#346](https://github.com/voxpupuli/puppet-php/pull/346) ([dbeckham](https://github.com/dbeckham)) + +## [v5.0.0](https://github.com/voxpupuli/puppet-php/tree/v5.0.0) (2017-08-07) ### Summary This backwards-incompatible release drops puppet 3, PHP 5.5 on Ubuntu, and the deprecated `php::extension` parameter `pecl_source`. It improves much of the internal code quality, and adds several useful features the most interesting of which is probably the `php::extension` parameter `ini_prefix`. @@ -222,3 +254,6 @@ Initial release [4.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v4.0.0...v4.1.0 [4.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v3.4.2...v4.0.0 + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Gemfile b/Gemfile index 83d63b43..a8ebd0b0 100644 --- a/Gemfile +++ b/Gemfile @@ -57,7 +57,7 @@ group :system_tests do end group :release do - gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator', :ref => 'master' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '~> 1.0', :require => false diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 00000000..7d7db7a6 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,222 @@ +## [v5.0.0](https://github.com/voxpupuli/puppet-php/tree/v5.0.0) (2017-08-07) +### Summary +This backwards-incompatible release drops puppet 3, PHP 5.5 on Ubuntu, and the deprecated `php::extension` parameter `pecl_source`. It improves much of the internal code quality, and adds several useful features the most interesting of which is probably the `php::extension` parameter `ini_prefix`. + +### Changed +- Drop puppet 3 compatibility. +- Bumped puppetlabs-apt lower bound to 4.1.0 +- Bumped puppetlabs-stdlib lower bound to 4.13.1 + +### Removed +- Deprecated `php::extension` define parameters `pecl_source`. Use `source` instead. +- PHP 5.5 support on ubuntu. + +### Added +- `php` class parameters `fpm_user` and `fpm_group` to customize php-fpm user/group. +- `php::fpm` class parameters `user` and `group`. +- `php::fpm::pool` define parameter `pm_process_idle_timeout` and pool.conf `pm.process_idle_timeout` directive. +- `php::extension` class parameters `ini_prefix` and `install_options`. +- Archlinux compatibility. +- Bumped puppetlabs-apt upper bound to 5.0.0 + +### Fixed +- Replaced validate functions with data types. +- Linting issues. +- Replace legacy facts with facts hash. +- Simplify `php::extension` +- Only apt dependency when `manage_repos => true` +- No more example42/yum dependency + +## 2017-02-11 Release [4.0.0] + +This is the last release with Puppet3 support! +* Fix a bug turning `manage_repos` off on wheezy +* Fix a deprecation warning on `apt::key` when using `manage_repos` on wheezy (#110). This change requires puppetlabs/apt at >= 1.8.0 +* Allow removal of config values (#124) +* Add `phpversion` fact, for querying through PuppetDB or Foreman (#119) +* Allow configuring the fpm pid file (#123) +* Add embedded SAPI support (#115) +* Add options to fpm config and pool configs (#139) +* Add parameter logic for PHP 7 on Ubuntu/Debian (#180) +* add SLES PHP 7.0 Support (#220) +* allow packaged extensions to be loaded as zend extensions +* Fix command to enable php extensions (#226) +* Fix many rucocop warnings +* Update module Ubuntu 14.04 default to official repository setup +* Fix dependency for extentions with no package source +* Allow packaged extensions to be loaded as Zend extensions +* Support using an http proxy for downloading composer +* Refactor classes php::fpm and php::fpm:service +* Manage apache/PHP configurations on Debian and RHEL systems +* use voxpupuli/archive to download composer +* respect $manage_repos, do not include ::apt if set to false +* Bump min version_requirement for Puppet + deps +* allow pipe param for pecl extensions +* Fix: composer auto_update: exec's environment must be array + +### Breaking Changes + * Deep merge `php::extensions` the same way as `php::settings`. This technically is a + breaking change but should not affect many people. + * PHP 5.6 is the default version on all systems now (except Ubuntu 16.04, where 7.0 is the default). + * There's a php::globals class now, where global paramters (like the PHP version) are set. (#132) + * Removal of php::repo::ubuntu::ppa (#218) + +## 3.4.2 + * Fix a bug that changed the default of `php::manage_repos` to `false` on + Debian-based operating systems except wheezy. It should be turned on by + default. (#116) + * Fix a bug that prevented reloading php-fpm on Ubuntu in some cases. + (#117, #107) + +## 3.4.1 + * Fix reloading php-fpm on Ubuntu trusty & utopic (#107) + +## 3.4.0 + * New parameter `ppa` for class `php::repo::ubuntu` to specify the ppa + name to use. We default to `ondrej/php5-oldstable` for precise and + `ondrej/php5` otherwise. + * New parameter `include` for `php::fpm::pool` resources to specify + custom configuration files. + +## 3.3.1 + * Make `systemd_interval` parameter for class `php::fpm::config` optional + +## 3.3.0 + * `php::extension` resources: + * New boolean parameter `settings_prefix` to automatically prefix all + settings keys with the extensions names. Defaults to false to ensurre + the current behaviour. + * New string parameter `so_name` to set the DSO name of an extension if + it doesn't match the package name. + * New string parameter `php_api_version` to set a custom api version. If + not `undef`, the `so_name` is prefixed with the full module path in the + ini file. Defaults to `undef`. + * The default of the parameter `listen_allowed_clients` of `php::fpm::pool` + resources is now `undef` instead of `'127.0.0.1'`. This way it is more + intuitive to change the default tcp listening socket at `127.0.0.1:9000` + to a unix socket by only setting the `listen` parameter instead of + additionally needing to unset `listen_allowed_clients`. This has no + security implications. + * New parameters for the `php::fpm::config` class: + * `error_log` + * `syslog_facility` + * `syslog_ident` + * `systemd_interval` + * A bug that prevented merging the global `php::settings` parameter into + SAPI configs for `php::cli` and `php::fpm` was fixed. + * The dotdeb repos are now only installed for Debian wheezy as Debian jessie + has a sufficiently recent PHP version. + +## 3.2.2 + * Fix a typo in hiera keys `php::settings` & `php::fpm::settings` (#83) + +## 3.2.1 + * Fixed default `yum_repo` key in `php::repo::redhat` + * On Ubuntu precise we now use the ondrej/php5-oldstable ppa. This can be + manually enabled with by setting `$php::repo::ubuntu::oldstable` to + `true`. + * `$php::ensure` now defaults to `present` instead of `latest`. Though, + strictly speaking, this represents a functional change, we consider this + to be a bugfix because automatic updates should be enabled explicitely. + * `$php::ensure` is not anymore passed to `php::extension` resources as + default ensure parameter because this doesn't make sense. + +## 3.2.0 + * Support for FreeBSD added by Frank Wall + * RedHat now uses remi-php56 yum repo by default + * The resource `php::fpm::pool` is now public, you can use it in your + manifests without using `$php::fpm::pools` + * We now have autogenerated documentation using `puppetlabs/strings` + +## 3.1.0 + * New parameter `pool_purge` for `php::extension` to remove files not + managed by puppet from the pool directory. + * The `pecl_source` parameter for `php::extension` was renamend to + `source` because it is also useful for PEAR extensions. + `pecl_source` can still be used but is deprecated and will be + removed in the next major release. + * Parameters referring to time in `php::fpm::config` can now be + specified with units (i.e. `'60s'`, `'1d'`): + * `emergency_restart_threshold` + * `emergency_restart_interval` + * `process_control_timeout` + * The PEAR version is not independant of `$php::ensure` and can be + configured with `$php::pear_ensure` + * Give special thanks to the contributors of this release: + * Petr Sedlacek + * Sherlan Moriah + +## 3.0.1 + * Fix typo in package suffix for php-fpm on RHEL in params.pp + +## 3.0.0 + * Removes `$php::fpm::pool::error_log`. Use the `php_admin_flag` and + `php_admin_value` parameters to set the php settings `log_errors` and + `error_log` instead. + * Removes support for PHP 5.3 on Debian-based systems. See the notes in the + README for more information. + * Removes the `php_version` fact which had only worked on the later puppet runs. + * Moves CLI-package handling to `php::packages` + * Allows changing the package prefix via `php::package_prefix`. + * Moves FPM-package handling from `php::fpm::package` to `php::fpm` + * Changes `php::packages`, so that `php::packages::packages` becomes + `php::packages::names` and are installed and `php::packages::names_to_prefix` + are installed prefixed by `php::package_prefix`. + * PHPUnit is now installed as phar in the same way composer is installed, + causing all parameters to change + * The `php::extension` resource has a new parameter: `zend`. If set to true, + exenstions that were installed with pecl are loaded with `zend_extension`. + +## 2.0.4 + * Style fixes all over the place + * Module dependencies are now bound to the current major version + +## 2.0.3 + * Some issues & bugs with extensions were fixed + * If you set the `provider` parameter of an extension to `"none"`, no + extension packages will be installed + * The EPEL yum repo has been added for RedHat systems + +## 2.0.2 + * Adds support for `header_packages` on all extensions + * Adds `install_options` to pear package provider + +## 2.0.1 + * This is a pure bug fix release + * Fix for CVE 2014-0185 (https://bugs.php.net/bug.php?id=67060) + +## 2.0.0 + * Remove augeas and switch to puppetlabs/inifile for configs + * Old: `settings => [‘set PHP/short_open_tag On‘]` + * New: `settings => {‘PHP/short_open_tag’ => ‘On‘}` + * Settings parmeter cleanups + * The parameter `config` of `php::extension` resources is now called `settings` + * The parameters `user` and `group` of `php::fpm` have been moved to `php::fpm::config` + * New parameter `php::settings` for global settings (i.e. CLI & FPM) + * New parameter `php::cli` to disable CLI if supported + +## 1.1.2 + * SLES: PHP 5.5 will now be installed + * Pecl extensions now autoload the .so based on $name instead of $title + +## 1.1.1 + * some nasty bugs with the pecl php::extension provider were fixed + * php::extension now has a new pecl_source parameter for specifying custom + source channels for the pecl provider + +## 1.1.0 + * add phpunit to main class + * fix variable access for augeas + +## 1.0.2 + * use correct suse apache service name + * fix anchoring of augeas + +## 1.0.1 + * fixes #9 undefined pool_base_dir + +## 1.0.0 +Initial release + +[4.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v4.0.0...v4.1.0 +[4.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v3.4.2...v4.0.0 diff --git a/Rakefile b/Rakefile index 14ccf58b..34b53bcb 100644 --- a/Rakefile +++ b/Rakefile @@ -62,4 +62,17 @@ begin end rescue LoadError end + +desc 'prepare a new release' +task :prepare_release, [:version] do |t, args| + # check for missing parameter + # exit early, exit often + (puts 'you need to provide a version like: rake prepare_releasep[1.0.0]'; exit) unless args[:version] + version = args[:version] + (puts 'format needs to be X.X.X'; exit) unless /^\d+\.\d+\.\d+$/.match(version) + ENV['BLACKSMITH_FULL_VERSION'] = version + Rake::Task['module:bump:full'].invoke + Rake::Task['changelog'].invoke + Rake::Task['strings:generate'].invoke +end # vim: syntax=ruby diff --git a/metadata.json b/metadata.json index ec12ba98..1a3d481e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "5.0.1-rc", + "version": "5.1.0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From 05b44905db3c64ec13de3a873fbd68e5f10c80e6 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Nov 2017 00:17:29 +0100 Subject: [PATCH 216/221] [blacksmith] Bump version to 5.1.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 1a3d481e..e8c32c66 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-php", - "version": "5.1.0", + "version": "5.1.1-rc0", "author": "Vox Pupuli", "summary": "Generic PHP module that supports many platforms", "license": "MIT", From cb24c661c728557842336c4e628bf1a37c8e1037 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 16 Nov 2017 15:55:42 +0100 Subject: [PATCH 217/221] modulesync 1.5.0 --- .msync.yml | 2 +- .travis.yml | 2 +- Gemfile | 4 ++-- Rakefile | 13 ------------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/.msync.yml b/.msync.yml index 02208380..80959a38 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.4.1' +modulesync_config_version: '1.5.0' diff --git a/.travis.yml b/.travis.yml index de90e090..c7e680e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ matrix: include: - rvm: 2.1.9 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 4.0" CHECK=test + env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=16 - rvm: 2.4.2 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls diff --git a/Gemfile b/Gemfile index a8ebd0b0..666c75da 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.4.0', :require => false + gem 'puppetlabs_spec_helper', '~> 2.5.0', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -57,7 +57,7 @@ group :system_tests do end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator', :ref => 'master' + gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '~> 1.0', :require => false diff --git a/Rakefile b/Rakefile index 34b53bcb..14ccf58b 100644 --- a/Rakefile +++ b/Rakefile @@ -62,17 +62,4 @@ begin end rescue LoadError end - -desc 'prepare a new release' -task :prepare_release, [:version] do |t, args| - # check for missing parameter - # exit early, exit often - (puts 'you need to provide a version like: rake prepare_releasep[1.0.0]'; exit) unless args[:version] - version = args[:version] - (puts 'format needs to be X.X.X'; exit) unless /^\d+\.\d+\.\d+$/.match(version) - ENV['BLACKSMITH_FULL_VERSION'] = version - Rake::Task['module:bump:full'].invoke - Rake::Task['changelog'].invoke - Rake::Task['strings:generate'].invoke -end # vim: syntax=ruby From e2067dfae00797ecc1ca15d81e5ab25c69ba3874 Mon Sep 17 00:00:00 2001 From: DALUofM Date: Thu, 23 Nov 2017 09:29:12 -0600 Subject: [PATCH 218/221] Change default RedHat params to use config_root --- manifests/globals.pp | 2 +- manifests/params.pp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index b4552689..cbf45390 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -104,7 +104,7 @@ } } 'RedHat': { - $default_config_root = '/etc/php.d' + $default_config_root = '/etc' $default_fpm_pid_file = '/var/run/php-fpm/php-fpm.pid' } 'FreeBSD': { diff --git a/manifests/params.pp b/manifests/params.pp index a6de99b2..4bfbb4aa 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -101,24 +101,25 @@ } } 'RedHat': { - $config_root_ini = '/etc/php.d' - $config_root_inifile = '/etc/php.ini' + $config_root = $php::globals::globals_config_root + $config_root_ini = "${config_root}/php.d" + $config_root_inifile = "${config_root}/php.ini" $common_package_names = [] $common_package_suffixes = ['cli', 'common'] - $cli_inifile = '/etc/php-cli.ini' + $cli_inifile = "${config_root}/php-cli.ini" $dev_package_suffix = 'devel' $fpm_pid_file = $php::globals::globals_fpm_pid_file - $fpm_config_file = '/etc/php-fpm.conf' + $fpm_config_file = "${config_root}/php-fpm.conf" $fpm_error_log = '/var/log/php-fpm/error.log' - $fpm_inifile = '/etc/php-fpm.ini' + $fpm_inifile = "${config_root}/php-fpm.ini" $fpm_package_suffix = 'fpm' - $fpm_pool_dir = '/etc/php-fpm.d' + $fpm_pool_dir = "${config_root}/php-fpm.d" $fpm_service_name = 'php-fpm' $fpm_user = 'apache' $fpm_group = 'apache' - $apache_inifile = '/etc/php.ini' + $apache_inifile = "${config_root}/php.ini" $embedded_package_suffix = 'embedded' - $embedded_inifile = '/etc/php.ini' + $embedded_inifile = "${config_root}/php.ini" $package_prefix = 'php-' $compiler_packages = ['gcc', 'gcc-c++', 'make'] $manage_repos = false From 50e1c1733a931dd3d9d21db8a4f584c9984100d1 Mon Sep 17 00:00:00 2001 From: gedvcode Date: Wed, 29 Nov 2017 11:30:39 -0300 Subject: [PATCH 219/221] Fixing wrong pear package name in Amazon Linux When the pear package name is defined based on `$facter['os']['family']`. The problem is that Amazon Linux has 'RedHat' as os family. I set an `if` before case searching for 'Amazon' in `$facter['os']['name']` based on the output of the facter command on Amazon instances: ```shell $ facter os { architecture => "x86_64", family => "RedHat", hardware => "x86_64", name => "Amazon", release => { full => "2017.09", major => "2017", minor => "09" }, selinux => { enabled => false } } ``` --- manifests/pear.pp | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/manifests/pear.pp b/manifests/pear.pp index e68d9dfc..f5fd5632 100644 --- a/manifests/pear.pp +++ b/manifests/pear.pp @@ -21,25 +21,27 @@ if $package { $package_name = $package } else { - case $facts['os']['family'] { - 'Debian': { - # Debian is a litte stupid: The pear package is called 'php-pear' - # even though others are called 'php5-fpm' or 'php5-dev' - $package_name = "php-${::php::params::pear_package_suffix}" - } - 'Amazon': { - # On Amazon Linux the package name is also just 'php-pear'. - # This would normally not be problematic but if you specify a - # package_prefix other than 'php' then it will fail. - $package_name = "php-${::php::params::pear_package_suffix}" - } - 'FreeBSD': { - # On FreeBSD the package name is just 'pear'. - $package_name = $::php::params::pear_package_suffix - } - default: { - # This is the default for all other architectures - $package_name = "${::php::package_prefix}${::php::params::pear_package_suffix}" + if $facts['os']['name'] == 'Amazon' { + # On Amazon Linux the package name is also just 'php-pear'. + # This would normally not be problematic but if you specify a + # package_prefix other than 'php' then it will fail. + $package_name = "php-${::php::params::pear_package_suffix}" + } + else { + case $facts['os']['family'] { + 'Debian': { + # Debian is a litte stupid: The pear package is called 'php-pear' + # even though others are called 'php5-fpm' or 'php5-dev' + $package_name = "php-${::php::params::pear_package_suffix}" + } + 'FreeBSD': { + # On FreeBSD the package name is just 'pear'. + $package_name = $::php::params::pear_package_suffix + } + default: { + # This is the default for all other architectures + $package_name = "${::php::package_prefix}${::php::params::pear_package_suffix}" + } } } } From 7b1ecfe32b2a947209fd1ed15b12280c62fca6dd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 4 Jan 2018 01:32:17 +0100 Subject: [PATCH 220/221] modulesync 1.6.0 --- .msync.yml | 2 +- .rubocop.yml | 2 +- .travis.yml | 7 +------ Rakefile | 27 +++++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.msync.yml b/.msync.yml index 80959a38..08e85ce0 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.5.0' +modulesync_config_version: '1.6.0' diff --git a/.rubocop.yml b/.rubocop.yml index 3fc819bf..099a11c5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -46,7 +46,7 @@ Style/HashSyntax: Style/RedundantReturn: Enabled: True -Style/EndOfLine: +Layout/EndOfLine: Enabled: False Lint/AmbiguousOperator: diff --git a/.travis.yml b/.travis.yml index c7e680e3..09153651 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,7 @@ dist: trusty language: ruby cache: bundler before_install: - - bundle -v - - rm Gemfile.lock || true - - gem update --system - - gem update bundler - - gem --version - - bundle -v + - rm -f Gemfile.lock script: - 'bundle exec rake $CHECK' matrix: diff --git a/Rakefile b/Rakefile index 14ccf58b..279580ac 100644 --- a/Rakefile +++ b/Rakefile @@ -26,6 +26,12 @@ exclude_paths = %w( PuppetLint.configuration.ignore_paths = exclude_paths PuppetSyntax.exclude_paths = exclude_paths +desc 'Auto-correct puppet-lint offenses' +task 'lint:auto_correct' do + PuppetLint.configuration.fix = true + Rake::Task[:lint].invoke +end + desc 'Run acceptance tests' RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' @@ -48,6 +54,27 @@ task test_with_coveralls: [:test] do end end +desc "Print supported beaker sets" +task 'beaker_sets', [:directory] do |t, args| + directory = args[:directory] + + metadata = JSON.load(File.read('metadata.json')) + + (metadata['operatingsystem_support'] || []).each do |os| + (os['operatingsystemrelease'] || []).each do |release| + if directory + beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}" + else + beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64" + end + + filename = "spec/acceptance/nodesets/#{beaker_set}.yml" + + puts beaker_set if File.exists? filename + end + end +end + begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| From d06297c431d60e8c0044750281305f59aae30027 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 27 Jan 2018 00:45:15 -0300 Subject: [PATCH 221/221] mark Puppet 5 as supported --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e8c32c66..c63a957f 100644 --- a/metadata.json +++ b/metadata.json @@ -33,7 +33,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.7.0 < 5.0.0" + "version_requirement": ">= 4.7.0 < 6.0.0" } ], "operatingsystem_support": [