4 changes: 2 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ fixtures:
symlinks:
"hiera": "#{source_dir}"
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile.git"
"stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib.git"
"inifile": "https://github.com/puppetlabs/puppetlabs-inifile.git"
4 changes: 4 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ If you don't want to have to recreate the virtual machine every time you
can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will
at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile
for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`.

The easiest way to debug in a docker container is to open a shell:

docker exec -it -u root ${container_id_or_name} bash
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ spec/fixtures/manifests/
spec/fixtures/modules/
.vagrant/
.bundle/
.ruby-version
coverage/
log/
.idea/
.dependencies/
.librarian/
Puppetfile.lock
*.iml
.*.sw?
.yardoc/
Guardfile
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '0.16.7'
modulesync_config_version: '0.21.1'
63 changes: 63 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Managed by https://github.com/voxpupuli/modulesync_configs
#
# Hooks are only enabled if you take action.
#
# To enable the hooks run:
#
# ```
# bundle exec overcommit --install
# # ensure .overcommit.yml does not harm to you and then
# bundle exec overcommit --sign
# ```
#
# (it will manage the .git/hooks directory):
#
# Examples howto skip a test for a commit or push:
#
# ```
# SKIP=RuboCop git commit
# SKIP=PuppetLint git commit
# SKIP=RakeTask git push
# ```
#
# Don't invoke overcommit at all:
#
# ```
# OVERCOMMIT_DISABLE=1 git commit
# ```
#
# Read more about overcommit: https://github.com/brigade/overcommit
#
# To manage this config yourself in your module add
#
# ```
# .overcommit.yml:
# unmanaged: true
# ```
#
# to your modules .sync.yml config
---
PreCommit:
RuboCop:
enabled: true
description: 'Runs rubocop on modified files only'
command: ['bundle', 'exec', 'rubocop']
PuppetLint:
enabled: true
description: 'Runs puppet-lint on modified files only'
command: ['bundle', 'exec', 'puppet-lint']
YamlSyntax:
enabled: true
JsonSyntax:
enabled: true
TrailingWhitespace:
enabled: true

PrePush:
RakeTarget:
enabled: true
description: 'Run rake targets'
targets:
- 'test'
- 'rubocop'
command: [ 'bundle', 'exec', 'rake' ]
20 changes: 20 additions & 0 deletions .pmtignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
docs/
pkg/
Gemfile.lock
Gemfile.local
vendor/
.vendor/
spec/fixtures/manifests/
spec/fixtures/modules/
.vagrant/
.bundle/
.ruby-version
coverage/
log/
.idea/
.dependencies/
.librarian/
Puppetfile.lock
*.iml
.*.sw?
.yardoc/
19 changes: 17 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ AllCops:
- .vendor/**/*
- pkg/**/*
- spec/fixtures/**/*
- Gemfile
- Rakefile
- Guardfile
Lint/ConditionPosition:
Enabled: True

Expand Down Expand Up @@ -74,7 +77,7 @@ Style/WhileUntilModifier:
Lint/AmbiguousRegexpLiteral:
Enabled: True

Lint/Eval:
Security/Eval:
Enabled: True

Lint/BlockAlignment:
Expand Down Expand Up @@ -302,7 +305,7 @@ Style/EmptyLiteral:
Metrics/LineLength:
Enabled: False

Style/MethodCallParentheses:
Style/MethodCallWithoutArgsParentheses:
Enabled: True

Style/MethodDefParentheses:
Expand Down Expand Up @@ -500,6 +503,10 @@ Style/ClosingParenthesisIndentation:

# RSpec

RSpec/BeforeAfterAll:
Exclude:
- spec/acceptance/**/*

# We don't use rspec in this way
RSpec/DescribeClass:
Enabled: False
Expand All @@ -518,3 +525,11 @@ RSpec/RepeatedDescription:

RSpec/NestedGroups:
Enabled: False

# this is broken on ruby1.9
Style/IndentHeredoc:
Enabled: False

# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs
Security/YAMLLoad:
Enabled: false
30 changes: 14 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
sudo: false
dist: trusty
language: ruby
cache: bundler
bundler_args: --without system_tests development
before_install:
- bundle -v
- rm Gemfile.lock || true
Expand All @@ -15,26 +15,24 @@ script:
matrix:
fast_finish: true
include:
- rvm: 1.9.3
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test
- rvm: 1.9.3
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test
- rvm: 2.1.9
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test
- rvm: 2.1.9
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.0" CHECK=test
- rvm: 2.2.6
- rvm: 2.2.7
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.0" CHECK=test
- rvm: 2.3.3
env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes
- rvm: 2.3.3
env: PUPPET_VERSION="~> 4.0" CHECK=rubocop
- rvm: 2.3.3
- rvm: 2.3.4
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.0" CHECK=test
- rvm: 2.4.0
- rvm: 2.4.1
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.0" CHECK=test
allow_failures:
- rvm: 2.4.0
- rvm: 2.4.1
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.0" CHECK=rubocop
- rvm: 2.4.1
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes
branches:
only:
- master
Expand Down
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--markup markdown
--output-dir docs/
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest Vox Pupuli modulesync defaults.
These should not impact the functionality of the module.

## 2017-05-10 - Release 3.0.0

puppet/hiera no longer supports Puppet 3
* [GH-191](https://github.com/voxpupuli/puppet-hiera/pull/191)
Replace validate_* calls with Puppet 4 data types
* [GH-187](https://github.com/voxpupuli/puppet-hiera/issues/187)
Add parameter for passing gem install options.
Especially helpful for those who need to use an http proxy when installing gems.

## 2017-01-13 - Release 2.4.0

This is the last release with Puppet 3 support!
* Do not make files in the gnupg home executable
* Support deep_merge_options with 'deeper' merge_behavior
* Support deep_merge_options with 'deeper' merge_behavior
* Correct spelling of @merge_behavior in template
* Bump min version_requirement for Puppet + deps
* Strict variables fix for `pe_server_version`
Expand Down
23 changes: 14 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false
gem 'puppetlabs_spec_helper', '~> 2.1.1', :require => false
gem 'rspec-puppet', '~> 2.5', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-utils', :require => false
Expand All @@ -25,18 +25,23 @@ group :test do
gem 'metadata-json-lint', :require => false
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git'
gem 'puppet-strings', '~> 1.0.0', :require => false
gem 'rubocop-rspec', '~> 1.9.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
gem 'puppet-strings', '~> 1.0', :require => false
gem 'redcarpet', :require => false
gem 'rubocop', '~> 0.48.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'mocha', '>= 1.2.1', :require => false
gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0'
gem 'simplecov-console', :require => false if RUBY_VERSION >= '2.0.0'
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2'
end

group :development do
gem 'travis', :require => false
gem 'travis-lint', :require => false
gem 'guard-rake', :require => false
gem 'travis', :require => false
gem 'travis-lint', :require => false
gem 'guard-rake', :require => false
gem 'overcommit', '~> 0.39.1', :require => false
end

group :system_tests do
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ The following parameters are available for the hiera class:
hiera.yaml changes.
**Note**: You must pass `master_service => 'puppetserver'` for FOSS puppetserver
Default: 'pe-puppetserver' for PE 2015.x, otherwise 'puppetmaster'
* `gem_install_options`
An array of install options to pass to the gem package resources. Typically,
this parameter is used to specify a proxy server. eg
`gem_install_options => ['--http-proxy', 'http://proxy.example.com:3128']`

[eyaml]: https://github.com/TomPoulton/hiera-eyaml

Expand Down
11 changes: 11 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ task test: [
:metadata_lint,
:release_checks,
]

begin
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
version = (Blacksmith::Modulefile.new).version
config.future_release = "v#{version}"
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not impact the functionality of the module."
config.exclude_labels = %w{duplicate question invalid wontfix modulesync}
end
rescue LoadError
end
# vim: syntax=ruby
3 changes: 1 addition & 2 deletions manifests/eyaml_gpg.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
gem_version => $ruby_gpg_version,
gem_source => $ruby_gpg_source,
}
->
::hiera::install { 'hiera-eyaml-gpg':
-> ::hiera::install { 'hiera-eyaml-gpg':
gem_name => $eyaml_gpg_name,
provider => $provider,
gem_version => $eyaml_gpg_version,
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
$ruby_gpg_version = undef,
$ruby_gpg_source = undef,

Optional[Array] $gem_install_options = undef,

#Deprecated
$gem_source = undef,
) inherits ::hiera::params {
Expand Down
13 changes: 10 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
define hiera::install (
$gem_name,
$provider,
$gem_version = undef,
$gem_source = undef,
$gem_version = undef,
$gem_source = undef,
$gem_install_options = $::hiera::gem_install_options,
) {

# $gem_install_options is typically used for specifying a proxy
Package {
install_options => $gem_install_options,
}

$gem_ensure = pick($gem_version, 'installed')
if $provider == 'pe_puppetserver_gem' or $provider == 'puppetserver_gem' {
if $::puppetversion and versioncmp($::puppetversion, '4.0.0') >= 0 {
Expand Down Expand Up @@ -59,7 +66,7 @@
}
elsif $gem_source {
# Use a local source, like the package providers would
validate_absolute_path($gem_source)
assert_type(Stdlib::Absolutepath, $gem_source)
$source_flag = '--local'
} else {
$source_flag = undef
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-hiera",
"version": "2.4.0",
"version": "3.0.0",
"author": "Vox Pupuli",
"summary": "Deploy hiera.yaml with hierarchy, and datadir",
"license": "Apache-2.0",
Expand All @@ -10,7 +10,7 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.6.0 < 5.0.0"
"version_requirement": ">= 4.13.1 < 5.0.0"
},
{
"name": "puppetlabs/inifile",
Expand Down Expand Up @@ -53,7 +53,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 3.8.7 < 5.0.0"
"version_requirement": ">= 4.6.1 < 5.0.0"
}
]
}
1 change: 1 addition & 0 deletions spec/acceptance/hiera_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class myclass {
include myclass
EOS
end

it 'finds it on the command line' do
expect(on(master, 'hiera myclass::value environment=production').stdout.strip).to eq('found output')
end
Expand Down
Loading