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: I9b41f170a782fecf88f241dc12288670b552b433
This commit is contained in:
Sebastien Badia 2015-03-23 18:25:34 +01:00
parent f4cfe8e8e4
commit dc8657e203
25 changed files with 108 additions and 102 deletions

@ -6,6 +6,15 @@ group :development, :test do
gem 'metadata-json-lint' gem 'metadata-json-lint'
gem 'puppet-lint-param-docs' 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 'json' gem 'json'
gem 'webmock' gem 'webmock'

@ -26,7 +26,7 @@ class swift::auth_file (
) { ) {
file { '/root/swiftrc': file { '/root/swiftrc':
ensure => present, ensure => file,
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => '0600', mode => '0600',
@ -35,6 +35,6 @@ class swift::auth_file (
export ST_USER=${admin_tenant}:${admin_user} export ST_USER=${admin_tenant}:${admin_user}
export ST_KEY=${admin_password} export ST_KEY=${admin_password}
export ST_AUTH=${auth_url} export ST_AUTH=${auth_url}
" ",
} }
} }

@ -12,7 +12,7 @@ class swift::client (
$ensure = 'present' $ensure = 'present'
) { ) {
include swift::params include ::swift::params
package { 'swiftclient': package { 'swiftclient':
ensure => $ensure, ensure => $ensure,

@ -80,13 +80,13 @@ class swift::dispersion (
$dump_json = 'no' $dump_json = 'no'
) { ) {
include swift::params include ::swift::params
Package['swift'] -> Swift_dispersion_config<||> Package['swift'] -> Swift_dispersion_config<||>
Swift_dispersion_config<||> ~> Exec['swift-dispersion-populate'] Swift_dispersion_config<||> ~> Exec['swift-dispersion-populate']
file { '/etc/swift/dispersion.conf': file { '/etc/swift/dispersion.conf':
ensure => present, ensure => file,
owner => 'swift', owner => 'swift',
group => 'swift', group => 'swift',
mode => '0660', mode => '0660',

@ -30,8 +30,8 @@ class swift(
$client_package_ensure = 'present', $client_package_ensure = 'present',
) { ) {
include swift::params include ::swift::params
include ssh::server include ::ssh::server
Class['ssh::server::install'] -> Class['swift'] Class['ssh::server::install'] -> Class['swift']
@ -42,7 +42,7 @@ class swift(
} }
} }
class { 'swift::client': class { '::swift::client':
ensure => $client_package_ensure; ensure => $client_package_ensure;
} }
@ -68,11 +68,11 @@ class swift(
} }
file { '/etc/swift/swift.conf': file { '/etc/swift/swift.conf':
ensure => present, ensure => file,
mode => '0660', mode => '0660',
} }
swift_config { 'swift-hash/swift_hash_path_suffix': swift_config { 'swift-hash/swift_hash_path_suffix':
value => $swift_hash_suffix value => $swift_hash_suffix,
} }
} }

@ -46,6 +46,6 @@ class swift::keystone::dispersion(
keystone_user_role { "${auth_user}@${tenant}": keystone_user_role { "${auth_user}@${tenant}":
ensure => present, ensure => present,
roles => 'admin', roles => 'admin',
require => Keystone_user[$auth_user] require => Keystone_user[$auth_user],
} }
} }

@ -127,8 +127,8 @@ class swift::proxy(
$package_ensure = 'present' $package_ensure = 'present'
) { ) {
include swift::params include ::swift::params
include concat::setup include ::concat::setup
validate_bool($account_autocreate) validate_bool($account_autocreate)
validate_bool($allow_account_management) validate_bool($allow_account_management)

@ -34,7 +34,7 @@ class swift::proxy::ceilometer(
} }
file { '/var/log/ceilometer/swift-proxy-server.log': file { '/var/log/ceilometer/swift-proxy-server.log':
ensure => present, ensure => file,
mode => '0664', mode => '0664',
owner => 'swift', owner => 'swift',
group => 'swift', group => 'swift',
@ -44,7 +44,7 @@ class swift::proxy::ceilometer(
target => '/etc/swift/proxy-server.conf', target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/ceilometer.conf.erb'), content => template('swift/proxy/ceilometer.conf.erb'),
order => '33', order => '33',
require => Class['::ceilometer'] require => Class['::ceilometer'],
} }
} }

@ -34,7 +34,7 @@ class swift::proxy::s3token(
$auth_protocol = 'http' $auth_protocol = 'http'
) { ) {
include keystone::python include ::keystone::python
concat::fragment { 'swift_s3token': concat::fragment { 'swift_s3token':
target => '/etc/swift/proxy-server.conf', target => '/etc/swift/proxy-server.conf',

@ -24,7 +24,7 @@ class swift::proxy::swift3(
$ensure = 'present' $ensure = 'present'
) { ) {
include swift::params include ::swift::params
package { 'swift-plugin-s3': package { 'swift-plugin-s3':
ensure => $ensure, ensure => $ensure,

@ -33,7 +33,7 @@ class swift::ringserver(
Class['ringbuilder'] -> Class['swift::ringserver'] Class['ringbuilder'] -> Class['swift::ringserver']
if !defined(Class['rsync::server']) { if !defined(Class['rsync::server']) {
class { 'rsync::server': class { '::rsync::server':
use_xinetd => true, use_xinetd => true,
address => $local_net_ip, address => $local_net_ip,
use_chroot => 'no', use_chroot => 'no',

@ -24,7 +24,7 @@ class swift::storage(
) { ) {
if !defined(Class['rsync::server']){ if !defined(Class['rsync::server']){
class{ 'rsync::server': class{ '::rsync::server':
use_xinetd => true, use_xinetd => true,
address => $storage_local_net_ip, address => $storage_local_net_ip,
use_chroot => 'no', use_chroot => 'no',

@ -24,7 +24,7 @@ class swift::storage::account(
package_ensure => $package_ensure, package_ensure => $package_ensure,
} }
include swift::params include ::swift::params
if $manage_service { if $manage_service {
if $enabled { if $enabled {

@ -60,7 +60,7 @@ class swift::storage::all(
$log_facility = 'LOG_LOCAL2' $log_facility = 'LOG_LOCAL2'
) { ) {
class { 'swift::storage': class { '::swift::storage':
storage_local_net_ip => $storage_local_net_ip, storage_local_net_ip => $storage_local_net_ip,
} }

@ -26,10 +26,10 @@ class swift::storage::container(
swift::storage::generic { 'container': swift::storage::generic { 'container':
manage_service => $manage_service, manage_service => $manage_service,
enabled => $enabled, enabled => $enabled,
package_ensure => $package_ensure package_ensure => $package_ensure,
} }
include swift::params include ::swift::params
if $manage_service { if $manage_service {
if $enabled { if $enabled {
@ -69,7 +69,7 @@ class swift::storage::container(
ensure => $service_ensure, ensure => $service_ensure,
enable => $enabled, enable => $enabled,
provider => $::swift::params::service_provider, provider => $::swift::params::service_provider,
require => File['/etc/init/swift-container-sync.conf', '/etc/init.d/swift-container-sync'] require => File['/etc/init/swift-container-sync.conf', '/etc/init.d/swift-container-sync'],
} }
} }
} }

@ -35,7 +35,7 @@ define swift::storage::generic(
$service_provider = $::swift::params::service_provider $service_provider = $::swift::params::service_provider
) { ) {
include swift::params include ::swift::params
Class['swift::storage'] -> Swift::Storage::Generic[$name] Class['swift::storage'] -> Swift::Storage::Generic[$name]

@ -35,7 +35,7 @@ define swift::storage::mount(
device => $device, device => $device,
fstype => $fstype, fstype => $fstype,
options => "${options},${fsoptions}", options => "${options},${fsoptions}",
require => File["${mnt_base_dir}/${name}"] require => File["${mnt_base_dir}/${name}"],
} }
# double checks to make sure that things are mounted # double checks to make sure that things are mounted

@ -21,10 +21,10 @@ class swift::storage::object(
swift::storage::generic { 'object': swift::storage::generic { 'object':
manage_service => $manage_service, manage_service => $manage_service,
enabled => $enabled, enabled => $enabled,
package_ensure => $package_ensure package_ensure => $package_ensure,
} }
include swift::params include ::swift::params
if $manage_service { if $manage_service {
if $enabled { if $enabled {

@ -60,8 +60,8 @@ define swift::storage::server(
warning("swift storage server ${type} must specify ${type}-server") warning("swift storage server ${type} must specify ${type}-server")
} }
include "swift::storage::${type}" include "::swift::storage::${type}"
include concat::setup include ::concat::setup
validate_re($name, '^\d+$') validate_re($name, '^\d+$')
validate_re($type, '^object|container|account$') validate_re($type, '^object|container|account$')

@ -22,7 +22,7 @@ define swift::storage::xfs(
$loopback = false $loopback = false
) { ) {
include swift::xfs include ::swift::xfs
if $device == '' { if $device == '' {
$target_device = "/dev/${name}" $target_device = "/dev/${name}"

@ -38,6 +38,6 @@ class swift::test_file (
) { ) {
file { '/tmp/swift_test_file.rb': file { '/tmp/swift_test_file.rb':
mode => '0755', mode => '0755',
content => template('swift/swift_keystone_test.erb') content => template('swift/swift_keystone_test.erb'),
} }
} }

@ -29,7 +29,7 @@ describe 'swift::dispersion' do
end end
it { is_expected.to contain_file('/etc/swift/dispersion.conf').with( it { is_expected.to contain_file('/etc/swift/dispersion.conf').with(
:ensure => 'present', :ensure => 'file',
:owner => 'swift', :owner => 'swift',
:group => 'swift', :group => 'swift',
:mode => '0660', :mode => '0660',

@ -47,8 +47,8 @@ describe 'swift' do
{:ensure => 'directory'}.merge(file_defaults) {:ensure => 'directory'}.merge(file_defaults)
)} )}
it {is_expected.to contain_file('/etc/swift/swift.conf').with( it {is_expected.to contain_file('/etc/swift/swift.conf').with(
{:ensure => 'present', { :ensure => 'file',
:mode => '0660', :mode => '0660'
}.merge(file_defaults) }.merge(file_defaults)
)} )}
it 'configures swift.conf' do it 'configures swift.conf' do

@ -11,11 +11,11 @@ Exec { logoutput => true }
package { 'curl': ensure => present } package { 'curl': ensure => present }
class { 'memcached': class { '::memcached':
listen_ip => $swift_local_net_ip, listen_ip => $swift_local_net_ip,
} }
class { 'swift': class { '::swift':
# not sure how I want to deal with this shared secret # not sure how I want to deal with this shared secret
swift_hash_suffix => $swift_shared_secret, swift_hash_suffix => $swift_shared_secret,
package_ensure => latest, package_ensure => latest,
@ -23,8 +23,8 @@ class { 'swift':
# === Configure Storage # === Configure Storage
class { 'swift::storage': class { '::swift::storage':
storage_local_net_ip => $swift_local_net_ip storage_local_net_ip => $swift_local_net_ip,
} }
# create xfs partitions on a loopback device and mounts them # create xfs partitions on a loopback device and mounts them
@ -44,7 +44,7 @@ swift::storage::node { '2':
require => Swift::Storage::Loopback[2] , require => Swift::Storage::Loopback[2] ,
} }
class { 'swift::ringbuilder': class { '::swift::ringbuilder':
part_power => '18', part_power => '18',
replicas => '1', replicas => '1',
min_part_hours => 1, min_part_hours => 1,
@ -53,10 +53,10 @@ class { 'swift::ringbuilder':
# TODO should I enable swath in the default config? # TODO should I enable swath in the default config?
class { 'swift::proxy': class { '::swift::proxy':
proxy_local_net_ip => $swift_local_net_ip, proxy_local_net_ip => $swift_local_net_ip,
pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'], pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'],
account_autocreate => true, account_autocreate => true,
require => Class['swift::ringbuilder'], require => Class['swift::ringbuilder'],
} }
class { ['swift::proxy::healthcheck', 'swift::proxy::cache', 'swift::proxy::tempauth']: } class { ['::swift::proxy::healthcheck', '::swift::proxy::cache', '::swift::proxy::tempauth']: }

@ -52,16 +52,16 @@ $swift_verbose = hiera('verbose', 'True')
# This node can be used to deploy a keystone service. # This node can be used to deploy a keystone service.
# This service only contains the credentials for authenticating # This service only contains the credentials for authenticating
# swift # swift
node swift-keystone { node 'swift-keystone' {
# set up mysql server # set up mysql server
class { 'mysql::server': class { '::mysql::server':
config_hash => { config_hash => {
# the priv grant fails on precise if I set a root password # the priv grant fails on precise if I set a root password
# TODO I should make sure that this works # TODO I should make sure that this works
# 'root_password' => $mysql_root_password, # 'root_password' => $mysql_root_password,
'bind_address' => '0.0.0.0' 'bind_address' => '0.0.0.0',
} },
} }
keystone_config { keystone_config {
@ -69,7 +69,7 @@ node swift-keystone {
} }
# set up all openstack databases, users, grants # set up all openstack databases, users, grants
class { 'keystone::db::mysql': class { '::keystone::db::mysql':
password => $swift_keystone_db_password, password => $swift_keystone_db_password,
} }
@ -83,29 +83,17 @@ node swift-keystone {
} }
# Setup the Keystone Identity Endpoint # Setup the Keystone Identity Endpoint
class { 'keystone::endpoint': } class { '::keystone::endpoint': }
# set up keystone admin users # set up keystone admin users
class { 'keystone::roles::admin': class { '::keystone::roles::admin':
email => $swift_keystone_admin_email, email => $swift_keystone_admin_email,
password => $swift_keystone_admin_password, password => $swift_keystone_admin_password,
} }
# configure the keystone service user and endpoint # configure the keystone service user and endpoint
class { 'swift::keystone::auth': class { '::swift::keystone::auth':
password => $swift_admin_password, password => $swift_admin_password,
public_address => $swift_proxy_node, public_address => $swift_proxy_node,
}
}
node swift_base {
class { 'swift':
# not sure how I want to deal with this shared secret
swift_hash_suffix => $swift_shared_secret,
package_ensure => latest,
} }
} }
@ -118,7 +106,13 @@ node swift_base {
# they would need to be replaced with something that create and mounts xfs # they would need to be replaced with something that create and mounts xfs
# partitions # partitions
# #
node /swift-storage/ inherits swift_base { node /swift-storage/ {
class { '::swift':
# not sure how I want to deal with this shared secret
swift_hash_suffix => $swift_shared_secret,
package_ensure => latest,
}
# create xfs partitions on a loopback device and mount them # create xfs partitions on a loopback device and mount them
swift::storage::loopback { ['1', '2']: swift::storage::loopback { ['1', '2']:
@ -128,39 +122,39 @@ node /swift-storage/ inherits swift_base {
} }
# install all swift storage servers together # install all swift storage servers together
class { 'swift::storage::all': class { '::swift::storage::all':
storage_local_net_ip => $swift_local_net_ip, storage_local_net_ip => $swift_local_net_ip,
} }
# specify endpoints per device to be added to the ring specification # specify endpoints per device to be added to the ring specification
@@ring_object_device { "${swift_local_net_ip}:6000/1": @@ring_object_device { "${swift_local_net_ip}:6000/1":
zone => $swift_zone, zone => $swift_zone,
weight => 1, weight => 1,
} }
@@ring_object_device { "${swift_local_net_ip}:6000/2": @@ring_object_device { "${swift_local_net_ip}:6000/2":
zone => $swift_zone, zone => $swift_zone,
weight => 1, weight => 1,
} }
@@ring_container_device { "${swift_local_net_ip}:6001/1": @@ring_container_device { "${swift_local_net_ip}:6001/1":
zone => $swift_zone, zone => $swift_zone,
weight => 1, weight => 1,
} }
@@ring_container_device { "${swift_local_net_ip}:6001/2": @@ring_container_device { "${swift_local_net_ip}:6001/2":
zone => $swift_zone, zone => $swift_zone,
weight => 1, weight => 1,
} }
# TODO should device be changed to volume # TODO should device be changed to volume
@@ring_account_device { "${swift_local_net_ip}:6002/1": @@ring_account_device { "${swift_local_net_ip}:6002/1":
zone => $swift_zone, zone => $swift_zone,
weight => 1, weight => 1,
} }
@@ring_account_device { "${swift_local_net_ip}:6002/2": @@ring_account_device { "${swift_local_net_ip}:6002/2":
zone => $swift_zone, zone => $swift_zone,
weight => 1, weight => 1,
} }
# collect resources for synchronizing the ring databases # collect resources for synchronizing the ring databases
@ -169,18 +163,23 @@ node /swift-storage/ inherits swift_base {
} }
node /swift-proxy/ inherits swift_base { node /swift-proxy/ {
class { '::swift':
# not sure how I want to deal with this shared secret
swift_hash_suffix => $swift_shared_secret,
package_ensure => latest,
}
# curl is only required so that I can run tests # curl is only required so that I can run tests
package { 'curl': ensure => present } package { 'curl': ensure => present }
class { 'memcached': class { '::memcached':
listen_ip => '127.0.0.1', listen_ip => '127.0.0.1',
} }
# specify swift proxy and all of its middlewares # specify swift proxy and all of its middlewares
class { 'swift::proxy': class { '::swift::proxy':
proxy_local_net_ip => $swift_local_net_ip, proxy_local_net_ip => $swift_local_net_ip,
pipeline => [ pipeline => [
'bulk', 'bulk',
@ -194,8 +193,7 @@ node /swift-proxy/ inherits swift_base {
'keystone', 'keystone',
'account_quotas', 'account_quotas',
'container_quotas', 'container_quotas',
'proxy-server' 'proxy-server'],
],
account_autocreate => true, account_autocreate => true,
# TODO where is the ringbuilder class? # TODO where is the ringbuilder class?
require => Class['swift::ringbuilder'], require => Class['swift::ringbuilder'],
@ -203,35 +201,35 @@ node /swift-proxy/ inherits swift_base {
# configure all of the middlewares # configure all of the middlewares
class { [ class { [
'swift::proxy::account_quotas', '::swift::proxy::account_quotas',
'swift::proxy::catch_errors', '::swift::proxy::catch_errors',
'swift::proxy::container_quotas', '::swift::proxy::container_quotas',
'swift::proxy::healthcheck', '::swift::proxy::healthcheck',
'swift::proxy::cache', '::swift::proxy::cache',
'swift::proxy::swift3', '::swift::proxy::swift3',
]: } ]: }
class { 'swift::proxy::bulk': class { '::swift::proxy::bulk':
max_containers_per_extraction => 10000, max_containers_per_extraction => 10000,
max_failed_extractions => 1000, max_failed_extractions => 1000,
max_deletes_per_request => 10000, max_deletes_per_request => 10000,
yield_frequency => 60, yield_frequency => 60,
} }
class { 'swift::proxy::ratelimit': class { '::swift::proxy::ratelimit':
clock_accuracy => 1000, clock_accuracy => 1000,
max_sleep_time_seconds => 60, max_sleep_time_seconds => 60,
log_sleep_time_seconds => 0, log_sleep_time_seconds => 0,
rate_buffer_seconds => 5, rate_buffer_seconds => 5,
account_ratelimit => 0 account_ratelimit => 0,
} }
class { 'swift::proxy::s3token': class { '::swift::proxy::s3token':
# assume that the controller host is the swift api server # assume that the controller host is the swift api server
auth_host => $swift_keystone_node, auth_host => $swift_keystone_node,
auth_port => '35357', auth_port => '35357',
} }
class { 'swift::proxy::keystone': class { '::swift::proxy::keystone':
operator_roles => ['admin', 'SwiftOperator'], operator_roles => ['admin', 'SwiftOperator'],
} }
class { 'swift::proxy::authtoken': class { '::swift::proxy::authtoken':
admin_user => 'swift', admin_user => 'swift',
admin_tenant_name => 'services', admin_tenant_name => 'services',
admin_password => $swift_admin_password, admin_password => $swift_admin_password,
@ -246,7 +244,7 @@ node /swift-proxy/ inherits swift_base {
Ring_account_device <<| |>> Ring_account_device <<| |>>
# create the ring # create the ring
class { 'swift::ringbuilder': class { '::swift::ringbuilder':
# the part power should be determined by assuming 100 partitions per drive # the part power should be determined by assuming 100 partitions per drive
part_power => '18', part_power => '18',
replicas => '3', replicas => '3',
@ -255,19 +253,18 @@ node /swift-proxy/ inherits swift_base {
} }
# sets up an rsync db that can be used to sync the ring DB # sets up an rsync db that can be used to sync the ring DB
class { 'swift::ringserver': class { '::swift::ringserver':
local_net_ip => $swift_local_net_ip, local_net_ip => $swift_local_net_ip,
} }
# exports rsync gets that can be used to sync the ring files # exports rsync gets that can be used to sync the ring files
@@swift::ringsync { ['account', 'object', 'container']: @@swift::ringsync { ['account', 'object', 'container']:
ring_server => $swift_local_net_ip ring_server => $swift_local_net_ip,
} }
# deploy a script that can be used for testing # deploy a script that can be used for testing
class { 'swift::test_file': class { '::swift::test_file':
auth_server => $swift_keystone_node, auth_server => $swift_keystone_node,
password => $swift_keystone_admin_password, password => $swift_keystone_admin_password,
} }
} }