Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Fix data types of all parameters #634

Merged
merged 8 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions manifests/apache_vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# address of the fastcgi socket
#
define php::apache_vhost (
$vhost = 'example.com',
$docroot = '/var/www',
$port = 80,
$default_vhost = true,
$fastcgi_socket = 'fcgi://127.0.0.1:9000/$1'
String[1] $vhost = 'example.com',
Stdlib::Absolutepath $docroot = '/var/www',
Integer[1] $port = 80,
Boolean $default_vhost = true,
String[1] $fastcgi_socket = 'fcgi://127.0.0.1:9000/$1'
) {
::apache::vhost { $vhost:
docroot => $docroot,
Expand Down
4 changes: 2 additions & 2 deletions manifests/composer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
class php::composer (
String $source = $php::params::composer_source,
Stdlib::Absolutepath $path = $php::params::composer_path,
$proxy_type = undef,
$proxy_server = undef,
Optional[String[1]] $proxy_type = undef,
Optional[String[1]] $proxy_server = undef,
Php::ComposerChannel $channel = 'stable',
Boolean $auto_update = true,
Integer $max_age = $php::params::composer_max_age,
Expand Down
10 changes: 5 additions & 5 deletions manifests/composer/auto_update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
# }
#
class php::composer::auto_update (
$max_age,
$source,
$path,
Integer[1] $max_age,
String[1] $source,
Stdlib::Absolutepath $path,
Php::ComposerChannel $channel = 'stable',
$proxy_type = undef,
$proxy_server = undef,
Optional[String[1]] $proxy_type = undef,
Optional[String[1]] $proxy_server = undef,
) {
assert_private()

Expand Down
4 changes: 2 additions & 2 deletions manifests/config/setting.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# }
#
define php::config::setting (
$key,
$value,
String[1] $key,
Variant[Integer, String[1]] $value,
Stdlib::Absolutepath $file,
) {
assert_private()
Expand Down
20 changes: 10 additions & 10 deletions manifests/fpm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@
# This default will be changed in a future release.
#
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,
Optional[String] $ensure = $php::ensure,
String[1] $user = $php::fpm_user,
String[1] $group = $php::fpm_group,
Enum['running', 'stopped'] $service_ensure = $php::fpm_service_ensure,
Boolean $service_enable = $php::fpm_service_enable,
String[1] $service_name = $php::fpm_service_name,
Optional[String[1]] $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 $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,
String[1] $log_owner = $php::log_owner,
String[1] $log_group = $php::log_group,
Boolean $pool_purge = $php::pool_purge,
Boolean $reload_fpm_on_config_changes = $php::reload_fpm_on_config_changes,
) {
Expand Down
16 changes: 8 additions & 8 deletions manifests/fpm/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,26 @@
# Path to fpm pid file
#
class php::fpm::config (
$config_file = $php::params::fpm_config_file,
Stdlib::Absolutepath $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,
Stdlib::Absolutepath $pid_file = $php::params::fpm_pid_file,
Hash $settings = {},
Stdlib::Absolutepath $pool_base_dir = $php::params::fpm_pool_dir,
$pool_purge = false,
Boolean $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,
Php::Duration $emergency_restart_interval = 0,
Php::Duration $process_control_timeout = 0,
Integer $process_max = 0,
$rlimit_files = undef,
Optional[Variant[Integer,Pattern[/^\d+[smhd]?$/]]] $systemd_interval = undef,
Optional[Integer[1]] $rlimit_files = undef,
Optional[Php::Duration] $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[1] $root_group = $php::params::root_group,
String $syslog_facility = 'daemon',
String $syslog_ident = 'php-fpm',
) inherits php::params {
Expand Down
84 changes: 42 additions & 42 deletions manifests/fpm/pool.pp
Original file line number Diff line number Diff line change
Expand Up @@ -121,49 +121,49 @@
# '/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,
Enum['present', 'absent'] $ensure = 'present',
String[1] $listen = '127.0.0.1:9000',
Integer[-1] $listen_backlog = -1,
Optional[String[1]] $listen_allowed_clients = undef,
Optional[String[1]] $listen_owner = undef,
Optional[String[1]] $listen_group = undef,
Optional[Stdlib::Filemode] $listen_mode = undef,
String[1] $user = $php::fpm::config::user,
String[1] $group = $php::fpm::config::group,
Optional[String[1]] $apparmor_hat = undef,
$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 = {},
$clear_env = true,
$options = {},
$php_value = {},
$php_flag = {},
$php_admin_value = {},
$php_admin_flag = {},
$php_directives = [],
$root_group = $php::params::root_group,
String[1] $pm = 'dynamic',
Integer[1] $pm_max_children = 50,
Integer[1] $pm_start_servers = 5,
Integer[0] $pm_min_spare_servers = 5,
Integer[0] $pm_max_spare_servers = 35,
Integer[0] $pm_max_requests = 0,
Php::Duration $pm_process_idle_timeout = '10s',
Optional[Stdlib::Absolutepath] $pm_status_path = undef,
Optional[Stdlib::Absolutepath] $ping_path = undef,
String[1] $ping_response = 'pong',
Optional[Stdlib::Absolutepath] $access_log = undef,
String[1] $access_log_format = '"%R - %u %t \"%m %r\" %s"',
Php::Duration $request_terminate_timeout = 0,
Php::Duration $request_slowlog_timeout = 0,
Array[String[1]] $security_limit_extensions = [],
Stdlib::Absolutepath $slowlog = "/var/log/php-fpm/${name}-slow.log",
String[1] $template = 'php/fpm/pool.conf.erb',
Optional[Integer] $rlimit_files = undef,
Optional[Integer] $rlimit_core = undef,
Optional[Stdlib::Absolutepath] $chroot = undef,
Optional[Stdlib::Absolutepath] $chdir = undef,
Enum['yes', 'no'] $catch_workers_output = 'no',
Optional[String[1]] $include = undef,
Array[String[1]] $env = [],
Hash $env_value = {},
Boolean $clear_env = true,
Hash $options = {},
Hash $php_value = {},
Hash $php_flag = {},
Hash $php_admin_value = {},
Hash $php_admin_flag = {},
Array[String[1]] $php_directives = [],
String[1] $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
Expand Down
8 changes: 4 additions & 4 deletions manifests/fpm/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
# This default will be changed in a future release.
#
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,
String[1] $service_name = $php::fpm::service_name,
Enum['running', 'stopped'] $ensure = $php::fpm::service_ensure,
Boolean $enable = $php::fpm::service_enable,
Optional[String[1]] $provider = $php::fpm::service_provider,
Boolean $reload_fpm_on_config_changes = $php::fpm::reload_fpm_on_config_changes,
) {
if ! defined(Class['php::fpm']) {
Expand Down
4 changes: 1 addition & 3 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
# The mode specifies the specifics in paths for the various RedHat SCL environments so that the module is configured
# correctly on their pathnames.
#
# Valid modes are: 'rhscl', 'remi'
#

class php::globals (

Optional[Pattern[/^(rh-)?(php)?[57](\.)?[0-9]/]] $php_version = undef,
Optional[Stdlib::Absolutepath] $config_root = undef,
Optional[Stdlib::Absolutepath] $fpm_pid_file = undef,
$rhscl_mode = undef,
Optional[Enum['rhscl', 'remi']] $rhscl_mode = undef,
) {
$default_php_version = $facts['os']['name'] ? {
'Debian' => $facts['os']['release']['major'] ? {
Expand Down
22 changes: 11 additions & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,29 @@
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,
Boolean $fpm_service_enable = $php::params::fpm_service_enable,
Enum['running', 'stopped'] $fpm_service_ensure = $php::params::fpm_service_ensure,
String[1] $fpm_service_name = $php::params::fpm_service_name,
Optional[String[1]] $fpm_service_provider = undef,
Hash $fpm_pools = $php::params::fpm_pools,
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,
Stdlib::Absolutepath $fpm_inifile = $php::params::fpm_inifile,
Optional[String[1]] $fpm_package = undef,
String[1] $fpm_user = $php::params::fpm_user,
String[1] $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,
Optional[String[1]] $proxy_type = undef,
Optional[String[1]] $proxy_server = undef,
Hash $extensions = {},
Hash $settings = {},
Hash $cli_settings = {},
$package_prefix = $php::params::package_prefix,
Optional[String[1]] $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,
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'www' => {
'catch_workers_output' => 'no',
'listen' => '127.0.0.1:9000',
'listen_backlog' => '-1',
'listen_backlog' => -1,
'pm' => 'dynamic',
'pm_max_children' => 50,
'pm_max_requests' => 0,
Expand Down
6 changes: 3 additions & 3 deletions manifests/phpunit/auto_update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# Holds path to the phpunit executable
#
class php::phpunit::auto_update (
$max_age,
$source,
$path,
Integer[1] $max_age,
String[1] $source,
Stdlib::Absolutepath $path,
) {
assert_private()

Expand Down
14 changes: 7 additions & 7 deletions manifests/repo/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
# Enable special sury handling
#
class php::repo::debian (
$location = 'https://packages.dotdeb.org',
$release = 'wheezy-php56',
$repos = 'all',
$include_src = false,
$key = {
String[1] $location = 'https://packages.dotdeb.org',
String[1] $release = 'wheezy-php56',
String[1] $repos = 'all',
Boolean $include_src = false,
Hash $key = {
'id' => '6572BBEF1B5FF28B28B706837E3F070089DF5277',
'source' => 'http://www.dotdeb.org/dotdeb.gpg',
},
$dotdeb = true,
$sury = true,
Boolean $dotdeb = true,
Boolean $sury = true,
) {
assert_private()

Expand Down
2 changes: 1 addition & 1 deletion manifests/repo/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#

class php::repo::redhat (
$yum_repo = 'remi_php56',
String[1] $yum_repo = 'remi_php56',
) {
$releasever = $facts['os']['name'] ? {
/(?i:Amazon)/ => '6',
Expand Down
4 changes: 2 additions & 2 deletions manifests/repo/suse.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# Base URL of the Zypper repository
#
class php::repo::suse (
$reponame = 'mayflower-php56',
$baseurl = 'http://download.opensuse.org/repositories/home:/mayflower:/php5.6_based/SLE_11_SP3/',
String[1] $reponame = 'mayflower-php56',
String[1] $baseurl = 'http://download.opensuse.org/repositories/home:/mayflower:/php5.6_based/SLE_11_SP3/',
) {
zypprepo { $reponame:
baseurl => $baseurl,
Expand Down
13 changes: 3 additions & 10 deletions manifests/repo/ubuntu.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,18 @@
# PHP version to manage (e.g. 5.6)
#
class php::repo::ubuntu (
$version = undef,
Pattern[/^\d\.\d/] $version = '5.6',
) {
if $facts['os']['name'] != 'Ubuntu' {
fail("class php::repo::ubuntu does not work on OS ${facts['os']['name']}")
}
include 'apt'

if($version == undef) {
$version_real = '5.6'
} else {
$version_real = $version
}

if ($version_real == '5.5') {
if ($version == '5.5') {
fail('PHP 5.5 is no longer available for download')
}
assert_type(Pattern[/^\d\.\d/], $version_real)

$version_repo = $version_real ? {
$version_repo = $version ? {
'5.4' => 'ondrej/php5-oldstable',
default => 'ondrej/php'
}
Expand Down
3 changes: 0 additions & 3 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@
'gd' => {},
'net-url' => {
package_prefix => 'php-',
settings => {
extension => undef
},
},
'simplexml' => {
package_name => '#{simplexmlpackagename}',
Expand Down
Loading