Skip to content

Commit

Permalink
Merge pull request #1410 from alexjfisher/remove_some_file_defaults
Browse files Browse the repository at this point in the history
Refactor to remove some `File` defaults
  • Loading branch information
alexjfisher authored Aug 29, 2020
2 parents 9e06714 + bd20670 commit d3fc398
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
10 changes: 3 additions & 7 deletions manifests/resource/geo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,12 @@
default => 'file',
}

File {
owner => 'root',
group => $root_group,
mode => $nginx::global_mode,
}

file { "${conf_dir}/${name}-geo.conf":
ensure => $ensure_real,
owner => 'root',
group => $root_group,
mode => $nginx::global_mode,
content => template('nginx/conf.d/geo.erb'),
notify => Class['nginx::service'],
require => File[$conf_dir],
}
}
10 changes: 3 additions & 7 deletions manifests/resource/map.pp
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,12 @@
default => 'file',
}

File {
owner => 'root',
group => $root_group,
mode => $nginx::global_mode,
}

file { "${conf_dir}/${name}-map.conf":
ensure => $ensure_real,
owner => 'root',
group => $root_group,
mode => $nginx::global_mode,
content => template('nginx/conf.d/map.erb'),
notify => Class['nginx::service'],
require => File[$conf_dir],
}
}
18 changes: 5 additions & 13 deletions manifests/resource/streamhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,9 @@
$name_sanitized = regsubst($name, ' ', '_', 'G')
$config_file = "${streamhost_dir}/${name_sanitized}.conf"

File {
ensure => $ensure ? {
'absent' => absent,
default => 'file',
},
notify => Class['nginx::service'],
owner => $owner,
group => $group,
mode => $mode,
}

# 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 (!$facts['networking']['ip6']) {
if $ipv6_enable and !$facts['networking']['ip6'] {
warning('nginx: IPv6 support is not enabled or configured properly')
}

Expand All @@ -121,7 +110,10 @@
ensure => $streamhost_symlink_ensure,
path => "${streamhost_enable_dir}/${name_sanitized}.conf",
target => $config_file,
require => [Concat[$config_file], File[$streamhost_enable_dir]],
owner => $owner,
group => $group,
mode => $mode,
require => Concat[$config_file],
notify => Class['nginx::service'],
}
}
Expand Down

0 comments on commit d3fc398

Please sign in to comment.