Add Puppet 4.x lint checks
authorGael Chamoulaud <gchamoul@redhat.com>
Tue, 17 Mar 2015 09:21:58 +0000 (10:21 +0100)
committerGael Chamoulaud <gchamoul@redhat.com>
Tue, 17 Mar 2015 09:23:32 +0000 (10:23 +0100)
- This changes the puppet-lint requirement to 1.1.x, so that we can use
  puppet-lint plugins. Most of these plugins are for 4.x compat, but some just
  catch common errors.

Change-Id: I2660b960b6ef696bd5dc8a6965b4a9aa25409b66
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
Gemfile
manifests/database/mysql.pp
manifests/loadbalancer.pp

diff --git a/Gemfile b/Gemfile
index 790afc5..d3d3a07 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -2,9 +2,20 @@ source 'https://rubygems.org'
 
 group :development, :test do
   gem 'puppetlabs_spec_helper', :require => false
-  gem 'puppet-lint'
-  gem 'puppet-lint-param-docs', '1.1.0'
+
+  gem 'puppet-lint', '~> 1.1'
   gem 'metadata-json-lint'
+  gem 'puppet-lint-param-docs'
+  gem 'puppet-lint-absolute_classname-check'
+  gem 'puppet-lint-absolute_template_path'
+  gem 'puppet-lint-trailing_newline-check'
+
+  # Puppet 4.x related lint checks
+  gem 'puppet-lint-unquoted_string-check'
+  gem 'puppet-lint-leading_zero-check'
+  gem 'puppet-lint-variable_contains_upcase'
+  gem 'puppet-lint-numericvariable'
+
   gem 'rake', '10.1.1'
   gem 'puppet-syntax'
   gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git'
@@ -13,6 +24,7 @@ group :development, :test do
   gem 'webmock'
   gem 'r10k'
   gem 'librarian-puppet-simple', '~> 0.0.3'
+
 end
 
 if puppetversion = ENV['PUPPET_GEM_VERSION']
index dae80b3..1d621a5 100644 (file)
@@ -132,12 +132,12 @@ class tripleo::database::mysql (
         ensure  => 'present',
         charset => 'utf8',
         collate => 'utf8_unicode_ci',
-        require => File['/root/.my.cnf']
+        require => File['/root/.my.cnf'],
       }
       mysql_user { "${galera_clustercheck_dbuser}@localhost":
         ensure        => 'present',
         password_hash => mysql_password($galera_clustercheck_dbpassword),
-        require       => File['/root/.my.cnf']
+        require       => File['/root/.my.cnf'],
       }
       mysql_grant { "${galera_clustercheck_dbuser}@localhost/monitoring":
         ensure     => 'present',
@@ -181,7 +181,7 @@ class tripleo::database::mysql (
           command => '/usr/bin/mysql_install_db --rpm --user=mysql',
           unless  => 'test -d /var/lib/mysql/mysql',
           before  => Service['mysqld'],
-          require => [Package[$mysql_server_package_name], File[$mysql_server_config_file]]
+          require => [Package[$mysql_server_package_name], File[$mysql_server_config_file]],
         }
 
       }
@@ -201,7 +201,7 @@ class tripleo::database::mysql (
         mysql_user { 'debian-sys-maint@localhost':
           ensure        => 'present',
           password_hash => mysql_password($mysql_sys_maint_password),
-          require       => File['/root/.my.cnf']
+          require       => File['/root/.my.cnf'],
         }
 
         file{'/etc/mysql/debian.cnf':
@@ -227,7 +227,7 @@ class tripleo::database::mysql (
       before  => Package[$mysql_server_package_name],
     }
 
-    class { 'mysql::server':
+    class { '::mysql::server':
       manage_config_file => false,
       config_file        => $mysql_server_config_file,
       package_name       => $mysql_server_package_name,
@@ -235,7 +235,7 @@ class tripleo::database::mysql (
       override_options   => {
         'mysqld' => {
           'bind-address' => $bind_address,
-        }
+        },
       },
       root_password      => $mysql_root_password,
       notify             => Service['xinetd'],
@@ -250,7 +250,7 @@ class tripleo::database::mysql (
       require => Package[$mysql_server_package_name],
     }
 
-    class { 'mysql::client':
+    class { '::mysql::client':
       package_name => $mysql_client_package_name,
     }
 
@@ -264,7 +264,7 @@ class tripleo::database::mysql (
         'set service-name[. = "mysqlchk"]/protocol tcp',
       ],
       onlyif  => 'match service-name[. = "mysqlchk"] size == 0',
-      notify  => [ Service['xinetd'], Exec['reload_xinetd'] ]
+      notify  => [ Service['xinetd'], Exec['reload_xinetd'] ],
     }
     file {
       '/etc/xinetd.d/mysqlchk':
@@ -292,11 +292,11 @@ class tripleo::database::mysql (
     }
   } else {
     # When HA is disabled
-    class { 'mysql::server':
+    class { '::mysql::server':
       override_options => {
         'mysqld' => {
           'bind-address' => $bind_address,
-        }
+        },
       },
       root_password    => $mysql_root_password,
     }
@@ -307,7 +307,7 @@ class tripleo::database::mysql (
     # Create all the database schemas
     $allowed_hosts = ['%',$controller_host]
     $keystone_dsn = split($keystone_database_connection, '[@:/?]')
-    class { 'keystone::db::mysql':
+    class { '::keystone::db::mysql':
       user          => $keystone_dsn[3],
       password      => $keystone_dsn[4],
       host          => $keystone_dsn[5],
@@ -315,7 +315,7 @@ class tripleo::database::mysql (
       allowed_hosts => $allowed_hosts,
     }
     $glance_dsn = split($glance_database_connection, '[@:/?]')
-    class { 'glance::db::mysql':
+    class { '::glance::db::mysql':
       user          => $glance_dsn[3],
       password      => $glance_dsn[4],
       host          => $glance_dsn[5],
@@ -323,7 +323,7 @@ class tripleo::database::mysql (
       allowed_hosts => $allowed_hosts,
     }
     $nova_dsn = split($nova_database_connection, '[@:/?]')
-    class { 'nova::db::mysql':
+    class { '::nova::db::mysql':
       user          => $nova_dsn[3],
       password      => $nova_dsn[4],
       host          => $nova_dsn[5],
@@ -331,7 +331,7 @@ class tripleo::database::mysql (
       allowed_hosts => $allowed_hosts,
     }
     $neutron_dsn = split($neutron_database_connection, '[@:/?]')
-    class { 'neutron::db::mysql':
+    class { '::neutron::db::mysql':
       user          => $neutron_dsn[3],
       password      => $neutron_dsn[4],
       host          => $neutron_dsn[5],
@@ -339,7 +339,7 @@ class tripleo::database::mysql (
       allowed_hosts => $allowed_hosts,
     }
     $cinder_dsn = split($cinder_database_connection, '[@:/?]')
-    class { 'cinder::db::mysql':
+    class { '::cinder::db::mysql':
       user          => $cinder_dsn[3],
       password      => $cinder_dsn[4],
       host          => $cinder_dsn[5],
@@ -347,7 +347,7 @@ class tripleo::database::mysql (
       allowed_hosts => $allowed_hosts,
     }
     $heat_dsn = split($heat_database_connection, '[@:/?]')
-    class { 'heat::db::mysql':
+    class { '::heat::db::mysql':
       user          => $heat_dsn[3],
       password      => $heat_dsn[4],
       host          => $heat_dsn[5],
@@ -355,7 +355,7 @@ class tripleo::database::mysql (
       allowed_hosts => $allowed_hosts,
     }
     $ceilometer_dsn = split($ceilometer_database_connection, '[@:/?]')
-    class { 'ceilometer::db::mysql':
+    class { '::ceilometer::db::mysql':
       user          => $ceilometer_dsn[3],
       password      => $ceilometer_dsn[4],
       host          => $ceilometer_dsn[5],
index c9e3b41..b9861ff 100644 (file)
@@ -158,7 +158,7 @@ class tripleo::loadbalancer (
     }
   }
 
-  class { 'keepalived': }
+  class { '::keepalived': }
   keepalived::vrrp_script { 'haproxy':
     name_is_process => $keepalived_name_is_process,
     script          => $keepalived_vrrp_script,
@@ -184,7 +184,7 @@ class tripleo::loadbalancer (
 
   sysctl::value { 'net.ipv4.ip_nonlocal_bind': value => '1' }
 
-  class { 'haproxy':
+  class { '::haproxy':
     global_options   => {
       'log'     => '/dev/log local0',
       'pidfile' => '/var/run/haproxy.pid',
@@ -218,7 +218,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 35357,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -235,7 +235,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 5000,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -252,7 +252,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 9696,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -269,7 +269,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8776,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -286,7 +286,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 9292,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -303,7 +303,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 9191,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -320,7 +320,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8773,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -337,7 +337,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8774,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -354,7 +354,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8775,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -371,7 +371,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 6080,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -402,7 +402,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8080,
       options          => {
-        'option' => [ 'httpchk GET /info' ]
+        'option' => [ 'httpchk GET /info' ],
       },
       collect_exported => false,
     }
@@ -419,7 +419,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8004,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -436,7 +436,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8003,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -453,7 +453,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 8000,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -470,7 +470,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 80,
       options          => {
-        'option' => [ 'httpchk GET /' ]
+        'option' => [ 'httpchk GET /' ],
       },
       collect_exported => false,
     }
@@ -487,7 +487,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip],
       ports            => 3306,
       options          => {
-        'timeout' => [ 'client 0', 'server 0' ]
+        'timeout' => [ 'client 0', 'server 0' ],
       },
       collect_exported => false,
     }
@@ -504,7 +504,7 @@ class tripleo::loadbalancer (
       ipaddress        => [$controller_virtual_ip, $public_virtual_ip],
       ports            => 5672,
       options          => {
-        'timeout' => [ 'client 0', 'server 0' ]
+        'timeout' => [ 'client 0', 'server 0' ],
       },
       collect_exported => false,
     }