Skip to content
Snippets Groups Projects
Commit cf809b63 authored by Georg Faerber's avatar Georg Faerber
Browse files

New upstream version 2.6.1

parent 3c5e3e5a
Branches
Tags upstream/2.6.1
No related merge requests found
---
dist: bionic
language: ruby
# Workaround https://github.com/bundler/bundler/issues/3558
before_install: gem install bundler
......@@ -7,6 +8,7 @@ script: bundle exec rake
rvm:
- 2.4.4
- 2.5.1
- 2.6.5
env:
- PUPPET_VERSION="~> 5.5.10"
- PUPPET_VERSION="~> 6.1.0"
......@@ -29,3 +31,10 @@ deploy:
tags: true
all_branches: true
repo: voxpupuli/puppet-syntax
notifications:
email: false
irc:
on_success: always
on_failure: always
channels:
- "chat.freenode.org#voxpupuli-notifications"
......@@ -2,6 +2,33 @@
All notable changes to this project will be documented in this file.
## [v2.6.1](https://github.com/voxpupuli/puppet-syntax/tree/v2.6.1) (2020-01-11)
[Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.6.0...v2.6.1)
**Fixed bugs:**
- Add `puppet` gem as runtime dependency [\#116](https://github.com/voxpupuli/puppet-syntax/pull/116) ([bastelfreak](https://github.com/bastelfreak))
**Merged pull requests:**
- traivs: run tests on Ubuntu 18.04 [\#117](https://github.com/voxpupuli/puppet-syntax/pull/117) ([bastelfreak](https://github.com/bastelfreak))
- travis: enable irc / disable email notifications [\#114](https://github.com/voxpupuli/puppet-syntax/pull/114) ([bastelfreak](https://github.com/bastelfreak))
## [v2.6.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.6.0) (2019-10-05)
[Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.5.0...v2.6.0)
**Implemented enhancements:**
- add support for validating puppet plans \(fixes \#95, fixes \#96\) [\#97](https://github.com/voxpupuli/puppet-syntax/pull/97) ([slauger](https://github.com/slauger))
- Allow specifying file paths for manifests and templates too [\#87](https://github.com/voxpupuli/puppet-syntax/pull/87) ([lavagetto](https://github.com/lavagetto))
**Merged pull requests:**
- Test on ruby 2.6 [\#111](https://github.com/voxpupuli/puppet-syntax/pull/111) ([alexjfisher](https://github.com/alexjfisher))
- Adding KMS tags to allowed EYAML methods [\#105](https://github.com/voxpupuli/puppet-syntax/pull/105) ([craigwatson](https://github.com/craigwatson))
## [v2.5.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.5.0) (2019-07-07)
[Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.3...v2.5.0)
......
......@@ -18,7 +18,8 @@ end
gemspec
# Override gemspec for CI matrix builds.
gem 'puppet', *location_for(ENV['PUPPET_VERSION'] || '>2.7.0')
# But only if the environment variable is set
gem 'puppet', *location_for(ENV['PUPPET_VERSION'] || '>= 5') if ENV['PUPPET_VERSION']
# older version required for ruby 1.9 compat, as it is pulled in as dependency of puppet, this has to be carried by the module
gem 'json_pure', '<= 2.0.1'
......
......@@ -51,6 +51,11 @@ To configure Puppet::Syntax, add any of the following settings to your `Rakefile
PuppetSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"]
* To configure specific paths for the Puppet syntax checks or for the templates checks, specify `manifests_paths` or `templates_paths` respectively. This is useful if you want to check specific paths only.
PuppetSyntax.manifests_paths = ["**/environments/future/*.pp"]
PuppetSyntax.templates_paths = ["**/modules/**/templates/*.erb"]
* To validate the syntax of code written for application orchestration, enable `app_management`:
PuppetSyntax.app_management = true
......
......@@ -12,6 +12,13 @@ module PuppetSyntax
"hieradata/**/*.*{yaml,yml}",
"hiera*.*{yaml,yml}"
]
@manifests_paths = [
'**/*.pp'
]
@templates_paths = [
'**/templates/**/*.erb',
'**/templates/**/*.epp'
]
@fail_on_deprecation_notices = true
@app_management = Puppet.version.to_i >= 5 ? true : false
@check_hiera_keys = false
......@@ -20,6 +27,8 @@ module PuppetSyntax
attr_accessor :exclude_paths,
:future_parser,
:hieradata_paths,
:manifests_paths,
:templates_paths,
:fail_on_deprecation_notices,
:epp_only,
:check_hiera_keys
......
......@@ -56,7 +56,7 @@ module PuppetSyntax
method = 'PKCS7'
end
return "has unknown eyaml method #{method}" unless ['PKCS7','GPG'].include? method
return "has unknown eyaml method #{method}" unless ['PKCS7','GPG','GKMS','KMS'].include? method
return "has unpadded or truncated base64 data" unless base64.length % 4 == 0
# Base64#decode64 will silently ignore characters outside the alphabet,
......
......@@ -64,6 +64,7 @@ module PuppetSyntax
def validate_manifest(file)
Puppet[:parser] = 'future' if PuppetSyntax.future_parser and Puppet.version.to_i < 4
Puppet[:app_management] = true if PuppetSyntax.app_management && (Puppet::Util::Package.versioncmp(Puppet.version, '4.3.0') >= 0 && Puppet.version.to_i < 5)
Puppet[:tasks] = true if Puppet::Util::Package.versioncmp(Puppet.version, '5.4.0') >= 0 and file.match(/.*plans\/.*\.pp$/)
Puppet::Face[:parser, :current].validate(file)
end
end
......
......@@ -13,11 +13,11 @@ module PuppetSyntax
end
def filelist_manifests
filelist("**/*.pp")
filelist(PuppetSyntax.manifests_paths)
end
def filelist_templates
filelist(["**/templates/**/*.erb", "**/templates/**/*.epp"])
filelist(PuppetSyntax.templates_paths)
end
def filelist_hiera_yaml
......
module PuppetSyntax
VERSION = '2.5.0'
VERSION = '2.6.1'
end
......@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_dependency "rake"
spec.add_dependency "puppet", ">= 5"
spec.add_development_dependency "pry"
spec.add_development_dependency "rb-readline"
......
......@@ -2,6 +2,13 @@ require 'spec_helper'
describe PuppetSyntax::Templates do
let(:subject) { PuppetSyntax::Templates.new }
let(:conditional_warning_regex) do
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0')
%r{2: warning: found `= literal' in conditional}
else
%r{2: warning: found = in conditional}
end
end
it 'should expect an array of files' do
expect { subject.check(nil) }.to raise_error(/Expected an array of files/)
......@@ -34,7 +41,7 @@ describe PuppetSyntax::Templates do
res = subject.check(files)
expect(res.size).to eq(1)
expect(res[0]).to match(/2: warning: found = in conditional/)
expect(res[0]).to match(conditional_warning_regex)
end
it 'should read more than one valid file' do
......@@ -50,7 +57,7 @@ describe PuppetSyntax::Templates do
expect(res.size).to eq(2)
expect(res[0]).to match(/2: syntax error, unexpected/)
expect(res[1]).to match(/2: warning: found = in conditional/)
expect(res[1]).to match(conditional_warning_regex)
end
it 'should ignore a TypeError' do
......
......@@ -44,4 +44,12 @@ describe PuppetSyntax do
expect(PuppetSyntax.epp_only).to eq(true)
end
it 'should support setting paths for manifests, templates and hiera' do
PuppetSyntax.hieradata_paths = []
expect(PuppetSyntax.hieradata_paths).to eq([])
PuppetSyntax.manifests_paths = ["**/environments/production/**/*.pp"]
expect(PuppetSyntax.manifests_paths).to eq(["**/environments/production/**/*.pp"])
PuppetSyntax.templates_paths = []
expect(PuppetSyntax.templates_paths).to eq([])
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment