Skip to content

Commit

Permalink
Merge branch 'master' into release_prep
Browse files Browse the repository at this point in the history
 Conflicts:
	manifests/extension.pp
  • Loading branch information
hunner committed Aug 2, 2017
2 parents cfdcffc + 09e5b0d commit 825f239
Show file tree
Hide file tree
Showing 66 changed files with 1,123 additions and 585 deletions.
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.11'
modulesync_config_version: '0.21.3'
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/
1 change: 1 addition & 0 deletions .rspec_parallel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--format progress
11 changes: 11 additions & 0 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 @@ -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 @@ -519,6 +526,10 @@ 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
32 changes: 15 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
---
sudo: false
dist: trusty
language: ruby
cache: bundler
bundler_args: --without system_tests development
before_install:
- bundle -v
- rm Gemfile.lock || true
- gem update --system
- gem install bundler -v '~>1.13.0'
- gem update bundler
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
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/
24 changes: 14 additions & 10 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,20 +25,24 @@ 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 'puppet-strings', '~> 1.0', :require => false
gem 'redcarpet', :require => false
gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
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'
gem 'parallel_tests', :require => false
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
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Puppet Forge](http://img.shields.io/puppetforge/v/voxpupuli/php.svg)](https://forge.puppetlabs.com/voxpupuli/php)
[![Puppet Forge](http://img.shields.io/puppetforge/v/puppet/php.svg)](https://forge.puppetlabs.com/puppet/php)
[![Build Status](https://travis-ci.org/voxpupuli/puppet-php.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-php)

## Current Status
Expand Down Expand Up @@ -129,6 +129,17 @@ by default. Specify additional pools like so:
For an overview of all possible parameters for `php::fpm::pool` resources
please see [its documention](http://php.puppet.mayflower.de/php/fpm/pool.html).

### Overriding php-fpm user

By default, php-fpm is set up to run as Apache. If you need to customize that user, you can do that like so:

```puppet
class { '::php':
fpm_user => 'nginx',
fpm_group => 'nginx',
}
```

### Alternative examples using Hiera
Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera.

Expand All @@ -139,6 +150,8 @@ Below are all the examples you see above, but defined in YAML format for use wit
php::ensure: latest
php::manage_repos: true
php::fpm: true
php::fpm_user: 'nginx'
php::fpm_group: 'nginx'
php::dev: true
php::composer: true
php::pear: true
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
24 changes: 12 additions & 12 deletions lib/puppet/parser/functions/ensure_prefix.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@

module Puppet::Parser::Functions
newfunction(:ensure_prefix, type: :rvalue, doc: <<-EOS
This function ensures a prefix for all elements in an array or the keys in a hash.
This function ensures a prefix for all elements in an array or the keys in a hash.
*Examples:*
*Examples:*
ensure_prefix({'a' => 1, 'b' => 2, 'p.c' => 3}, 'p.')
ensure_prefix({'a' => 1, 'b' => 2, 'p.c' => 3}, 'p.')
Will return:
{
'p.a' => 1,
'p.b' => 2,
'p.c' => 3,
}
Will return:
{
'p.a' => 1,
'p.b' => 2,
'p.c' => 3,
}
ensure_prefix(['a', 'p.b', 'c'], 'p.')
ensure_prefix(['a', 'p.b', 'c'], 'p.')
Will return:
['p.a', 'p.b', 'p.c']
Will return:
['p.a', 'p.b', 'p.c']
EOS
) do |arguments|
if arguments.size < 2
Expand Down
32 changes: 16 additions & 16 deletions lib/puppet/parser/functions/to_hash_settings.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@

module Puppet::Parser::Functions
newfunction(:to_hash_settings, type: :rvalue, doc: <<-EOS
This function converts a +{key => value}+ hash into a nested hash and can add an id to the outer key.
The optional id string as second parameter is prepended to the resource name.
This function converts a +{key => value}+ hash into a nested hash and can add an id to the outer key.
The optional id string as second parameter is prepended to the resource name.
*Examples:*
*Examples:*
to_hash_settings({'a' => 1, 'b' => 2})
to_hash_settings({'a' => 1, 'b' => 2})
Would return:
{
'a' => {'key' => 'a', 'value' => 1},
'b' => {'key' => 'b', 'value' => 2}
}
Would return:
{
'a' => {'key' => 'a', 'value' => 1},
'b' => {'key' => 'b', 'value' => 2}
}
and:
and:
to_hash_settings({'a' => 1, 'b' => 2}, 'foo')
to_hash_settings({'a' => 1, 'b' => 2}, 'foo')
Would return:
{
'foo: a' => {'key' => 'a', 'value' => 1},
'foo: b' => {'key' => 'b', 'value' => 2}
}
Would return:
{
'foo: a' => {'key' => 'a', 'value' => 1},
'foo: b' => {'key' => 'b', 'value' => 2}
}
EOS
) do |arguments|
hash, id = arguments
Expand Down
7 changes: 2 additions & 5 deletions manifests/apache_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@
# Hash with nested hash of key => value to set in inifile
#
class php::apache_config(
$inifile = $::php::params::apache_inifile,
$settings = {}
Stdlib::Absolutepath $inifile = $::php::params::apache_inifile,
Hash $settings = {}
) inherits ::php::params {

if $caller_module_name != $module_name {
warning('php::apache_config is private')
}

validate_absolute_path($inifile)
validate_hash($settings)

$real_settings = deep_merge($settings, hiera_hash('php::apache::settings', {}))

::php::config { 'apache':
Expand Down
Loading

0 comments on commit 825f239

Please sign in to comment.