7 changes: 3 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:

```sh
export PUPPET_VERSION="~> 5.5.6"
export PUPPET_GEM_VERSION="~> 6.1.0"
```

You can install all needed gems for spec tests into the modules directory by
Expand Down Expand Up @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this
with:

```sh
BEAKER_setfile=debian10-x64 bundle exec rake beaker
BEAKER_setfile=debian11-64 bundle exec rake beaker
```

You can replace the string `debian10` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* ubuntu2004
* debian9
* debian10
* debian11
* centos7
* centos8

Expand Down
86 changes: 9 additions & 77 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,13 @@ name: CI

on: pull_request

jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
outputs:
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }}
env:
BUNDLE_WITHOUT: development:system_tests:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run static validations
run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false

unit:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake parallel_spec
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}

tests:
needs:
- unit
- acceptance
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
with:
pidfile_workaround: 'false'
32 changes: 10 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,14 @@ on:
tags:
- '*'

env:
BUNDLE_WITHOUT: development:test:system_tests

jobs:
deploy:
name: 'deploy to forge'
runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Build and Deploy
env:
# Configure secrets here:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}'
BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}'
run: bundle exec rake module:push
release:
name: Release
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
with:
allowed_owner: 'voxpupuli'
secrets:
# Configure secrets here:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '4.2.0'
modulesync_config_version: '5.2.0'
3 changes: 2 additions & 1 deletion .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--fail-on-warnings
--no-class_inherits_from_params_class-check
--no-parameter_documentation-check
--no-parameter_types-check
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v8.0.2](https://github.com/voxpupuli/puppet-php/tree/v8.0.2) (2021-09-05)
## [v8.0.3](https://github.com/voxpupuli/puppet-php/tree/v8.0.3) (2022-03-21)

[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v8.0.2...v8.0.3)

**Fixed bugs:**

- Fix forcing a php::setting to be absent by setting its value to undef [\#647](https://github.com/voxpupuli/puppet-php/pull/647) ([jadestorm](https://github.com/jadestorm))

**Closed issues:**

- Unable to remove extension configuration settings [\#653](https://github.com/voxpupuli/puppet-php/issues/653)
- update supported os matrix [\#617](https://github.com/voxpupuli/puppet-php/issues/617)

## [v8.0.2](https://github.com/voxpupuli/puppet-php/tree/v8.0.2) (2021-09-06)

[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v8.0.1...v8.0.2)

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /opt/puppet
# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39
RUN mkdir -p /etc/sv

ARG PUPPET_VERSION="~> 6.0"
ARG PUPPET_GEM_VERSION="~> 6.0"
ARG PARALLEL_TEST_PROCESSORS=4

# Cache gems
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

source ENV['GEM_SOURCE'] || "https://rubygems.org"
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'voxpupuli-test', '~> 2.5', :require => false
gem 'voxpupuli-test', '~> 5.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 1.0', :require => false
Expand All @@ -21,14 +21,14 @@ end

group :release do
gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
gem 'voxpupuli-release', '>= 1.0.2', :require => false
gem 'voxpupuli-release', '>= 1.2.0', :require => false
gem 'puppet-strings', '>= 2.2', :require => false
end

gem 'rake', :require => false
gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test]

puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0'
puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0'
gem 'puppet', puppetversion, :require => false, :groups => [:test]

# vim: syntax=ruby
12 changes: 7 additions & 5 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2043,27 +2043,29 @@ Configure php.ini settings
The following parameters are available in the `php::config::setting` defined type:

* [`key`](#key)
* [`value`](#value)
* [`file`](#file)
* [`value`](#value)

##### <a name="key"></a>`key`

Data type: `String[1]`



##### <a name="value"></a>`value`
##### <a name="file"></a>`file`

Data type: `Variant[Integer, String]`
Data type: `Stdlib::Absolutepath`



##### <a name="file"></a>`file`
##### <a name="value"></a>`value`

Data type: `Stdlib::Absolutepath`
Data type: `Optional[Variant[Integer, String]]`



Default value: ``undef``

### <a name="phpextension"></a>`php::extension`

Install a PHP extension package
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper),
# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper),
# otherwise attempt to load it directly.
begin
require 'voxpupuli/test/rake'
Expand Down
6 changes: 4 additions & 2 deletions lib/facter/phpversion.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true

Facter.add(:phpversion) do
setcode do
output = Facter::Util::Resolution.exec('php -v')

unless output.nil?
output.split("\n").first.split(' ').
select { |x| x =~ %r{^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)} }.first
output.split("\n").first.split.
grep(%r{^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)}).first
end
end
end
21 changes: 8 additions & 13 deletions lib/puppet/parser/functions/ensure_prefix.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

module Puppet::Parser::Functions
newfunction(:ensure_prefix, type: :rvalue, doc: <<-EOS
Expand All @@ -18,26 +19,20 @@ module Puppet::Parser::Functions
Will return:
['p.a', 'p.b', 'p.c']
EOS
) do |arguments|
EOS
) do |arguments|
if arguments.size < 2
raise(Puppet::ParseError, 'ensure_prefix(): Wrong number of arguments ' \
"given (#{arguments.size} for 2)")
"given (#{arguments.size} for 2)")
end

enumerable = arguments[0]

unless enumerable.is_a?(Array) || enumerable.is_a?(Hash)
raise Puppet::ParseError, "ensure_prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}"
end
raise Puppet::ParseError, "ensure_prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}" unless enumerable.is_a?(Array) || enumerable.is_a?(Hash)

prefix = arguments[1] if arguments[1]

if prefix
unless prefix.is_a?(String)
raise Puppet::ParseError, "ensure_prefix(): expected second argument to be a String, got #{prefix.inspect}"
end
end
raise Puppet::ParseError, "ensure_prefix(): expected second argument to be a String, got #{prefix.inspect}" if prefix && !prefix.is_a?(String)

result = if enumerable.is_a?(Array)
# Turn everything into string same as join would do ...
Expand All @@ -46,10 +41,10 @@ module Puppet::Parser::Functions
prefix && !i.start_with?(prefix) ? prefix + i : i
end
else
Hash[enumerable.map do |k, v|
enumerable.map do |k, v|
k = k.to_s
[prefix && !k.start_with?(prefix) ? prefix + k : k, v]
end]
end.to_h
end

return result
Expand Down
5 changes: 3 additions & 2 deletions lib/puppet/parser/functions/to_hash_settings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

module Puppet::Parser::Functions
newfunction(:to_hash_settings, type: :rvalue, doc: <<-EOS
Expand All @@ -23,8 +24,8 @@ module Puppet::Parser::Functions
'foo: a' => {'key' => 'a', 'value' => 1},
'foo: b' => {'key' => 'b', 'value' => 2}
}
EOS
) do |arguments|
EOS
) do |arguments|
hash, id = arguments
id = (id.nil? ? '' : "#{id}: ")

Expand Down
11 changes: 8 additions & 3 deletions lib/puppet/provider/package/pear.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'puppet/provider/package'

Puppet::Type.type(:package).provide :pear, parent: Puppet::Provider::Package do
Expand Down Expand Up @@ -32,13 +34,14 @@ def self.pearlist(only = nil)
def self.pearsplit(desc, channel)
desc.strip!

# rubocop:disable Lint/DuplicateBranch
case desc
when '' then nil
when %r{^installed}i then nil
when %r{no packages installed}i then nil
when %r{^=} then nil
when %r{^package}i then nil
when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$} then
when %r{^(\S+)\s+(\S+)\s+(\S+)\s*$}
name = Regexp.last_match(1)
version = Regexp.last_match(2)
state = Regexp.last_match(3)
Expand All @@ -53,6 +56,7 @@ def self.pearsplit(desc, channel)
Puppet.warning format('Could not match %s', desc)
nil
end
# rubocop:enable Lint/DuplicateBranch
end

def self.instances
Expand All @@ -70,10 +74,11 @@ def install(useversion = true)
command << '--alldeps'
end

pear_pkg = @resource[:source] || @resource[:name]
if !@resource[:ensure].is_a?(Symbol) && useversion
command << '-f'
pear_pkg << "-#{@resource[:ensure]}"
pear_pkg = "#{@resource[:source] || @resource[:name]}-#{@resource[:ensure]}"
else
pear_pkg = @resource[:source] || @resource[:name]
end
command << pear_pkg

Expand Down
Loading