From b16618649e72617e41faab423a0c40510a5ea47d Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Sat, 3 Dec 2016 07:07:29 +0100 Subject: [PATCH] Avoid relative classname inclusion Including a class by a relative name might lead to unexpected results; in addition to that there is also a small performance penalty. Signed-off-by: Julien Pivotto --- examples/apache.pp | 12 ++++++------ examples/dev.pp | 2 +- examples/init.pp | 2 +- examples/mod_load_params.pp | 2 +- examples/mods.pp | 2 +- examples/mods_custom.pp | 2 +- examples/php.pp | 4 ++-- examples/vhost.pp | 2 +- examples/vhost_directories.pp | 2 +- examples/vhost_filter.pp | 2 +- examples/vhost_ip_based.pp | 2 +- examples/vhost_proxypass.pp | 2 +- examples/vhost_ssl.pp | 2 +- examples/vhosts_without_listen.pp | 2 +- manifests/fastcgi/server.pp | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/examples/apache.pp b/examples/apache.pp index 0d4543564c..18ec55311b 100644 --- a/examples/apache.pp +++ b/examples/apache.pp @@ -1,6 +1,6 @@ -include apache -include apache::mod::php -include apache::mod::cgi -include apache::mod::userdir -include apache::mod::disk_cache -include apache::mod::proxy_http +include ::apache +include ::apache::mod::php +include ::apache::mod::cgi +include ::apache::mod::userdir +include ::apache::mod::disk_cache +include ::apache::mod::proxy_http diff --git a/examples/dev.pp b/examples/dev.pp index 6c4f95571d..5616e32bad 100644 --- a/examples/dev.pp +++ b/examples/dev.pp @@ -1 +1 @@ -include apache::mod::dev +include ::apache::mod::dev diff --git a/examples/init.pp b/examples/init.pp index b3f9f13aac..33911073b0 100644 --- a/examples/init.pp +++ b/examples/init.pp @@ -1 +1 @@ -include apache +include ::apache diff --git a/examples/mod_load_params.pp b/examples/mod_load_params.pp index 0e84c5efbf..fa43132b73 100644 --- a/examples/mod_load_params.pp +++ b/examples/mod_load_params.pp @@ -1,7 +1,7 @@ # Tests the path and identifier parameters for the apache::mod class # Base class for clarity: -class { 'apache': } +class { '::apache': } # Exaple parameter usage: diff --git a/examples/mods.pp b/examples/mods.pp index 59362bd9a0..699638248d 100644 --- a/examples/mods.pp +++ b/examples/mods.pp @@ -3,7 +3,7 @@ # Base class. Declares default vhost on port 80 and default ssl # vhost on port 443 listening on all interfaces and serving # $apache::docroot, and declaring our default set of modules. -class { 'apache': +class { '::apache': default_mods => true, } diff --git a/examples/mods_custom.pp b/examples/mods_custom.pp index 0ae699c73d..4098c83aae 100644 --- a/examples/mods_custom.pp +++ b/examples/mods_custom.pp @@ -3,7 +3,7 @@ # Base class. Declares default vhost on port 80 and default ssl # vhost on port 443 listening on all interfaces and serving # $apache::docroot, and declaring a custom set of modules. -class { 'apache': +class { '::apache': default_mods => [ 'info', 'alias', diff --git a/examples/php.pp b/examples/php.pp index 1d926bfb46..ee187717e7 100644 --- a/examples/php.pp +++ b/examples/php.pp @@ -1,4 +1,4 @@ -class { 'apache': +class { '::apache': mpm_module => 'prefork', } -include apache::mod::php +include ::apache::mod::php diff --git a/examples/vhost.pp b/examples/vhost.pp index 486570f815..1b9b08e127 100644 --- a/examples/vhost.pp +++ b/examples/vhost.pp @@ -5,7 +5,7 @@ # Base class. Declares default vhost on port 80 and default ssl # vhost on port 443 listening on all interfaces and serving # $apache::docroot -class { 'apache': } +class { '::apache': } # Most basic vhost apache::vhost { 'first.example.com': diff --git a/examples/vhost_directories.pp b/examples/vhost_directories.pp index b8953ee321..df5a2d52a1 100644 --- a/examples/vhost_directories.pp +++ b/examples/vhost_directories.pp @@ -1,7 +1,7 @@ # Base class. Declares default vhost on port 80 and default ssl # vhost on port 443 listening on all interfaces and serving # $apache::docroot -class { 'apache': } +class { '::apache': } # Example from README adapted. apache::vhost { 'readme.example.net': diff --git a/examples/vhost_filter.pp b/examples/vhost_filter.pp index ca1a8bbe03..1a66b856b7 100644 --- a/examples/vhost_filter.pp +++ b/examples/vhost_filter.pp @@ -1,5 +1,5 @@ # Base class. Declares default vhost on port 80 with filters. -class { 'apache': } +class { '::apache': } # Example from README adapted. apache::vhost { 'readme.example.net': diff --git a/examples/vhost_ip_based.pp b/examples/vhost_ip_based.pp index dc0fa4f33b..249c4199c0 100644 --- a/examples/vhost_ip_based.pp +++ b/examples/vhost_ip_based.pp @@ -3,7 +3,7 @@ # Base class. Turn off the default vhosts; we will be declaring # all vhosts below. -class { 'apache': +class { '::apache': default_vhost => false, } diff --git a/examples/vhost_proxypass.pp b/examples/vhost_proxypass.pp index e911f85f9d..458dbd4092 100644 --- a/examples/vhost_proxypass.pp +++ b/examples/vhost_proxypass.pp @@ -5,7 +5,7 @@ # Base class. Declares default vhost on port 80 and default ssl # vhost on port 443 listening on all interfaces and serving # $apache::docroot -class { 'apache': } +class { '::apache': } # Most basic vhost with proxy_pass apache::vhost { 'first.example.com': diff --git a/examples/vhost_ssl.pp b/examples/vhost_ssl.pp index 8e7a2b279e..53989ff1b6 100644 --- a/examples/vhost_ssl.pp +++ b/examples/vhost_ssl.pp @@ -3,7 +3,7 @@ # Base class. Turn off the default vhosts; we will be declaring # all vhosts below. -class { 'apache': +class { '::apache': default_vhost => false, } diff --git a/examples/vhosts_without_listen.pp b/examples/vhosts_without_listen.pp index e7d6cc036c..0e97a0221f 100644 --- a/examples/vhosts_without_listen.pp +++ b/examples/vhosts_without_listen.pp @@ -4,7 +4,7 @@ # Base class. Turn off the default vhosts; we will be declaring # all vhosts below. -class { 'apache': +class { '::apache': default_vhost => false, } diff --git a/manifests/fastcgi/server.pp b/manifests/fastcgi/server.pp index 3493194917..78363062ba 100644 --- a/manifests/fastcgi/server.pp +++ b/manifests/fastcgi/server.pp @@ -7,7 +7,7 @@ $file_type = 'application/x-httpd-php', $pass_header = undef, ) { - include apache::mod::fastcgi + include ::apache::mod::fastcgi Apache::Mod['fastcgi'] -> Apache::Fastcgi::Server[$title]