Add Puppet 4.x lint checks

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: I44cb4ffbbc8ccd9f310240a4b1eb6fdfdb435831
This commit is contained in:
Clayton O'Neill 2015-02-17 09:01:27 -05:00
parent 6bcb0bd574
commit 25a5ede55b
24 changed files with 93 additions and 83 deletions

14
Gemfile
View File

@ -2,9 +2,19 @@ source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', '~> 0.3.2'
gem 'rspec-puppet', '~> 1.0.1'
gem 'puppet-lint', '~> 1.1.0'
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 'rspec-puppet', '~> 1.0.1', :require => false
gem 'rspec', '< 2.99'
gem 'json'
gem 'webmock'

View File

@ -30,8 +30,8 @@ keystone_tenant { 'demo':
}
neutron_network { 'private':
ensure => present,
tenant_name => 'demo',
ensure => present,
tenant_name => 'demo',
}
neutron_subnet { 'private_subnet':

View File

@ -2,7 +2,7 @@
# General Neutron stuff
# Configures everything in neutron.conf
class { 'neutron':
class { '::neutron':
verbose => true,
allow_overlapping_ips => true,
rabbit_password => 'password',
@ -12,49 +12,49 @@ class { 'neutron':
}
# The API server talks to keystone for authorisation
class { 'neutron::server':
class { '::neutron::server':
keystone_password => 'password',
connection => 'mysql://neutron:password@192.168.1.1/neutron',
}
# Configure nova notifications system
class { 'neutron::server::notifications':
nova_admin_tenant_name => 'admin',
nova_admin_password => 'secrete',
class { '::neutron::server::notifications':
nova_admin_tenant_name => 'admin',
nova_admin_password => 'secrete',
}
# Various agents
class { 'neutron::agents::dhcp': }
class { 'neutron::agents::l3': }
class { 'neutron::agents::lbaas': }
class { 'neutron::agents::vpnaas': }
class { 'neutron::agents::metering': }
class { '::neutron::agents::dhcp': }
class { '::neutron::agents::l3': }
class { '::neutron::agents::lbaas': }
class { '::neutron::agents::vpnaas': }
class { '::neutron::agents::metering': }
# This plugin configures Neutron for OVS on the server
# Agent
class { 'neutron::agents::ovs':
class { '::neutron::agents::ovs':
local_ip => '192.168.1.1',
enable_tunneling => true,
}
# Plugin
class { 'neutron::plugins::ovs':
class { '::neutron::plugins::ovs':
tenant_network_type => 'gre',
}
# ml2 plugin with vxlan as ml2 driver and ovs as mechanism driver
class { 'neutron::plugins::ml2':
type_drivers => ['vxlan'],
tenant_network_types => ['vxlan'],
vxlan_group => '239.1.1.1',
mechanism_drivers => ['openvswitch'],
vni_ranges => ['0:300']
class { '::neutron::plugins::ml2':
type_drivers => ['vxlan'],
tenant_network_types => ['vxlan'],
vxlan_group => '239.1.1.1',
mechanism_drivers => ['openvswitch'],
vni_ranges => ['0:300']
}
### Compute Nodes:
# Generally, any machine with a neutron element running on it talks
# over Rabbit and needs to know if overlapping IPs (namespaces) are in use
class { 'neutron':
class { '::neutron':
allow_overlapping_ips => true,
rabbit_password => 'password',
rabbit_user => 'guest',
@ -63,12 +63,12 @@ class { 'neutron':
# The agent/plugin combo also needs installed on clients
# Agent
class { 'neutron::agents::ovs':
class { '::neutron::agents::ovs':
local_ip => '192.168.1.11',
enable_tunneling => true,
}
# Plugin
class { 'neutron::plugins::ovs':
class { '::neutron::plugins::ovs':
tenant_network_type => 'gre',
}

View File

@ -22,25 +22,25 @@
#
# sudo pcs constraint colocation add neutron_server_service with neutron_vip
class { 'neutron':
class { '::neutron':
verbose => true,
allow_overlapping_ips => true,
service_plugins => [ 'dhcp', 'l3' ]
}
class { 'neutron::server':
class { '::neutron::server':
enabled => false,
manage_service => false,
keystone_password => 'password',
connection => 'mysql://neutron:password@192.168.1.1/neutron',
}
class { 'neutron::agents::dhcp':
class { '::neutron::agents::dhcp':
enabled => false,
manage_service => false,
}
class { 'neutron::agents::l3':
class { '::neutron::agents::l3':
enabled => false,
manage_service => false,
}

View File

@ -78,7 +78,7 @@ class neutron::agents::dhcp (
$enable_metadata_network = false
) {
include neutron::params
include ::neutron::params
Neutron_config<||> ~> Service['neutron-dhcp-service']
Neutron_dhcp_agent_config<||> ~> Service['neutron-dhcp-service']
@ -131,8 +131,8 @@ class neutron::agents::dhcp (
Package['neutron-dhcp-agent'] -> Neutron_config<||>
Package['neutron-dhcp-agent'] -> Neutron_dhcp_agent_config<||>
package { 'neutron-dhcp-agent':
ensure => $package_ensure,
name => $::neutron::params::dhcp_agent_package,
ensure => $package_ensure,
name => $::neutron::params::dhcp_agent_package,
}
} else {
# Some platforms (RedHat) do not provide a neutron DHCP agent package.

View File

@ -132,7 +132,7 @@ class neutron::agents::l3 (
$allow_automatic_l3agent_failover = false,
) {
include neutron::params
include ::neutron::params
Neutron_config<||> ~> Service['neutron-l3']
Neutron_l3_agent_config<||> ~> Service['neutron-l3']

View File

@ -49,7 +49,7 @@ class neutron::agents::lbaas (
$manage_haproxy_package = true,
) {
include neutron::params
include ::neutron::params
Neutron_config<||> ~> Service['neutron-lbaas-service']
Neutron_lbaas_agent_config<||> ~> Service['neutron-lbaas-service']
@ -82,8 +82,8 @@ class neutron::agents::lbaas (
Package['neutron-lbaas-agent'] -> Neutron_config<||>
Package['neutron-lbaas-agent'] -> Neutron_lbaas_agent_config<||>
package { 'neutron-lbaas-agent':
ensure => $package_ensure,
name => $::neutron::params::lbaas_agent_package,
ensure => $package_ensure,
name => $::neutron::params::lbaas_agent_package,
}
} else {
# Some platforms (RedHat) do not provide a neutron LBaaS agent package.

View File

@ -31,7 +31,7 @@ class neutron::agents::linuxbridge (
$manage_service = true
) {
include neutron::params
include ::neutron::params
Neutron_config<||> ~> Service['neutron-plugin-linuxbridge-service']
Neutron_plugin_linuxbridge<||> ~> Service<| title == 'neutron-plugin-linuxbridge-service' |>
@ -52,8 +52,8 @@ class neutron::agents::linuxbridge (
if ! defined(Package['neutron-plugin-linuxbridge']) {
package { 'neutron-plugin-linuxbridge':
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_server_package,
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_server_package,
}
}
}
@ -72,8 +72,8 @@ class neutron::agents::linuxbridge (
}
service { 'neutron-plugin-linuxbridge-service':
ensure => $service_ensure,
name => $::neutron::params::linuxbridge_agent_service,
enable => $enable,
ensure => $service_ensure,
name => $::neutron::params::linuxbridge_agent_service,
enable => $enable,
}
}

View File

@ -88,7 +88,7 @@ class neutron::agents::metadata (
$metadata_memory_cache_ttl = 5,
) {
include neutron::params
include ::neutron::params
Package['neutron'] -> Neutron_metadata_agent_config<||>
Neutron_config<||> ~> Service['neutron-metadata']

View File

@ -62,7 +62,7 @@ class neutron::agents::metering (
$report_interval = '300'
) {
include neutron::params
include ::neutron::params
Neutron_config<||> ~> Service['neutron-metering-service']
Neutron_metering_agent_config<||> ~> Service['neutron-metering-service']
@ -83,8 +83,8 @@ class neutron::agents::metering (
Package['neutron-metering-agent'] -> Neutron_config<||>
Package['neutron-metering-agent'] -> Neutron_metering_agent_config<||>
package { 'neutron-metering-agent':
ensure => $package_ensure,
name => $::neutron::params::metering_agent_package,
ensure => $package_ensure,
name => $::neutron::params::metering_agent_package,
}
} else {
# Default dependency if the system does not provide a neutron metering agent package.

View File

@ -71,7 +71,7 @@ class neutron::agents::ml2::linuxbridge (
validate_array($tunnel_types)
validate_array($physical_interface_mappings)
include neutron::params
include ::neutron::params
Package['neutron-plugin-linuxbridge-agent'] -> Neutron_plugin_linuxbridge<||>
Neutron_plugin_linuxbridge<||> ~> Service['neutron-plugin-linuxbridge-agent']
@ -127,16 +127,16 @@ class neutron::agents::ml2::linuxbridge (
if $::neutron::params::linuxbridge_agent_package {
package { 'neutron-plugin-linuxbridge-agent':
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_agent_package,
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_agent_package,
}
} else {
# Some platforms (RedHat) do not provide a separate
# neutron plugin linuxbridge agent package.
if ! defined(Package['neutron-plugin-linuxbridge-agent']) {
package { 'neutron-plugin-linuxbridge-agent':
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_server_package,
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_server_package,
}
}
}

View File

@ -106,7 +106,7 @@ class neutron::agents::ml2::ovs (
$enable_distributed_routing = false,
) {
include neutron::params
include ::neutron::params
require vswitch::ovs
if $enable_tunneling and ! $local_ip {
@ -201,8 +201,8 @@ class neutron::agents::ml2::ovs (
if $::neutron::params::ovs_agent_package {
Package['neutron-ovs-agent'] -> Neutron_plugin_ml2<||>
package { 'neutron-ovs-agent':
ensure => $package_ensure,
name => $::neutron::params::ovs_agent_package,
ensure => $package_ensure,
name => $::neutron::params::ovs_agent_package,
}
} else {
# Some platforms (RedHat) do not provide a separate
@ -213,8 +213,8 @@ class neutron::agents::ml2::ovs (
if ! defined(Package['neutron-ovs-agent']) {
package { 'neutron-ovs-agent':
ensure => $package_ensure,
name => $::neutron::params::ovs_server_package,
ensure => $package_ensure,
name => $::neutron::params::ovs_server_package,
} ->
# https://bugzilla.redhat.com/show_bug.cgi?id=1087647
# Causes init script for agent to load the old ovs file

View File

@ -55,7 +55,7 @@ class neutron::agents::ml2::sriov (
$exclude_devices = [],
) {
include neutron::params
include ::neutron::params
Neutron_plugin_ml2<||> ~> Service['neutron-sriov-nic-agent-service']
@ -68,8 +68,8 @@ class neutron::agents::ml2::sriov (
Package['neutron-sriov-nic-agent'] -> Neutron_plugin_ml2<||>
package { 'neutron-sriov-nic-agent':
ensure => $package_ensure,
name => $::neutron::params::sriov_nic_agent_package,
ensure => $package_ensure,
name => $::neutron::params::sriov_nic_agent_package,
}
if $enabled {

View File

@ -106,7 +106,7 @@ class neutron::agents::n1kv_vem (
$manage_service = true
) {
include neutron::params
include ::neutron::params
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

View File

@ -25,7 +25,7 @@ class neutron::agents::ovs (
$veth_mtu = undef
) {
include neutron::params
include ::neutron::params
require vswitch::ovs
if $enable_tunneling and ! $local_ip {
@ -115,8 +115,8 @@ class neutron::agents::ovs (
if $::neutron::params::ovs_agent_package {
Package['neutron-plugin-ovs-agent'] -> Neutron_plugin_ovs<||>
package { 'neutron-plugin-ovs-agent':
ensure => $package_ensure,
name => $::neutron::params::ovs_agent_package,
ensure => $package_ensure,
name => $::neutron::params::ovs_agent_package,
}
} else {
# Some platforms (RedHat) do not provide a separate

View File

@ -53,7 +53,7 @@ class neutron::agents::vpnaas (
$ipsec_status_check_interval = '60'
) {
include neutron::params
include ::neutron::params
Neutron_config<||> ~> Service['neutron-vpnaas-service']
Neutron_vpnaas_agent_config<||> ~> Service['neutron-vpnaas-service']
@ -94,8 +94,8 @@ class neutron::agents::vpnaas (
Package['neutron'] -> Package['neutron-vpnaas-agent']
Package['neutron-vpnaas-agent'] -> Neutron_vpnaas_agent_config<||>
package { 'neutron-vpnaas-agent':
ensure => $package_ensure,
name => $::neutron::params::vpnaas_agent_package,
ensure => $package_ensure,
name => $::neutron::params::vpnaas_agent_package,
}
} else {
Package['neutron'] -> Neutron_vpnaas_agent_config<||>

View File

@ -12,7 +12,7 @@ class neutron::client (
$package_ensure = present
) {
include neutron::params
include ::neutron::params
package { 'python-neutronclient':
ensure => $package_ensure,

View File

@ -266,7 +266,7 @@ class neutron (
$lock_path = '/var/lib/neutron/lock',
) {
include neutron::params
include ::neutron::params
Package['neutron'] -> Neutron_config<||>
Package['neutron'] -> Nova_Admin_Tenant_Id_Setter<||>
@ -305,8 +305,8 @@ class neutron (
}
file { '/etc/neutron':
ensure => directory,
mode => '0750',
ensure => directory,
mode => '0750',
}
file { '/etc/neutron/neutron.conf': }

View File

@ -28,7 +28,7 @@ class neutron::plugins::linuxbridge (
$package_ensure = 'present'
) {
include neutron::params
include ::neutron::params
Package['neutron'] -> Package['neutron-plugin-linuxbridge']
Package['neutron-plugin-linuxbridge'] -> Neutron_plugin_linuxbridge<||>

View File

@ -116,7 +116,7 @@ class neutron::plugins::ml2 (
$sriov_agent_required = false,
) {
include neutron::params
include ::neutron::params
Neutron_plugin_ml2<||> ~> Service<| title == 'neutron-server' |>
@ -139,8 +139,8 @@ class neutron::plugins::ml2 (
# In RH, the link is used to start Neutron process but in Debian, it's used only
# to manage database synchronization.
file {'/etc/neutron/plugin.ini':
ensure => link,
target => '/etc/neutron/plugins/ml2/ml2_conf.ini'
ensure => link,
target => '/etc/neutron/plugins/ml2/ml2_conf.ini'
}
# Some platforms do not have a dedicated ml2 plugin package

View File

@ -30,7 +30,7 @@ class neutron::plugins::nvp (
$package_ensure = 'present'
) {
include neutron::params
include ::neutron::params
Package['neutron'] -> Package['neutron-plugin-nvp']
Package['neutron-plugin-nvp'] -> Neutron_plugin_nvp<||>
@ -38,8 +38,8 @@ class neutron::plugins::nvp (
Package['neutron-plugin-nvp'] -> Service<| title == 'neutron-server' |>
package { 'neutron-plugin-nvp':
ensure => $package_ensure,
name => $::neutron::params::nvp_server_package
ensure => $package_ensure,
name => $::neutron::params::nvp_server_package
}
validate_array($nvp_controllers)

View File

@ -19,7 +19,7 @@ class neutron::plugins::ovs (
$vxlan_udp_port = 4789
) {
include neutron::params
include ::neutron::params
Package['neutron'] -> Package['neutron-plugin-ovs']
Package['neutron-plugin-ovs'] -> Neutron_plugin_ovs<||>
@ -28,8 +28,8 @@ class neutron::plugins::ovs (
if ! defined(Package['neutron-plugin-ovs']) {
package { 'neutron-plugin-ovs':
ensure => $package_ensure,
name => $::neutron::params::ovs_server_package,
ensure => $package_ensure,
name => $::neutron::params::ovs_server_package,
}
}

View File

@ -226,8 +226,8 @@ class neutron::server (
$lock_path = undef,
) {
include neutron::params
include neutron::policy
include ::neutron::params
include ::neutron::policy
require keystone::python
Nova_admin_tenant_id_setter<||> ~> Service['neutron-server']

View File

@ -43,7 +43,7 @@ class neutron::services::fwaas (
$vpnaas_agent_package = false
) {
include neutron::params
include ::neutron::params
if ($::osfamily == 'Debian') {
# Debian platforms