Introduce Puppet-lint/syntax test into Packstack
- Add puppet-lint and puppet-syntax - To run puppet-lint, please look at the README.md file. Change-Id: I4b9e5d0c030b891545bc07f10091d748cdc1482e Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
parent
9be16f3ee5
commit
b2c341d4a5
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,4 +2,6 @@
|
||||
*.swp
|
||||
*.log
|
||||
.tox
|
||||
vendor/*
|
||||
Gemfile.lock
|
||||
packstack.egg-info
|
||||
|
17
Gemfile
Normal file
17
Gemfile
Normal file
@ -0,0 +1,17 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
group :development, :test do
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'puppet-lint', '~> 1.1'
|
||||
gem 'puppet-lint-param-docs', '1.1.0'
|
||||
gem 'puppet-syntax'
|
||||
gem 'rake', '10.1.1'
|
||||
end
|
||||
|
||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||
gem 'puppet', puppetversion, :require => false
|
||||
else
|
||||
gem 'puppet', :require => false
|
||||
end
|
||||
|
||||
# vim:ft=ruby
|
28
README.md
28
README.md
@ -131,3 +131,31 @@ executable without further intervention, and **Packstack** is ready to install.
|
||||
**IMPORTANT** <https://docs.puppetlabs.com/guides/style_guide.html>
|
||||
|
||||
Please, respect the Puppet Style Guide as much as possible !
|
||||
|
||||
## Running local Puppet-lint tests
|
||||
|
||||
It assumes that both `bundler` as well as `rubygems` (and `ruby`) are already
|
||||
installed on the system. If not, run this command:
|
||||
|
||||
$ sudo yum install rubygems rubygem-bundler ruby ruby-devel -y
|
||||
|
||||
Go into the **Packstack** root directory.
|
||||
|
||||
$ cd packstack/
|
||||
|
||||
A `Rakefile` contains all you need to run puppet-lint task automatically over
|
||||
all the puppet manifests included in the **Packstack** project.
|
||||
|
||||
$ ls -l packstack/puppet/templates/
|
||||
|
||||
and
|
||||
|
||||
$ ls -l packstack/puppet/modules/
|
||||
|
||||
The default puppet-lint pattern for `.pp` files is `**/*.pp`. So there is no
|
||||
need to go inside those directories to run puppet-lint !
|
||||
|
||||
$ mkdir vendor
|
||||
$ export GEM_HOME=vendor
|
||||
$ bundle install
|
||||
$ bundle exec rake lint
|
||||
|
20
Rakefile
Normal file
20
Rakefile
Normal file
@ -0,0 +1,20 @@
|
||||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
require 'puppet-syntax/tasks/puppet-syntax'
|
||||
|
||||
PuppetLint.configuration.fail_on_warnings = true
|
||||
PuppetLint.configuration.with_filename = false
|
||||
PuppetLint.configuration.send('disable_names_containing_dash')
|
||||
PuppetLint.configuration.send('disable_80chars')
|
||||
PuppetLint.configuration.send('disable_class_parameter_defaults')
|
||||
exclude_paths = ['spec/**/*','pkg/**/*','vendor/**/*']
|
||||
exclude_lint_paths = exclude_paths
|
||||
|
||||
PuppetLint.configuration.ignore_paths = exclude_lint_paths
|
||||
PuppetSyntax.exclude_paths = exclude_paths
|
||||
|
||||
task(:default).clear
|
||||
task :default => :lint
|
||||
|
||||
desc 'Run syntax, lint'
|
||||
task :test => [:syntax,:lint]
|
Loading…
x
Reference in New Issue
Block a user