Skip to content

Commit 1862076

Browse files
authored
Merge pull request #776 from puppetlabs/release
Merge back 4.17.0
2 parents 052d55b + 51fd72c commit 1862076

File tree

8 files changed

+56
-2
lines changed

8 files changed

+56
-2
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## Supported Release 4.17.0
2+
### Summary
3+
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.
4+
5+
#### Features
6+
- Addition of POT file / folder structure for i18n.
7+
- Addition of Internationalized READMEs.
8+
- `glob()` function
9+
10+
### Fixed
11+
- Occasional duplicate type definitions when using `defined_with_params()`
12+
- `file_line` encoding issue on ruby 1.8 (unsupported)
13+
- Huge readme refresh
14+
115
## Supported Release 4.16.0
216
### Summary
317

lib/puppet/parser/functions/defined_with_params.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# Workaround for PE-20308
3030
if reference.is_a?(String)
3131
type_name, title = Puppet::Resource.type_and_title(reference, nil)
32-
type = Puppet::Type.type(type_name)
32+
type = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(find_global_scope, type_name)
3333
elsif reference.is_a?(Puppet::Resource)
3434
type = reference.resource_type
3535
title = reference.title

lib/puppet/parser/functions/ensure_packages.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module Puppet::Parser::Functions
3636

3737
Puppet::Parser::Functions.function(:ensure_resource)
3838
packages.each { |package_name|
39+
raise(Puppet::ParseError, 'ensure_packages(): Empty String provided for package name') if package_name.length == 0
3940
if !findresource("Package[#{package_name}]")
4041
function_ensure_resource(['package', package_name, defaults ])
4142
end

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-stdlib",
3-
"version": "4.16.0",
3+
"version": "4.17.0",
44
"author": "puppetlabs",
55
"summary": "Standard library of resources for Puppet modules.",
66
"license": "Apache-2.0",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
define test::deftype($param = 'foo') {
2+
notify { "deftype: $title": }
3+
}

spec/functions/defined_with_params_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,14 @@
5555
end
5656
end
5757
end
58+
59+
describe 'when passed a defined type' do
60+
let :pre_condition do
61+
'test::deftype { "foo": }'
62+
end
63+
it { is_expected.to run.with_params('Test::Deftype[foo]', {}).and_return(true) }
64+
it { is_expected.to run.with_params('Test::Deftype[bar]', {}).and_return(false) }
65+
it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[foo]'), {}).and_return(true) }
66+
it { is_expected.to run.with_params(Puppet::Resource.new('Test::Deftype[bar]'), {}).and_return(false) }
67+
end
5868
end

spec/functions/ensure_packages_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
end
3535
end
3636

37+
context 'given an empty packages array' do
38+
let(:pre_condition) { 'notify { "hi": } -> Package <| |>; $somearray = ["vim",""]; ensure_packages($somearray)' }
39+
40+
describe 'after running ensure_package(["vim", ""])' do
41+
it { expect { catalogue }.to raise_error(Puppet::ParseError, /Empty String provided/) }
42+
end
43+
end
44+
3745
context 'given hash of packages' do
3846
before { subject.call([{"foo" => { "provider" => "rpm" }, "bar" => { "provider" => "gem" }}, { "ensure" => "present"}]) }
3947
before { subject.call([{"パッケージ" => { "ensure" => "absent"}}]) }

spec/functions/ensure_resource_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838
it { expect(lambda { catalogue }).to contain_user('username1').with_ensure('present') }
3939
it { expect(lambda { catalogue }).to contain_user('username1').without_gid }
4040
end
41+
42+
describe 'after running ensure_resource("test::deftype", "foo", {})' do
43+
before { subject.call(['test::deftype', 'foo', {}]) }
44+
45+
# this lambda is required due to strangeness within rspec-puppet's expectation handling
46+
it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
47+
end
4148
end
4249

4350
context 'given a catalog with UTF8 chars' do
@@ -114,4 +121,15 @@
114121
}
115122
end
116123
end
124+
125+
context 'given a catalog with "test::deftype { foo: }"' do
126+
let(:pre_condition) { 'test::deftype { "foo": }' }
127+
128+
describe 'after running ensure_resource("test::deftype", "foo", {})' do
129+
before { subject.call(['test::deftype', 'foo', {}]) }
130+
131+
# this lambda is required due to strangeness within rspec-puppet's expectation handling
132+
it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
133+
end
134+
end
117135
end

0 commit comments

Comments
 (0)