Browse Source

Fix remaining lint warnings

Matthew Haughton 9 years ago
parent
commit
88d8984876

+ 1 - 0
.puppet-lint.rc

@@ -1,3 +1,4 @@
 --fail-on-warnings
+--relative
 --no-80chars-check
 --no-class_inherits_from_params_class-check

+ 1 - 1
manifests/config.pp

@@ -131,10 +131,10 @@ class nginx::config(
   }
 
   file { "${conf_dir}/sites-available":
+    ensure => directory,
     owner  => $sites_available_owner,
     group  => $sites_available_group,
     mode   => $sites_available_mode,
-    ensure => directory,
   }
 
   if $vhost_purge == true {

+ 1 - 1
manifests/package/debian.pp

@@ -47,7 +47,7 @@ class nginx::package::debian(
 
         apt::source { 'nginx':
           location   => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
-          repos      => "main",
+          repos      => 'main',
           key        => '561F9B9CAC40B2F7',
           key_source => 'https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt',
           notify     => Exec['apt_get_update_for_nginx'],

+ 6 - 4
manifests/resource/geo.pp

@@ -76,6 +76,11 @@ define nginx::resource::geo (
   include nginx::params
   $root_group = $nginx::params::root_group
 
+  $ensure_real = $ensure ? {
+    'absent' => 'absent',
+    default  => 'file',
+  }
+
   File {
     owner => 'root',
     group => $root_group,
@@ -83,10 +88,7 @@ define nginx::resource::geo (
   }
 
   file { "${nginx::config::conf_dir}/conf.d/${name}-geo.conf":
-    ensure  => $ensure ? {
-      'absent' => absent,
-      default  => 'file',
-    },
+    ensure  => $ensure_real,
     content => template('nginx/conf.d/geo.erb'),
     notify  => Class['nginx::service'],
   }

+ 5 - 5
manifests/resource/location.pp

@@ -291,7 +291,7 @@ define nginx::resource::location (
   $config_file = "${nginx::config::conf_dir}/sites-available/${vhost_sanitized}.conf"
 
   $location_sanitized_tmp = regsubst($location, '\/', '_', 'G')
-  $location_sanitized = regsubst($location_sanitized_tmp, "\\\\", '_', 'G')
+  $location_sanitized = regsubst($location_sanitized_tmp, '\\\\', '_', 'G')
 
   ## Check for various error conditions
   if ($vhost == undef) {
@@ -336,7 +336,7 @@ define nginx::resource::location (
   if ($ssl_only != true) {
     $tmpFile=md5("${vhost_sanitized}-${priority}-${location_sanitized}")
 
-    concat::fragment { "${tmpFile}":
+    concat::fragment { $tmpFile:
       ensure  => present,
       target  => $config_file,
       content => join([
@@ -344,7 +344,7 @@ define nginx::resource::location (
         $content_real,
         template('nginx/vhost/location_footer.erb')
       ], ''),
-      order   => "${priority}",
+      order   => "${priority}", #lint:ignore:only_variable_string waiting on https://github.com/puppetlabs/puppetlabs-concat/commit/f70881fbfd01c404616e9e4139d98dad78d5a918
     }
   }
 
@@ -353,7 +353,7 @@ define nginx::resource::location (
     $ssl_priority = $priority + 300
 
     $sslTmpFile=md5("${vhost_sanitized}-${ssl_priority}-${location_sanitized}-ssl")
-    concat::fragment {"${sslTmpFile}":
+    concat::fragment { $sslTmpFile:
       ensure  => present,
       target  => $config_file,
       content => join([
@@ -361,7 +361,7 @@ define nginx::resource::location (
         $content_real,
         template('nginx/vhost/location_footer.erb')
       ], ''),
-      order   => "${ssl_priority}",
+      order   => "${ssl_priority}", #lint:ignore:only_variable_string waiting on https://github.com/puppetlabs/puppetlabs-concat/commit/f70881fbfd01c404616e9e4139d98dad78d5a918
     }
   }
 

+ 6 - 4
manifests/resource/map.pp

@@ -60,6 +60,11 @@ define nginx::resource::map (
   include nginx::params
   $root_group = $nginx::params::root_group
 
+  $ensure_real = $ensure ? {
+    'absent' => absent,
+    default  => 'file',
+  }
+
   File {
     owner => 'root',
     group => $root_group,
@@ -67,10 +72,7 @@ define nginx::resource::map (
   }
 
   file { "${nginx::config::conf_dir}/conf.d/${name}-map.conf":
-    ensure  => $ensure ? {
-      'absent' => absent,
-      default  => 'file',
-    },
+    ensure  => $ensure_real,
     content => template('nginx/conf.d/map.erb'),
     notify  => Class['nginx::service'],
   }

+ 7 - 6
manifests/resource/upstream.pp

@@ -57,6 +57,11 @@ define nginx::resource::upstream (
   include nginx::params
   $root_group = $nginx::params::root_group
 
+  $ensure_real = $ensure ? {
+    'absent' => absent,
+    default  => present,
+  }
+
   Concat {
     owner => 'root',
     group => $root_group,
@@ -64,12 +69,8 @@ define nginx::resource::upstream (
   }
 
   concat { "${nginx::config::conf_dir}/conf.d/${name}-upstream.conf":
-    ensure  => $ensure ? {
-      'absent' => absent,
-      'file'   => present,
-      default  => present,
-    },
-    notify  => Class['nginx::service'],
+    ensure => $ensure_real,
+    notify => Class['nginx::service'],
   }
 
   # Uses: $name, $upstream_cfg_prepend

+ 1 - 1
manifests/resource/vhost.pp

@@ -436,7 +436,7 @@ define nginx::resource::vhost (
 
   # 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 (!$::ipaddress6) {
     warning('nginx: IPv6 support is not enabled or configured properly')
   }
 

+ 7 - 7
tests/location_params.pp

@@ -1,12 +1,12 @@
 include nginx
 
 nginx::resource::location { 'www.test.com-params':
-    ensure         => present,
-    location       => '/some/url',
-    vhost          => 'www.test.com',
-    fastcgi_param  => {
-    	'APP_ENV'  		=> 'production',
-    	'APP_VERSION' 	=> '0.1.10',
-    	'APP_SECRET'	=> 'hisfaihicasagfkjsa',
+    ensure        => present,
+    location      => '/some/url',
+    vhost         => 'www.test.com',
+    fastcgi_param => {
+      'APP_ENV'     => 'production',
+      'APP_VERSION' => '0.1.10',
+      'APP_SECRET'  => 'hisfaihicasagfkjsa',
     },
 }

+ 8 - 8
tests/vhost.pp

@@ -1,16 +1,16 @@
 include nginx
 
 nginx::resource::vhost { 'test.local test':
-  ensure       => present,
-  ipv6_enable  => true,
-  proxy        => 'http://proxypass',
+  ensure      => present,
+  ipv6_enable => true,
+  proxy       => 'http://proxypass',
 }
 
 nginx::resource::vhost { 'test.local:8080':
-  ensure       => present,
-  listen_port  => 8080,
-  server_name  => ['test.local test'],
-  ipv6_enable  => true,
-  proxy        => 'http://proxypass',
+  ensure      => present,
+  listen_port => 8080,
+  server_name => ['test.local test'],
+  ipv6_enable => true,
+  proxy       => 'http://proxypass',
 }