Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

fully_qualified_vars #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is a Puppet module for php based on the second generation layout ("NextGen") of Example42 Puppet Modules.

Made by ALessandro Franceschi / Lab42
ade by ALessandro Franceschi / Lab42

Official site: http://www.example42.com

Expand Down
8 changes: 4 additions & 4 deletions manifests/augeas.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@
define php::augeas (
$entry,
$ensure = present,
$target = $php::config_file,
$target = $::php::config_file,
$value = '',
) {

include php

$service = $php::service
$service = $::php::service

$changes = $ensure ? {
present => [ "set '${entry}' '${value}'" ],
absent => [ "rm '${entry}'" ],
require => Package[$php::package],
require => Package[$::php::package],
}

augeas { "php_ini-${name}":
incl => $target,
lens => 'Php.lns',
changes => $changes,
require => Package[$php::package],
require => Package[$::php::package],
}

}
2 changes: 1 addition & 1 deletion manifests/conf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
include php

$managed_path = $path ? {
undef => "${php::config_dir}/${name}",
undef => "${::php::config_dir}/${name}",
default => $path,
}

Expand Down
10 changes: 5 additions & 5 deletions manifests/devel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#
class php::devel {

if $php::package_devel != ''
and ! defined(Package[$php::package_devel]) {
package { $php::package_devel :
ensure => $php::manage_package,
install_options => $php::install_options,
if $::php::package_devel != ''
and ! defined(Package[$::php::package_devel]) {
package { $::php::package_devel :
ensure => $::php::manage_package,
install_options => $::php::install_options,
}
}
}
6 changes: 3 additions & 3 deletions manifests/ini.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
$template = 'php/extra-ini.erb',
$target = 'extra.ini',
$sapi_target = 'all',
$service = $php::service,
$config_dir = $php::config_dir,
$package = $php::package
$service = $::php::service,
$config_dir = $::php::config_dir,
$package = $::php::package
) {

include php
Expand Down
88 changes: 44 additions & 44 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
$log_file = params_lookup( 'log_file' ),
$port = params_lookup( 'port' ),
$protocol = params_lookup( 'protocol' )
) inherits php::params {
) inherits ::php::params {

$bool_service_autorestart=any2bool($service_autorestart)
$bool_source_dir_purge=any2bool($source_dir_purge)
Expand All @@ -196,116 +196,116 @@
$bool_audit_only=any2bool($audit_only)

### Definition of some variables used in the module
$manage_package = $php::bool_absent ? {
$manage_package = $::php::bool_absent ? {
true => 'absent',
false => $php::version,
false => $::php::version,
}

$manage_file = $php::bool_absent ? {
$manage_file = $::php::bool_absent ? {
true => 'absent',
default => 'present',
}

if $php::bool_absent == true {
if $::php::bool_absent == true {
$manage_monitor = false
} else {
$manage_monitor = true
}

$manage_audit = $php::bool_audit_only ? {
$manage_audit = $::php::bool_audit_only ? {
true => 'all',
false => undef,
}

$manage_file_replace = $php::bool_audit_only ? {
$manage_file_replace = $::php::bool_audit_only ? {
true => false,
false => true,
}

if ($php::source != '' and $php::source != false and $php::template != '' and
$php::template != false) {
if ($::php::source != '' and $::php::source != false and $::php::template != '' and
$::php::template != false) {
fail ('PHP: cannot set both source and template')
}
if ($php::source != '' and $php::source != false and $php::bool_augeas) {
if ($::php::source != '' and $::php::source != false and $::php::bool_augeas) {
fail ('PHP: cannot set both source and augeas')
}
if ($php::template != '' and $php::template != false and $php::bool_augeas) {
if ($::php::template != '' and $::php::template != false and $::php::bool_augeas) {
fail ('PHP: cannot set both template and augeas')
}

$manage_file_source = $php::source ? {
$manage_file_source = $::php::source ? {
'' => undef,
default => $php::source,
default => $::php::source,
}

$manage_file_content = $php::template ? {
$manage_file_content = $::php::template ? {
'' => undef,
default => template($php::template),
default => template($::php::template),
}

$realservice_autorestart = $bool_service_autorestart ? {
true => Service[$php::service],
true => Service[$::php::service],
false => undef,
}

### Managed resources
package { $php::package:
ensure => $php::manage_package,
install_options => $php::install_options,
package { $::php::package:
ensure => $::php::manage_package,
install_options => $::php::install_options,
}

file { 'php.conf':
ensure => $php::manage_file,
path => $php::config_file,
mode => $php::config_file_mode,
owner => $php::config_file_owner,
group => $php::config_file_group,
require => Package[$php::package],
source => $php::manage_file_source,
content => $php::manage_file_content,
replace => $php::manage_file_replace,
audit => $php::manage_audit,
ensure => $::php::manage_file,
path => $::php::config_file,
mode => $::php::config_file_mode,
owner => $::php::config_file_owner,
group => $::php::config_file_group,
require => Package[$::php::package],
source => $::php::manage_file_source,
content => $::php::manage_file_content,
replace => $::php::manage_file_replace,
audit => $::php::manage_audit,
notify => $realservice_autorestart,
}

# The whole php configuration directory can be recursively overriden
if $php::source_dir != '' and $php::source_dir != false {
if $::php::source_dir != '' and $::php::source_dir != false {
file { 'php.dir':
ensure => directory,
path => $php::config_dir,
require => Package[$php::package],
source => $php::source_dir,
path => $::php::config_dir,
require => Package[$::php::package],
source => $::php::source_dir,
recurse => true,
links => follow,
purge => $php::bool_source_dir_purge,
force => $php::bool_source_dir_purge,
replace => $php::manage_file_replace,
audit => $php::manage_audit,
purge => $::php::bool_source_dir_purge,
force => $::php::bool_source_dir_purge,
replace => $::php::manage_file_replace,
audit => $::php::manage_audit,
}
}


### Include custom class if $my_class is set
if $php::my_class != '' and $php::my_class != false {
include $php::my_class
if $::php::my_class != '' and $::php::my_class != false {
include $::php::my_class
}


### Provide puppi data, if enabled ( puppi => true )
if $php::bool_puppi == true {
if $::php::bool_puppi == true {
$classvars=get_class_args()
puppi::ze { 'php':
ensure => $php::manage_file,
ensure => $::php::manage_file,
variables => $classvars,
helper => $php::puppi_helper,
helper => $::php::puppi_helper,
}
}


### Debugging, if enabled ( debug => true )
if $php::bool_debug == true {
if $::php::bool_debug == true {
file { 'debug_php':
ensure => $php::manage_file,
ensure => $::php::manage_file,
path => "${settings::vardir}/debug-php",
mode => '0640',
owner => 'root',
Expand Down
12 changes: 5 additions & 7 deletions manifests/mod.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
$disable = false,
$service_autorestart = '',
$path = '/usr/bin:/bin:/usr/sbin:/sbin',
$package = $php::package
) {

include php
$package = $::php::package,
) inherits ::php {

if $disable {
$php_mod_tool = 'php5dismod'
Expand All @@ -51,10 +49,10 @@
}

$real_service_autorestart = $service_autorestart ? {
true => "Service[${php::service}]",
true => "Service[${::php::service}]",
false => undef,
'' => $php::service_autorestart ? {
true => "Service[${php::service}]",
'' => $::php::service_autorestart ? {
true => "Service[${::php::service}]",
false => undef,
}
}
Expand Down
12 changes: 6 additions & 6 deletions manifests/module.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
$service_autorestart = '',
$module_prefix = '',
$absent = '',
$package = $php::package
$package = $::php::package
) {

include php
include ::php

if $absent != '' and $absent != false {
$real_version = 'absent'
Expand All @@ -63,21 +63,21 @@
}

$real_service_autorestart = $service_autorestart ? {
true => "Service[${php::service}]",
true => "Service[${::php::service}]",
false => undef,
'' => $php::service_autorestart ? {
true => "Service[${php::service}]",
true => "Service[${::php::service}]",
false => undef,
}
}

$real_module_prefix = $module_prefix ? {
'' => $php::module_prefix,
'' => $::php::module_prefix,
default => $module_prefix,
}

$real_install_options = $install_options ? {
'' => $php::install_options,
'' => $::php::install_options,
default => $install_options,
}

Expand Down
8 changes: 4 additions & 4 deletions manifests/pear.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
# Default: true
#
# [*install_options*]
# An array of package manager install options. See $php::install_options
# An array of package manager install options. See $::php::install_options
#
class php::pear (
$package = $php::package_pear,
$package = $::php::package_pear,
$install_package = true,
$install_options = [],
$version = 'present',
$path = '/usr/bin:/usr/sbin:/bin:/sbin'
) inherits php {
) inherits ::php {

$real_install_options = $install_options ? {
'' => $php::install_options,
'' => $::php::install_options,
default => $install_options,
}

Expand Down
4 changes: 2 additions & 2 deletions manifests/pear/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#
define php::pear::config ($value) {

include php::pear
include ::php::pear

exec { "pear-config-set-${name}":
command => "pear config-set ${name} ${value}",
path => $php::pear::path,
path => $::php::pear::path,
unless => "pear config-get ${name} | grep ${value}",
require => Package['php-pear'],
}
Expand Down
12 changes: 6 additions & 6 deletions manifests/pear/module.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# If set to "no" it installs the module via pear command
#
# [*install_options*]
# An array of package manager install options. See $php::install_options
# An array of package manager install options. See $::php::install_options
#
# [*preferred_state*]
# (default="stable") - Define which preferred state to use when installing
Expand Down Expand Up @@ -38,7 +38,7 @@
$timeout = 300
) {

include php::pear
include ::php::pear

$bool_use_package = any2bool($use_package)
$bool_alldeps = any2bool($alldeps)
Expand Down Expand Up @@ -73,27 +73,27 @@
}

$real_service = $service ? {
'' => $php::service,
'' => $::php::service,
default => $service,
}

$real_service_autorestart = $service_autorestart ? {
true => "Service[${real_service}]",
false => undef,
'' => $php::service_autorestart ? {
'' => $::php::service_autorestart ? {
true => "Service[${real_service}]",
false => undef,
}
}

$real_module_prefix = $module_prefix ? {
'' => $php::pear_module_prefix,
'' => $::php::pear_module_prefix,
default => $module_prefix,
}
$package_name = "${real_module_prefix}${name}"

$real_install_options = $install_options ? {
'' => $php::install_options,
'' => $::php::install_options,
default => $install_options,
}

Expand Down
Loading