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 lint
errors caught by the puppet-lint-absolute_classname-check and
puppet-lint-empty_string-check gem as well as arrow alignment errors
not caught before.

The has_variable? function in the layout.html.erb template will return
true whether $image is set to empty string or undef, so we change the
template to look for nil so that the new default of undef will work
correctly.

Change-Id: I6738cfef08e0cf2faeabed469b9eff5e3c0bbb5a
This commit is contained in:
Colleen Murphy 2015-08-03 19:16:43 -07:00
parent 189707396f
commit dc1445d742
5 changed files with 40 additions and 7 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
Gemfile.lock
.bundled_gems/

30
Gemfile Normal file
View File

@ -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

View File

@ -10,7 +10,7 @@ class lodgeit {
include ::httpd
include pip
include ::pip
httpd_mod { 'proxy':
ensure => present,
}

View File

@ -7,7 +7,8 @@ define lodgeit::site(
$db_host='locahost',
$db_user=$name,
$vhost_name="paste.${name}.org",
$image='') {
$image=undef
) {
include ::httpd
@ -31,7 +32,7 @@ define lodgeit::site(
source => '/tmp/lodgeit-main',
}
if $image != '' {
if $image != undef {
file { "/srv/lodgeit/${name}/lodgeit/static/${image}":
ensure => present,
source => "puppet:///modules/lodgeit/${image}",
@ -64,8 +65,8 @@ define lodgeit::site(
}
service { "${name}-paste":
ensure => running,
provider => upstart,
require => Class['httpd'],
ensure => running,
provider => upstart,
require => Class['httpd'],
}
}

View File

@ -19,7 +19,7 @@
<div class="page">
<div id="header">
<h1>
<% if has_variable?("image") then %>
<% if @image != nil then %>
<img src="/static/<%= @image %>" style="padding-bottom: 10px; margin-left: 10px;" alt="<%= @name.capitalize %> Pastebin" />
<% else %>
<%= @name.capitalize %> Pastebin