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-empty_string-check gem as well as
arrow alignment errors raised by the newer version of puppet-lint.

Change-Id: I541aff1e4848e46918f7d6e1750c2afa26fb2f3a
This commit is contained in:
Colleen Murphy 2015-08-13 12:46:41 -07:00
parent fea61c6c44
commit 6d9e839729
5 changed files with 49 additions and 15 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

@ -11,10 +11,10 @@ class phabricator (
$mysql_user_password,
$ssl_cert_file = "/etc/ssl/certs/${::fqdn}.pem",
$ssl_key_file = "/etc/ssl/private/${::fqdn}.key",
$ssl_chain_file = '',
$ssl_cert_file_contents = '', # If left empty puppet will not create file.
$ssl_key_file_contents = '', # If left empty puppet will not create file.
$ssl_chain_file_contents = '' # If left empty puppet will not create file.
$ssl_chain_file = undef,
$ssl_cert_file_contents = undef, # If left empty puppet will not create file.
$ssl_key_file_contents = undef, # If left empty puppet will not create file.
$ssl_chain_file_contents = undef # If left empty puppet will not create file.
) {
$instances_dir = "${phab_dir}/instances"
@ -50,7 +50,7 @@ class phabricator (
ensure => directory,
}
if $ssl_cert_file_contents != '' {
if $ssl_cert_file_contents != undef {
file { $ssl_cert_file:
owner => 'root',
group => 'root',
@ -60,7 +60,7 @@ class phabricator (
}
}
if $ssl_key_file_contents != '' {
if $ssl_key_file_contents != undef {
file { $ssl_key_file:
owner => 'root',
group => 'ssl-cert',
@ -70,7 +70,7 @@ class phabricator (
}
}
if $ssl_chain_file_contents != '' {
if $ssl_chain_file_contents != undef {
file { $ssl_chain_file:
owner => 'root',
group => 'root',
@ -131,9 +131,9 @@ class phabricator (
}
file { '/etc/php5/apache2/conf.d/20-phabricator.ini':
ensure => 'link',
target => '/etc/php5/mods-available/phabricator.ini',
notify => Service['httpd'],
ensure => 'link',
target => '/etc/php5/mods-available/phabricator.ini',
notify => Service['httpd'],
}
exec { 'load-initial-db':

View File

@ -22,10 +22,10 @@ class phabricator::mysql(
class { '::mysql::server':
config_hash => {
'root_password' => $mysql_root_password,
'default_engine' => 'InnoDB',
'bind_address' => $mysql_bind_address,
'port' => $mysql_port,
'root_password' => $mysql_root_password,
'default_engine' => 'InnoDB',
'bind_address' => $mysql_bind_address,
'port' => $mysql_port,
}
}

View File

@ -36,7 +36,9 @@
SSLProtocol All -SSLv2 -SSLv3
SSLCertificateFile <%= scope.lookupvar("phabricator::ssl_cert_file") %>
SSLCertificateKeyFile <%= scope.lookupvar("phabricator::ssl_key_file") %>
<% if scope.lookupvar("phabricator::ssl_chain_file") != "" %>
<%# scope.lookupvar returns nil for an undefined variable in puppet 4 -%>
<%# scope.lookupvar returns :undef for an undefined variable in puppet 3 -%>
<% unless ['', nil, :undef].include?(scope.lookupvar("phabricator::ssl_chain_file")) %>
SSLCertificateChainFile <%= scope.lookupvar("phabricator::ssl_chain_file") %>
<% end %>