Skip to content

Commit

Permalink
Merge pull request #510 from 3flex/fully-qualify-variables
Browse files Browse the repository at this point in the history
Fully qualify classes, defines and variables
  • Loading branch information
3flex committed Nov 27, 2014
2 parents 8b304c5 + f18dcf0 commit b9743d3
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 89 deletions.
34 changes: 17 additions & 17 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,23 @@
$sites_available_owner or
$sites_available_group or
$sites_available_mode {
include nginx::notice::config
include ::nginx::notice::config
}

### END DEPRECATION WARNING ###

class { 'nginx::package':
class { '::nginx::package':
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
notify => Class['nginx::service'],
notify => Class['::nginx::service'],
manage_repo => $manage_repo,
}

## This `if` statement is here in the event a user cannot use
## Hiera based parameter overrides. Will not be here in 1.0 release
if !defined(Class['nginx::config']) {
class { 'nginx::config':
if !defined(Class['::nginx::config']) {
class { '::nginx::config':
client_body_buffer_size => $client_body_buffer_size,
client_body_temp_path => $client_body_temp_path,
client_max_body_size => $client_max_body_size,
Expand Down Expand Up @@ -277,28 +277,28 @@
sites_available_owner => $sites_available_owner,
sites_available_group => $sites_available_group,
sites_available_mode => $sites_available_mode,
require => Class['nginx::package'],
notify => Class['nginx::service'],
require => Class['::nginx::package'],
notify => Class['::nginx::service'],
}
}

class { 'nginx::service': }
class { '::nginx::service': }

create_resources('nginx::resource::upstream', $nginx_upstreams)
create_resources('nginx::resource::vhost', $nginx_vhosts, $nginx_vhosts_defaults)
create_resources('nginx::resource::location', $nginx_locations)
create_resources('nginx::resource::mailhost', $nginx_mailhosts)
create_resources('nginx::resource::map', $string_mappings)
create_resources('nginx::resource::geo', $geo_mappings)
create_resources('::nginx::resource::upstream', $nginx_upstreams)
create_resources('::nginx::resource::vhost', $nginx_vhosts, $nginx_vhosts_defaults)
create_resources('::nginx::resource::location', $nginx_locations)
create_resources('::nginx::resource::mailhost', $nginx_mailhosts)
create_resources('::nginx::resource::map', $string_mappings)
create_resources('::nginx::resource::geo', $geo_mappings)

# Allow the end user to establish relationships to the "main" class
# and preserve the relationship to the implementation classes through
# a transitive relationship to the composite class.
anchor{ 'nginx::begin':
before => Class['nginx::package'],
notify => Class['nginx::service'],
before => Class['::nginx::package'],
notify => Class['::nginx::service'],
}
anchor { 'nginx::end':
require => Class['nginx::service'],
require => Class['::nginx::service'],
}
}
18 changes: 9 additions & 9 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

case $::osfamily {
'redhat': {
class { 'nginx::package::redhat':
class { '::nginx::package::redhat':
manage_repo => $manage_repo,
package_ensure => $package_ensure,
package_name => $package_name,
Expand All @@ -34,7 +34,7 @@
}
}
'debian': {
class { 'nginx::package::debian':
class { '::nginx::package::debian':
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
Expand All @@ -44,20 +44,20 @@
}
}
'suse': {
class { 'nginx::package::suse':
class { '::nginx::package::suse':
package_name => $package_name,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'archlinux': {
class { 'nginx::package::archlinux':
class { '::nginx::package::archlinux':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'Solaris': {
class { 'nginx::package::solaris':
class { '::nginx::package::solaris':
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
Expand All @@ -66,23 +66,23 @@
}
}
'FreeBSD': {
class { 'nginx::package::freebsd':
class { '::nginx::package::freebsd':
package_name => $package_name,
package_ensure => $package_ensure,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'Gentoo': {
class { 'nginx::package::gentoo':
class { '::nginx::package::gentoo':
package_name => $package_name,
package_ensure => $package_ensure,
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'OpenBSD': {
class { 'nginx::package::openbsd':
class { '::nginx::package::openbsd':
package_name => $package_name,
package_ensure => $package_ensure,
require => Anchor['nginx::package::begin'],
Expand All @@ -96,7 +96,7 @@
# https://github.com/puppetlabs/facter/commit/c12d3b6c557df695a7b2b009da099f6a93c7bd31#lib/facter/osfamily.rb
warning("Module ${module_name} support for ${::operatingsystem} with facter < 1.7.2 is deprecated")
warning("Please upgrade from facter ${::facterversion} to >= 1.7.2")
class { 'nginx::package::redhat':
class { '::nginx::package::redhat':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/package/suse.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
}

package { $package_name:
ensure => $nginx::package_ensure,
ensure => $::nginx::package_ensure,
}
}
6 changes: 3 additions & 3 deletions manifests/resource/geo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
if ($proxies != undef) { validate_array($proxies) }
if ($proxy_recursive != undef) { validate_bool($proxy_recursive) }

$root_group = $nginx::config::root_group
$root_group = $::nginx::config::root_group

$ensure_real = $ensure ? {
'absent' => 'absent',
Expand All @@ -86,9 +86,9 @@
mode => '0644',
}

file { "${nginx::config::conf_dir}/conf.d/${name}-geo.conf":
file { "${::nginx::config::conf_dir}/conf.d/${name}-geo.conf":
ensure => $ensure_real,
content => template('nginx/conf.d/geo.erb'),
notify => Class['nginx::service'],
notify => Class['::nginx::service'],
}
}
18 changes: 9 additions & 9 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@
'index.htm',
'index.php'],
$proxy = undef,
$proxy_redirect = $nginx::config::proxy_redirect,
$proxy_read_timeout = $nginx::config::proxy_read_timeout,
$proxy_connect_timeout = $nginx::config::proxy_connect_timeout,
$proxy_set_header = $nginx::config::proxy_set_header,
$proxy_redirect = $::nginx::config::proxy_redirect,
$proxy_read_timeout = $::nginx::config::proxy_read_timeout,
$proxy_connect_timeout = $::nginx::config::proxy_connect_timeout,
$proxy_set_header = $::nginx::config::proxy_set_header,
$fastcgi = undef,
$fastcgi_param = undef,
$fastcgi_params = "${nginx::config::conf_dir}/fastcgi_params",
$fastcgi_params = "${::nginx::config::conf_dir}/fastcgi_params",
$fastcgi_script = undef,
$fastcgi_split_path = undef,
$ssl = false,
Expand Down Expand Up @@ -173,13 +173,13 @@
$flv = false,
) {

$root_group = $nginx::config::root_group
$root_group = $::nginx::config::root_group

File {
owner => 'root',
group => $root_group,
mode => '0644',
notify => Class['nginx::service'],
notify => Class['::nginx::service'],
}

validate_re($ensure, '^(present|absent)$',
Expand Down Expand Up @@ -299,7 +299,7 @@
}

$vhost_sanitized = regsubst($vhost, ' ', '_', 'G')
$config_file = "${nginx::config::conf_dir}/sites-available/${vhost_sanitized}.conf"
$config_file = "${::nginx::config::conf_dir}/sites-available/${vhost_sanitized}.conf"

$location_sanitized_tmp = regsubst($location, '\/', '_', 'G')
$location_sanitized = regsubst($location_sanitized_tmp, '\\\\', '_', 'G')
Expand Down Expand Up @@ -378,7 +378,7 @@

if ($auth_basic_user_file != undef) {
#Generate htpasswd with provided file-locations
file { "${nginx::config::conf_dir}/${location_sanitized}_htpasswd":
file { "${::nginx::config::conf_dir}/${location_sanitized}_htpasswd":
ensure => $ensure,
mode => '0644',
source => $auth_basic_user_file,
Expand Down
6 changes: 3 additions & 3 deletions manifests/resource/mailhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
$server_name = [$name]
) {

$root_group = $nginx::config::root_group
$root_group = $::nginx::config::root_group

File {
owner => 'root',
Expand Down Expand Up @@ -105,7 +105,7 @@
validate_string($xclient)
validate_array($server_name)

$config_file = "${nginx::config::conf_dir}/conf.mail.d/${name}.conf"
$config_file = "${::nginx::config::conf_dir}/conf.mail.d/${name}.conf"

# Add IPv6 Logic Check - Nginx service will not start if ipv6 is enabled
# and support does not exist for it in the kernel.
Expand All @@ -124,7 +124,7 @@
owner => 'root',
group => $root_group,
mode => '0644',
notify => Class['nginx::service'],
notify => Class['::nginx::service'],
}

if ($listen_port != $ssl_port) {
Expand Down
6 changes: 3 additions & 3 deletions manifests/resource/map.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"Invalid ensure value '${ensure}'. Expected 'present' or 'absent'")
if ($default != undef) { validate_string($default) }

$root_group = $nginx::config::root_group
$root_group = $::nginx::config::root_group

$ensure_real = $ensure ? {
'absent' => absent,
Expand All @@ -70,9 +70,9 @@
mode => '0644',
}

file { "${nginx::config::conf_dir}/conf.d/${name}-map.conf":
file { "${::nginx::config::conf_dir}/conf.d/${name}-map.conf":
ensure => $ensure_real,
content => template('nginx/conf.d/map.erb'),
notify => Class['nginx::service'],
notify => Class['::nginx::service'],
}
}
14 changes: 7 additions & 7 deletions manifests/resource/upstream.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
validate_hash($upstream_cfg_prepend)
}

$root_group = $nginx::config::root_group
$root_group = $::nginx::config::root_group

$ensure_real = $ensure ? {
'absent' => absent,
Expand All @@ -67,32 +67,32 @@
mode => '0644',
}

concat { "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf":
concat { "${::nginx::config::conf_dir}/conf.d/${name}-upstream.conf":
ensure => $ensure_real,
notify => Class['nginx::service'],
notify => Class['::nginx::service'],
}

# Uses: $name, $upstream_cfg_prepend
concat::fragment { "${name}_upstream_header":
target => "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
target => "${::nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
order => '10',
content => template('nginx/conf.d/upstream_header.erb'),
}

if $members != undef {
# Uses: $members, $upstream_fail_timeout
concat::fragment { "${name}_upstream_members":
target => "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
target => "${::nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
order => '50',
content => template('nginx/conf.d/upstream_members.erb'),
}
} else {
# Collect exported members:
Nginx::Resource::Upstream::Member <<| upstream == $name |>>
::Nginx::Resource::Upstream::Member <<| upstream == $name |>>
}

concat::fragment { "${name}_upstream_footer":
target => "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
target => "${::nginx::config::conf_dir}/conf.d/${name}-upstream.conf",
order => '90',
content => "}\n",
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/resource/upstream/member.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

# Uses: $server, $port, $upstream_fail_timeout
concat::fragment { "${upstream}_upstream_member_${name}":
target => "${nginx::config::conf_dir}/conf.d/${upstream}-upstream.conf",
target => "${::nginx::config::conf_dir}/conf.d/${upstream}-upstream.conf",
order => 40,
content => template('nginx/conf.d/upstream_member.erb'),
}
Expand Down
Loading

0 comments on commit b9743d3

Please sign in to comment.