Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## Supported Release 4.17.0
### Summary
This release adds support for internationalization. It also contains Japanese translations for the README, summary and description of the metadata.json and major cleanups in the README. Additional folders have been introduced called locales and readmes where translation files can be found. A number of features and bug fixes are also included in this release. It also adds a new function `glob()` for expanding file lists. Also works around an issue that appeared in puppet 4.6.0 involving types being declared multiple times.

#### Features
- Addition of POT file / folder structure for i18n.
- Addition of Internationalized READMEs.
- `glob()` function

### Fixed
- Occasional duplicate type definitions when using `defined_with_params()`
- `file_line` encoding issue on ruby 1.8 (unsupported)
- Huge readme refresh

## Supported Release 4.16.0
### Summary

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/defined_with_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# Workaround for PE-20308
if reference.is_a?(String)
type_name, title = Puppet::Resource.type_and_title(reference, nil)
type = Puppet::Type.type(type_name)
type = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(find_global_scope, type_name)
elsif reference.is_a?(Puppet::Resource)
type = reference.resource_type
title = reference.title
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/parser/functions/ensure_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module Puppet::Parser::Functions

Puppet::Parser::Functions.function(:ensure_resource)
packages.each { |package_name|
raise(Puppet::ParseError, 'ensure_packages(): Empty String provided for package name') if package_name.length == 0
if !findresource("Package[#{package_name}]")
function_ensure_resource(['package', package_name, defaults ])
end
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-stdlib",
"version": "4.16.0",
"version": "4.17.0",
"author": "puppetlabs",
"summary": "Standard library of resources for Puppet modules.",
"license": "Apache-2.0",
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/test/manifests/deftype.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define test::deftype($param = 'foo') {
notify { "deftype: $title": }
}
10 changes: 10 additions & 0 deletions spec/functions/defined_with_params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,14 @@
end
end
end

describe 'when passed a defined type' do
let :pre_condition do
'test::deftype { "foo": }'
end
it { is_expected.to run.with_params('Test::Deftype[foo]', {}).and_return(true) }
it { is_expected.to run.with_params('Test::Deftype[bar]', {}).and_return(false) }
it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[foo]'), {}).and_return(true) }
it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[bar]'), {}).and_return(false) }
end
end
8 changes: 8 additions & 0 deletions spec/functions/ensure_packages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
end
end

context 'given an empty packages array' do
let(:pre_condition) { 'notify { "hi": } -> Package <| |>; $somearray = ["vim",""]; ensure_packages($somearray)' }

describe 'after running ensure_package(["vim", ""])' do
it { expect { catalogue }.to raise_error(Puppet::ParseError, /Empty String provided/) }
end
end

context 'given hash of packages' do
before { subject.call([{"foo" => { "provider" => "rpm" }, "bar" => { "provider" => "gem" }}, { "ensure" => "present"}]) }
before { subject.call([{"パッケージ" => { "ensure" => "absent"}}]) }
Expand Down
18 changes: 18 additions & 0 deletions spec/functions/ensure_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
it { expect(lambda { catalogue }).to contain_user('username1').with_ensure('present') }
it { expect(lambda { catalogue }).to contain_user('username1').without_gid }
end

describe 'after running ensure_resource("test::deftype", "foo", {})' do
before { subject.call(['test::deftype', 'foo', {}]) }

# this lambda is required due to strangeness within rspec-puppet's expectation handling
it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
end
end

context 'given a catalog with UTF8 chars' do
Expand Down Expand Up @@ -114,4 +121,15 @@
}
end
end

context 'given a catalog with "test::deftype { foo: }"' do
let(:pre_condition) { 'test::deftype { "foo": }' }

describe 'after running ensure_resource("test::deftype", "foo", {})' do
before { subject.call(['test::deftype', 'foo', {}]) }

# this lambda is required due to strangeness within rspec-puppet's expectation handling
it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
end
end
end