Skip to content

Commit 46aa687

Browse files
authored
Merge pull request #304 from seanmil/fix_simple_get_filter_instantiation
Fix instances method with simple_get_filter
2 parents e551ef4 + ecefc34 commit 46aa687

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

lib/puppet/resource_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def self.instances
248248
provider(type_definition.name)
249249

250250
initial_fetch = if type_definition.feature?('simple_get_filter')
251-
my_provider.get(context, [])
251+
my_provider.get(context, nil)
252252
else
253253
my_provider.get(context)
254254
end

spec/acceptance/composite_namevar_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
it 'is returns the values correctly' do
1212
stdout_str, status = Open3.capture2e("puppet resource #{common_args} composite_namevar")
1313
expect(stdout_str.strip).to match %r{^composite_namevar}
14-
expect(stdout_str.strip).to match %r{Looking for \[\]}
14+
expect(stdout_str.strip).to match %r{Looking for nil}
1515
expect(status).to eq 0
1616
end
1717
it 'returns the required resource correctly' do
@@ -20,7 +20,7 @@
2020
expect(stdout_str.strip).to match %r{ensure\s*=> \'present\'}
2121
expect(stdout_str.strip).to match %r{package\s*=> \'php\'}
2222
expect(stdout_str.strip).to match %r{manager\s*=> \'yum\'}
23-
expect(stdout_str.strip).to match %r{Looking for \[\]}
23+
expect(stdout_str.strip).to match %r{Looking for nil}
2424
expect(status.exitstatus).to eq 0
2525
end
2626
it 'throws error if title is not a matching title_pattern' do

spec/fixtures/test_module/lib/puppet/provider/test_simple_get_filter/test_simple_get_filter.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
# Implementation for the test_simple_get_filter type using the Resource API.
55
class Puppet::Provider::TestSimpleGetFilter::TestSimpleGetFilter < Puppet::ResourceApi::SimpleProvider
66
def get(_context, names = nil)
7-
raise Puppet::DevError, 'names parameter must be provided to TestSimpleGetFilter#get()' if names.nil?
8-
9-
result = if names.empty?
7+
result = if names.nil?
108
# rather than fething everything from your large dataset, return a subset of the data that you are happy to show.
119
# This will be cached by Puppet. If a resource requested exists in the cache, then no futher calls are made to the provider.
1210
[{

spec/puppet/resource_api_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ def set(_context, changes) end
21962196
end
21972197

21982198
it 'passes through the an empty array to `get`' do
2199-
expect(provider).to receive(:get).with(anything, []).and_return([])
2199+
expect(provider).to receive(:get).with(anything, nil).and_return([])
22002200
type.instances
22012201
end
22022202

0 commit comments

Comments
 (0)