Skip to content

Commit

Permalink
puppet-lint: autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak authored and alexjfisher committed Aug 29, 2020
1 parent 18c58d5 commit bf23292
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 88 deletions.
8 changes: 4 additions & 4 deletions examples/location_alias.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include nginx

nginx::resource::location { 'www.test.com-alias':
ensure => present,
location => '/some/url',
location_alias => '/new/url/',
server => 'www.test.com',
ensure => present,
location => '/some/url',
location_alias => '/new/url/',
server => 'www.test.com',
}
16 changes: 8 additions & 8 deletions examples/location_params.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
include nginx

nginx::resource::location { 'www.test.com-params':
ensure => present,
location => '/some/url',
server => 'www.test.com',
fastcgi_param => {
'APP_ENV' => 'production',
'APP_VERSION' => '0.1.10',
'APP_SECRET' => 'hisfaihicasagfkjsa',
},
ensure => present,
location => '/some/url',
server => 'www.test.com',
fastcgi_param => {
'APP_ENV' => 'production',
'APP_VERSION' => '0.1.10',
'APP_SECRET' => 'hisfaihicasagfkjsa',
},
}
1 change: 0 additions & 1 deletion examples/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
ipv6_enable => true,
proxy => 'http://proxypass',
}

9 changes: 5 additions & 4 deletions examples/snippet.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

class { 'nginx':
snippets_dir => '/etc/nginx/snippets',
}

# https://github.com/relud/puppet-lint-strict_indent-check/issues/20
# lint:ignore:strict_indent
$snippet = @("SNIPPET"/L)
location @custom_451_error {
return 451;
}
| SNIPPET

# lint:endignore
nginx::resource::snippet { 'test_snippet':
raw_content => $snippet,
}
Expand All @@ -18,13 +19,13 @@
listen_port => 8080,
server_name => ['test.local test'],
include_files => ["${nginx::snippets_dir}/test_snippet.conf"],
try_files => [ 'non-existant', '@custom_451_error'],
try_files => ['non-existant', '@custom_451_error'],
}

nginx::resource::server { 'test.local:8081':
ensure => present,
listen_port => 8081,
server_name => ['test.local test'],
include_files => ["${nginx::snippets_dir}/test_snippet.conf"],
try_files => [ 'non-existant', '@custom_451_error'],
try_files => ['non-existant', '@custom_451_error'],
}
7 changes: 3 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# This class file is not called directly
class nginx::config {

assert_private()

$client_body_temp_path = $nginx::client_body_temp_path
Expand Down Expand Up @@ -195,7 +194,7 @@
}
}

file {$run_dir:
file { $run_dir:
ensure => directory,
}

Expand All @@ -213,14 +212,14 @@
}

if $client_body_temp_path {
file {$client_body_temp_path:
file { $client_body_temp_path:
ensure => directory,
owner => $daemon_user,
}
}

if $proxy_temp_path {
file {$proxy_temp_path:
file { $proxy_temp_path:
ensure => directory,
owner => $daemon_user,
}
Expand Down
1 change: 0 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@

### END Hiera Lookups ###
) inherits nginx::params {

contain 'nginx::package'
contain 'nginx::config'
contain 'nginx::service'
Expand Down
1 change: 0 additions & 1 deletion manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# This class file is not called directly
class nginx::package {

$package_name = $nginx::package_name
$package_source = $nginx::package_source
$package_ensure = $nginx::package_ensure
Expand Down
7 changes: 3 additions & 4 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# This class file is not called directly
class nginx::package::debian {

$package_name = $nginx::package_name
$package_source = $nginx::package_source
$package_ensure = $nginx::package_ensure
Expand Down Expand Up @@ -45,7 +44,7 @@
apt::source { 'nginx':
location => $stable_repo_source,
repos => 'nginx',
key => {'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62'},
key => { 'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62' },
release => $release,
}
}
Expand All @@ -57,7 +56,7 @@
apt::source { 'nginx':
location => $mainline_repo_source,
repos => 'nginx',
key => {'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62'},
key => { 'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62' },
release => $release,
}
}
Expand All @@ -69,7 +68,7 @@
apt::source { 'nginx':
location => $passenger_repo_source,
repos => 'main',
key => {'id' => '16378A33A6EF16762922526E561F9B9CAC40B2F7'},
key => { 'id' => '16378A33A6EF16762922526E561F9B9CAC40B2F7' },
}

package { $passenger_package_name:
Expand Down
3 changes: 0 additions & 3 deletions manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# This class file is not called directly
class nginx::package::redhat {

$package_name = $nginx::package_name
$package_source = $nginx::package_source
$package_ensure = $nginx::package_ensure
Expand Down Expand Up @@ -98,7 +97,6 @@
ensure => $passenger_package_ensure,
require => Yumrepo['passenger'],
}

} else {
fail("${facts['os']['name']} version ${facts['os']['release']['major']} is unsupported with \$package_source 'passenger'")
}
Expand All @@ -113,5 +111,4 @@
ensure => $package_ensure,
name => $package_name,
}

}
2 changes: 0 additions & 2 deletions manifests/resource/geo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
# '172.16.0.0/12': 'intra'
# '192.168.0.0/16': 'intra'


define nginx::resource::geo (
Hash $networks,
Optional[String] $default = undef,
Expand All @@ -62,7 +61,6 @@
Optional[Array] $proxies = undef,
Optional[Boolean] $proxy_recursive = undef
) {

if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
}
Expand Down
10 changes: 5 additions & 5 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@
Array $index_files = [
'index.html',
'index.htm',
'index.php'],
'index.php',
],
Optional[String] $proxy = undef,
Optional[String] $proxy_redirect = $nginx::proxy_redirect,
String $proxy_read_timeout = $nginx::proxy_read_timeout,
Expand Down Expand Up @@ -223,7 +224,7 @@
Optional[Enum['any', 'all']] $location_satisfy = undef,
Optional[Array] $location_allow = undef,
Optional[Array] $location_deny = undef,
Optional[Boolean ] $stub_status = undef,
Optional[Boolean] $stub_status = undef,
Optional[Variant[String, Array]] $raw_prepend = undef,
Optional[Variant[String, Array]] $raw_append = undef,
Optional[Hash] $location_custom_cfg = undef,
Expand Down Expand Up @@ -258,7 +259,6 @@
Hash $add_header = {},
Optional[Enum['on', 'off', 'always']] $gzip_static = undef,
) {

if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
}
Expand Down Expand Up @@ -298,15 +298,15 @@
$fastcgi_params == "${nginx::conf_dir}/fastcgi.conf"
) {
file { $fastcgi_params:
ensure => 'present',
ensure => 'file',
mode => $nginx::global_mode,
content => template('nginx/server/fastcgi.conf.erb'),
}
}

if $ensure == 'present' and $uwsgi != undef and !defined(File[$uwsgi_params]) and $uwsgi_params == "${nginx::conf_dir}/uwsgi_params" {
file { $uwsgi_params:
ensure => 'present',
ensure => 'file',
mode => $nginx::global_mode,
content => template('nginx/server/uwsgi_params.erb'),
}
Expand Down
1 change: 0 additions & 1 deletion manifests/resource/mailhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
String $proxy_pass_error_message = 'off',
Array $server_name = [$name]
) {

if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
}
Expand Down
2 changes: 0 additions & 2 deletions manifests/resource/map.pp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
# value: 'sf-pool-1'
# - key: '*.nyc.example.com'
# value: 'ny-pool-1'


define nginx::resource::map (
String[2] $string,
Variant[Array, Hash] $mappings,
Expand Down
22 changes: 11 additions & 11 deletions manifests/resource/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@
Array $index_files = [
'index.html',
'index.htm',
'index.php'],
'index.php',
],
Optional[String] $autoindex = undef,
Optional[Enum['on', 'off']] $autoindex_exact_size = undef,
Optional[Enum['html', 'xml', 'json', 'jsonp']] $autoindex_format = undef,
Expand Down Expand Up @@ -285,7 +286,6 @@
Hash $locations = {},
Hash $locations_defaults = {},
) {

if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
}
Expand Down Expand Up @@ -369,7 +369,7 @@
# ssl redirect and no ssl -> false
if (!$ssl_redirect or $ssl) and $use_default_location {
# Create the default location reference for the server
nginx::resource::location {"${name_sanitized}-default":
nginx::resource::location { "${name_sanitized}-default":
ensure => $ensure,
server => $name_sanitized,
ssl => $ssl,
Expand Down Expand Up @@ -434,15 +434,15 @@

if $fastcgi != undef and !defined(File[$fastcgi_params]) and $fastcgi_params == "${nginx::conf_dir}/fastcgi.conf" {
file { $fastcgi_params:
ensure => present,
ensure => file,
mode => $nginx::global_mode,
content => template('nginx/server/fastcgi.conf.erb'),
}
}

if $uwsgi != undef and !defined(File[$uwsgi_params]) and $uwsgi_params == "${nginx::conf_dir}/uwsgi_params" {
file { $uwsgi_params:
ensure => present,
ensure => file,
mode => $nginx::global_mode,
content => template('nginx/server/uwsgi_params.erb'),
}
Expand Down Expand Up @@ -481,7 +481,7 @@
}

unless $nginx::confd_only {
file{ "${name_sanitized}.conf symlink":
file { "${name_sanitized}.conf symlink":
ensure => $server_symlink_ensure,
path => "${server_enable_dir}/${name_sanitized}.conf",
target => $config_file,
Expand All @@ -493,10 +493,10 @@
create_resources('::nginx::resource::map', $string_mappings)
create_resources('::nginx::resource::geo', $geo_mappings)
create_resources('::nginx::resource::location', $locations, {
ensure => $ensure,
server => $name_sanitized,
ssl => $ssl,
ssl_only => $ssl_only,
www_root => $www_root,
ensure => $ensure,
server => $name_sanitized,
ssl => $ssl,
ssl_only => $ssl_only,
www_root => $www_root,
} + $locations_defaults)
}
3 changes: 1 addition & 2 deletions manifests/resource/streamhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
String $group = $nginx::global_group,
String $mode = $nginx::global_mode,
) {

if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
}
Expand Down Expand Up @@ -118,7 +117,7 @@
}

unless $nginx::confd_only {
file{ "${name_sanitized}.conf symlink":
file { "${name_sanitized}.conf symlink":
ensure => $streamhost_symlink_ensure,
path => "${streamhost_enable_dir}/${name_sanitized}.conf",
target => $config_file,
Expand Down
Loading

0 comments on commit bf23292

Please sign in to comment.