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. Fix arrow
alignment errors now caught by the bundle-installed puppet-lint.

This patch makes $users::virtual::localuser::sshkeys a required
parameter to fix the puppet-lint-empty_string-check error. If left as
empty string and the default is used, the ssh_authorized_key resource
will still create the authorized_key entry but with an empty key, which
is not useful.

Change-Id: Ica35f012f3af74159fc8b2ae5df60d11d4c15f33
This commit is contained in:
Colleen Murphy 2015-08-14 11:34:45 -07:00
parent 7a0deb3cc5
commit fbc9ce6954
5 changed files with 38 additions and 5 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

@ -0,0 +1 @@

View File

@ -11,12 +11,12 @@ define user::virtual::disable(
}
#2. remove sshkeys file(s)
file { "rm_authorized_keys_${username}":
ensure => absent,
path => "/home/${username}/.ssh/authorized_keys",
ensure => absent,
path => "/home/${username}/.ssh/authorized_keys",
}
file { "rm_authorized_keys2_${username}":
ensure => absent,
path => "/home/${username}/.ssh/authorized_keys2",
ensure => absent,
path => "/home/${username}/.ssh/authorized_keys2",
}
#3. rm screen dir (just in case)
file { "rm_screen_${username}":

View File

@ -6,8 +6,8 @@ define user::virtual::localuser(
$realname,
$uid,
$gid,
$sshkeys,
$groups = [ 'sudo', 'admin', ],
$sshkeys = '',
$key_id = $title,
$old_keys = [],
$shell = '/bin/bash',