From fbc9ce695419a7e394212639f0545c66b454f177 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Fri, 14 Aug 2015 11:34:45 -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. 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 --- .gitignore | 2 ++ Gemfile | 30 ++++++++++++++++++++++++++++++ manifests/init.pp | 1 + manifests/virtual/disable.pp | 8 ++++---- manifests/virtual/localuser.pp | 2 +- 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 Gemfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dade81e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +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/init.pp b/manifests/init.pp index e69de29..8b13789 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -0,0 +1 @@ + diff --git a/manifests/virtual/disable.pp b/manifests/virtual/disable.pp index 6471fa8..1d1805b 100644 --- a/manifests/virtual/disable.pp +++ b/manifests/virtual/disable.pp @@ -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}": diff --git a/manifests/virtual/localuser.pp b/manifests/virtual/localuser.pp index c7c9a17..1b1462c 100644 --- a/manifests/virtual/localuser.pp +++ b/manifests/virtual/localuser.pp @@ -6,8 +6,8 @@ define user::virtual::localuser( $realname, $uid, $gid, + $sshkeys, $groups = [ 'sudo', 'admin', ], - $sshkeys = '', $key_id = $title, $old_keys = [], $shell = '/bin/bash',