From 17430b75071d801ec8b5b0bc2eb3b0fe6bc9bb04 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 29 Jul 2015 23:17:01 -0700 Subject: [PATCH] Add Gemfile and puppet 4 checks In anticipation of puppet 4, start trying to deal with puppet 4 things that can be helpfully predicted by puppet lint plugins. Also fix errors caught by the puppet-lint-unquoted_string-check and puppet-lint-absolute_classname-check gems. Change-Id: I9d74d25d2f2c95ec52a6db3bf070903240e1b933 --- .gitignore | 3 ++- Gemfile | 30 ++++++++++++++++++++++++++++++ manifests/dev.pp | 2 +- manifests/init.pp | 2 +- manifests/mod/python.pp | 2 +- manifests/mod/wsgi.pp | 2 +- manifests/params.pp | 4 ++-- manifests/php.pp | 2 +- manifests/python.pp | 4 ++-- manifests/ssl.pp | 2 +- manifests/vhost.pp | 6 +++--- manifests/vhost/proxy.pp | 10 +++++----- manifests/vhost/redirect.pp | 4 ++-- templates/vhost-default.conf.erb | 2 +- templates/vhost-proxy.conf.erb | 2 +- templates/vhost-redirect.conf.erb | 2 +- 16 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 Gemfile diff --git a/.gitignore b/.gitignore index 5a6ed48..dade81e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.pkg +Gemfile.lock +.bundled_gems/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..96912da --- /dev/null +++ b/Gemfile @@ -0,0 +1,30 @@ +source 'https://rubygems.org' + +group :development, :test do + gem 'puppetlabs_spec_helper', :require => false + + gem 'metadata-json-lint' + # This is nice and all, but let's not worry about it until we've actually + # got puppet 4.x sorted + # 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-empty_string-check' + gem 'puppet-lint-leading_zero-check' + gem 'puppet-lint-variable_contains_upcase' + gem 'puppet-lint-spaceship_operator_without_tag-check' + gem 'puppet-lint-undef_in_function-check' + + if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false + else + gem 'puppet', '~> 3.0', :require => false + end + +end + +# vim:ft=ruby diff --git a/manifests/dev.pp b/manifests/dev.pp index 9373ed7..9632477 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -12,7 +12,7 @@ # Sample Usage: # class httpd::dev { - include httpd::params + include ::httpd::params package { 'apache_dev_package': ensure => installed, diff --git a/manifests/init.pp b/manifests/init.pp index f2a51dc..5f1449d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,7 +13,7 @@ # Sample Usage: # class httpd { - include httpd::params + include ::httpd::params package { 'httpd': ensure => installed, diff --git a/manifests/mod/python.pp b/manifests/mod/python.pp index c8c733f..0997887 100644 --- a/manifests/mod/python.pp +++ b/manifests/mod/python.pp @@ -12,7 +12,7 @@ # Sample Usage: # class httpd::mod::python { - include httpd + include ::httpd package { 'mod_python_package': ensure => installed, diff --git a/manifests/mod/wsgi.pp b/manifests/mod/wsgi.pp index 9595d43..fef40e3 100644 --- a/manifests/mod/wsgi.pp +++ b/manifests/mod/wsgi.pp @@ -12,7 +12,7 @@ # Sample Usage: # class httpd::mod::wsgi { - include httpd + include ::httpd package { 'mod_wsgi_package': ensure => installed, diff --git a/manifests/params.pp b/manifests/params.pp index 94378ce..f64def0 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -24,8 +24,8 @@ class httpd::params { $ssl = true $template = 'httpd/vhost-default.conf.erb' $priority = '25' - $servername = '' - $serveraliases = '' + $servername = undef + $serveraliases = undef $auth = false $redirect_ssl = false $options = 'Indexes FollowSymLinks MultiViews' diff --git a/manifests/php.pp b/manifests/php.pp index ad86f7f..06bee56 100644 --- a/manifests/php.pp +++ b/manifests/php.pp @@ -13,7 +13,7 @@ # Sample Usage: # class httpd::php { - include httpd::params + include ::httpd::params package { 'apache_php_package': ensure => present, diff --git a/manifests/python.pp b/manifests/python.pp index c3322e9..7dc0f2a 100644 --- a/manifests/python.pp +++ b/manifests/python.pp @@ -13,8 +13,8 @@ # Sample Usage: # class httpd::python { - include httpd::params - include httpd + include ::httpd::params + include ::httpd package { 'apache_python_package': ensure => present, diff --git a/manifests/ssl.pp b/manifests/ssl.pp index 124d376..e3abc4c 100644 --- a/manifests/ssl.pp +++ b/manifests/ssl.pp @@ -14,7 +14,7 @@ # class httpd::ssl { - include httpd + include ::httpd case $::operatingsystem { 'centos', 'fedora', 'redhat', 'scientific': { diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 559a531..16cdd95 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -44,16 +44,16 @@ define httpd::vhost( $vhost_name = $httpd::params::vhost_name ) { - include httpd + include ::httpd - if $servername == '' { + if $servername == undef { $srvname = $name } else { $srvname = $servername } if $ssl == true { - include httpd::ssl + include ::httpd::ssl } # Since the template will use auth, redirect to https requires mod_rewrite diff --git a/manifests/vhost/proxy.pp b/manifests/vhost/proxy.pp index 9e44da7..72d091d 100644 --- a/manifests/vhost/proxy.pp +++ b/manifests/vhost/proxy.pp @@ -23,24 +23,24 @@ define httpd::vhost::proxy ( $dest, $priority = '10', $template = 'httpd/vhost-proxy.conf.erb', - $servername = '', - $serveraliases = '', + $servername = undef, + $serveraliases = undef, $ssl = false, $vhost_name = '*' ) { - include httpd + include ::httpd $apache_name = $httpd::params::apache_name $ssl_path = $httpd::params::ssl_path - if $servername == '' { + if $servername == undef { $srvname = $name } else { $srvname = $servername } if $ssl == true { - include httpd::ssl + include ::httpd::ssl } file { "${priority}-${name}": diff --git a/manifests/vhost/redirect.pp b/manifests/vhost/redirect.pp index 250d42a..589ba6d 100644 --- a/manifests/vhost/redirect.pp +++ b/manifests/vhost/redirect.pp @@ -21,12 +21,12 @@ define httpd::vhost::redirect ( $port, $dest, $priority = '10', - $serveraliases = '', + $serveraliases = undef, $template = 'httpd/vhost-redirect.conf.erb', $vhost_name = '*' ) { - include httpd + include ::httpd $srvname = $name diff --git a/templates/vhost-default.conf.erb b/templates/vhost-default.conf.erb index 2cb96d5..e9d2d77 100644 --- a/templates/vhost-default.conf.erb +++ b/templates/vhost-default.conf.erb @@ -8,7 +8,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> ServerName <%= @srvname %> <% if @serveraliases.is_a? Array -%> <% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> -<% elsif @serveraliases != '' -%> +<% elsif @serveraliases != nil -%> <%= " ServerAlias #{@serveraliases}" -%> <% end -%> DocumentRoot <%= @docroot %> diff --git a/templates/vhost-proxy.conf.erb b/templates/vhost-proxy.conf.erb index 8635dd5..05c6a8a 100644 --- a/templates/vhost-proxy.conf.erb +++ b/templates/vhost-proxy.conf.erb @@ -8,7 +8,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> ServerName <%= @srvname %> <% if @serveraliases.is_a? Array %> <% @serveraliases.each do |name| %><%= " ServerAlias #{name}\n" %><% end %> -<% elsif @serveraliases != '' %> +<% elsif @serveraliases != nil %> <%= " ServerAlias #{@serveraliases}" %> <% end %> ProxyRequests Off diff --git a/templates/vhost-redirect.conf.erb b/templates/vhost-redirect.conf.erb index 1cd0362..0a97142 100644 --- a/templates/vhost-redirect.conf.erb +++ b/templates/vhost-redirect.conf.erb @@ -3,7 +3,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> ServerName <%= @srvname %> <% if @serveraliases.is_a? Array %> <% @serveraliases.each do |name| %><%= " ServerAlias #{name}\n" %><% end %> -<% elsif @serveraliases != '' %> +<% elsif @serveraliases != nil %> <%= " ServerAlias #{@serveraliases}" %> <% end %> Redirect / <%= @dest %>/