Skip to content

Commit

Permalink
Merge pull request #1193 from bastelfreak/facts
Browse files Browse the repository at this point in the history
switch from topscope facts to facts hash
  • Loading branch information
bastelfreak authored Mar 17, 2018
2 parents 8267d86 + dd7fd74 commit 1d5f9d8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

assert_private()

case $::osfamily {
case $facts['os']['family'] {
'redhat': {
contain ::nginx::package::redhat
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$passenger_package_ensure = $::nginx::passenger_package_ensure
$manage_repo = $::nginx::manage_repo

$distro = downcase($::operatingsystem)
$distro = downcase($facts['os']['name'])

package { 'nginx':
ensure => $package_ensure,
Expand Down
12 changes: 6 additions & 6 deletions manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#Install the CentOS-specific packages on that OS, otherwise assume it's a RHEL
#clone and provide the Red Hat-specific package. This comes into play when not
#on RHEL or CentOS and $manage_repo is set manually to 'true'.
$_os = $::operatingsystem? {
$_os = $facts['os']['name'] ? {
'centos' => 'centos',
default => 'rhel'
}
Expand All @@ -34,7 +34,7 @@
case $package_source {
'nginx', 'nginx-stable': {
yumrepo { 'nginx-release':
baseurl => "http://nginx.org/packages/${_os}/${::operatingsystemmajrelease}/\$basearch/",
baseurl => "http://nginx.org/packages/${_os}/${facts['os']['release']['major']}/\$basearch/",
descr => 'nginx repo',
enabled => '1',
gpgcheck => '1',
Expand All @@ -51,7 +51,7 @@
}
'nginx-mainline': {
yumrepo { 'nginx-release':
baseurl => "http://nginx.org/packages/mainline/${_os}/${::operatingsystemmajrelease}/\$basearch/",
baseurl => "http://nginx.org/packages/mainline/${_os}/${facts['os']['release']['major']}/\$basearch/",
descr => 'nginx repo',
enabled => '1',
gpgcheck => '1',
Expand All @@ -67,9 +67,9 @@

}
'passenger': {
if ($::operatingsystem in ['RedHat', 'CentOS']) and ($::operatingsystemmajrelease in ['6', '7']) {
if ($facts['os']['name'] in ['RedHat', 'CentOS']) and ($facts['os']['release']['major'] in ['6', '7']) {
yumrepo { 'passenger':
baseurl => "https://oss-binaries.phusionpassenger.com/yum/passenger/el/${::operatingsystemmajrelease}/\$basearch",
baseurl => "https://oss-binaries.phusionpassenger.com/yum/passenger/el/${facts['os']['release']['major']}/\$basearch",
descr => 'passenger repo',
enabled => '1',
gpgcheck => '0',
Expand All @@ -90,7 +90,7 @@
}

} else {
fail("${::operatingsystem} version ${::operatingsystemmajrelease} is unsupported with \$package_source 'passenger'")
fail("${facts['os']['name']} version ${facts['os']['release']['major']} is unsupported with \$package_source 'passenger'")
}
}
default: {
Expand Down
10 changes: 5 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'package_name' => 'nginx',
'manage_repo' => false,
}
case $::osfamily {
case $facts['os']['family'] {
'ArchLinux': {
$_module_os_overrides = {
'pid' => false,
Expand All @@ -27,8 +27,8 @@
}
}
'Debian': {
if ($::operatingsystem == 'ubuntu' and $::lsbdistcodename in ['lucid', 'precise', 'trusty', 'xenial'])
or ($::operatingsystem == 'debian' and $::operatingsystemmajrelease in ['6', '7', '8']) {
if ($facts['os']['name'] == 'ubuntu' and $facts['lsbdistcodename'] in ['lucid', 'precise', 'trusty', 'xenial'])
or ($facts['os']['name'] == 'debian' and $facts['os']['release']['major'] in ['6', '7', '8']) {
$_module_os_overrides = {
'manage_repo' => true,
'daemon_user' => 'www-data',
Expand All @@ -55,7 +55,7 @@
}
}
'RedHat': {
if ($::operatingsystem in ['RedHat', 'CentOS', 'Oracle'] and $::operatingsystemmajrelease in ['6', '7']) {
if ($facts['os']['name'] in ['RedHat', 'CentOS', 'Oracle'] and $facts['os']['release']['major'] in ['6', '7']) {
$_module_os_overrides = {
'manage_repo' => true,
'log_group' => 'nginx',
Expand Down Expand Up @@ -83,7 +83,7 @@
}
default: {
## For cases not covered in $::osfamily
case $::operatingsystem {
case $facts['os']['name'] {
'SmartOS': {
$_module_os_overrides = {
'conf_dir' => '/usr/local/etc/nginx',
Expand Down
2 changes: 1 addition & 1 deletion manifests/resource/streamhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

# Add IPv6 Logic Check - Nginx service will not start if ipv6 is enabled
# and support does not exist for it in the kernel.
if ($ipv6_enable == true) and (!$::ipaddress6) {
if ($ipv6_enable == true) and (!$facts['ipaddress6']) {
warning('nginx: IPv6 support is not enabled or configured properly')
}

Expand Down
4 changes: 2 additions & 2 deletions manifests/resource/upstream/member.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#
# Exporting the resource on a upstream member server:
#
# @@nginx::resource::upstream::member { $::fqdn:
# @@nginx::resource::upstream::member { $trusted['certname']:
# ensure => present,
# upstream => 'proxypass',
# server => $::ipaddress,
# server => $facts['networking']['ip'],
# port => 3000,
# }
#
Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

if $service_manage {
case $::osfamily {
case $facts['os']['name'] {
'OpenBSD': {
service { $service_name:
ensure => $service_ensure_real,
Expand Down

0 comments on commit 1d5f9d8

Please sign in to comment.