puppet 3.7.5-x64-mingw32 → 3.8.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/ext/build_defaults.yaml +5 -5
  3. data/lib/hiera/puppet_function.rb +15 -4
  4. data/lib/puppet.rb +5 -2
  5. data/lib/puppet/application/agent.rb +5 -0
  6. data/lib/puppet/application/apply.rb +5 -0
  7. data/lib/puppet/application/device.rb +8 -3
  8. data/lib/puppet/application/master.rb +5 -0
  9. data/lib/puppet/defaults.rb +8 -0
  10. data/lib/puppet/error.rb +27 -1
  11. data/lib/puppet/file_system.rb +13 -0
  12. data/lib/puppet/file_system/file19windows.rb +8 -0
  13. data/lib/puppet/file_system/file_impl.rb +4 -0
  14. data/lib/puppet/file_system/memory_impl.rb +4 -0
  15. data/lib/puppet/functions.rb +25 -3
  16. data/lib/puppet/functions/defined.rb +130 -0
  17. data/lib/puppet/functions/hiera_include.rb +1 -1
  18. data/lib/puppet/node/environment.rb +4 -0
  19. data/lib/puppet/parser/compiler.rb +5 -2
  20. data/lib/puppet/parser/functions/defined.rb +26 -1
  21. data/lib/puppet/parser/functions/file.rb +3 -1
  22. data/lib/puppet/parser/templatewrapper.rb +2 -1
  23. data/lib/puppet/pops.rb +5 -0
  24. data/lib/puppet/pops/evaluator/access_operator.rb +25 -5
  25. data/lib/puppet/pops/evaluator/collector_transformer.rb +1 -11
  26. data/lib/puppet/pops/evaluator/compare_operator.rb +43 -0
  27. data/lib/puppet/pops/evaluator/evaluator_impl.rb +43 -28
  28. data/lib/puppet/pops/evaluator/runtime3_support.rb +9 -5
  29. data/lib/puppet/pops/functions/dispatch.rb +6 -1
  30. data/lib/puppet/pops/issue_reporter.rb +42 -16
  31. data/lib/puppet/pops/issues.rb +96 -0
  32. data/lib/puppet/pops/loader/module_loaders.rb +3 -1
  33. data/lib/puppet/pops/loaders.rb +6 -4
  34. data/lib/puppet/pops/migration/migration_checker.rb +45 -0
  35. data/lib/puppet/pops/model/factory.rb +1 -1
  36. data/lib/puppet/pops/model/model_meta.rb +1 -1
  37. data/lib/puppet/pops/parser/egrammar.ra +1 -1
  38. data/lib/puppet/pops/parser/eparser.rb +1 -1
  39. data/lib/puppet/pops/parser/epp_support.rb +18 -9
  40. data/lib/puppet/pops/parser/evaluating_parser.rb +7 -1
  41. data/lib/puppet/pops/parser/heredoc_support.rb +12 -11
  42. data/lib/puppet/pops/parser/interpolation_support.rb +7 -1
  43. data/lib/puppet/pops/parser/lexer2.rb +8 -8
  44. data/lib/puppet/pops/parser/lexer_support.rb +46 -20
  45. data/lib/puppet/pops/parser/parser_support.rb +11 -14
  46. data/lib/puppet/pops/parser/slurp_support.rb +22 -6
  47. data/lib/puppet/pops/types/type_calculator.rb +156 -55
  48. data/lib/puppet/pops/types/type_factory.rb +67 -14
  49. data/lib/puppet/pops/types/type_parser.rb +22 -13
  50. data/lib/puppet/pops/types/types.rb +21 -3
  51. data/lib/puppet/pops/types/types_meta.rb +13 -2
  52. data/lib/puppet/pops/validation.rb +25 -2
  53. data/lib/puppet/pops/validation/checker4_0.rb +25 -5
  54. data/lib/puppet/provider/group/windows_adsi.rb +18 -6
  55. data/lib/puppet/provider/mount/parsed.rb +145 -2
  56. data/lib/puppet/provider/package/pip.rb +4 -5
  57. data/lib/puppet/provider/package/zypper.rb +17 -7
  58. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +35 -10
  59. data/lib/puppet/provider/service/init.rb +7 -0
  60. data/lib/puppet/provider/user/windows_adsi.rb +8 -1
  61. data/lib/puppet/provider/zpool/zpool.rb +7 -2
  62. data/lib/puppet/resource.rb +1 -1
  63. data/lib/puppet/type/group.rb +1 -1
  64. data/lib/puppet/type/mount.rb +14 -3
  65. data/lib/puppet/type/scheduled_task.rb +21 -6
  66. data/lib/puppet/util/log.rb +50 -8
  67. data/lib/puppet/util/log/destinations.rb +23 -2
  68. data/lib/puppet/util/logging.rb +37 -1
  69. data/lib/puppet/util/windows/adsi.rb +36 -11
  70. data/lib/puppet/version.rb +1 -1
  71. data/spec/fixtures/unit/provider/mount/parsed/aix.filesystems +93 -85
  72. data/spec/fixtures/unit/provider/mount/parsed/aix.mount +11 -7
  73. data/spec/integration/parser/collector_spec.rb +7 -0
  74. data/spec/integration/parser/future_compiler_spec.rb +9 -0
  75. data/spec/integration/parser/resource_expressions_spec.rb +3 -0
  76. data/spec/unit/file_system_spec.rb +38 -0
  77. data/spec/unit/functions/defined_spec.rb +291 -0
  78. data/spec/unit/functions/hiera_spec.rb +8 -6
  79. data/spec/unit/functions4_spec.rb +97 -2
  80. data/spec/unit/parser/functions/file_spec.rb +8 -2
  81. data/spec/unit/parser/functions/template_spec.rb +1 -1
  82. data/spec/unit/parser/templatewrapper_spec.rb +1 -1
  83. data/spec/unit/pops/evaluator/access_ops_spec.rb +19 -0
  84. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +61 -8
  85. data/spec/unit/pops/issues_spec.rb +16 -16
  86. data/spec/unit/pops/loaders/module_loaders_spec.rb +5 -0
  87. data/spec/unit/pops/migration_spec.rb +180 -0
  88. data/spec/unit/pops/parser/lexer2_spec.rb +152 -1
  89. data/spec/unit/pops/parser/parse_heredoc_spec.rb +26 -0
  90. data/spec/unit/pops/transformer/transform_calls_spec.rb +1 -1
  91. data/spec/unit/pops/types/type_calculator_spec.rb +204 -11
  92. data/spec/unit/pops/validation_spec.rb +66 -0
  93. data/spec/unit/provider/group/windows_adsi_spec.rb +65 -1
  94. data/spec/unit/provider/mount/parsed_spec.rb +31 -5
  95. data/spec/unit/provider/package/pip_spec.rb +19 -7
  96. data/spec/unit/provider/package/zypper_spec.rb +25 -14
  97. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +312 -70
  98. data/spec/unit/provider/service/base_spec.rb +42 -31
  99. data/spec/unit/provider/service/freebsd_spec.rb +1 -0
  100. data/spec/unit/provider/service/gentoo_spec.rb +1 -0
  101. data/spec/unit/provider/service/init_spec.rb +18 -0
  102. data/spec/unit/provider/service/openbsd_spec.rb +1 -0
  103. data/spec/unit/provider/service/redhat_spec.rb +1 -0
  104. data/spec/unit/provider/user/windows_adsi_spec.rb +21 -0
  105. data/spec/unit/provider/zpool/zpool_spec.rb +47 -10
  106. data/spec/unit/util/log_spec.rb +113 -0
  107. data/spec/unit/util/windows/adsi_spec.rb +106 -26
  108. metadata +10 -2
@@ -0,0 +1,291 @@
1
+ #! /usr/bin/env ruby
2
+ require 'spec_helper'
3
+ require 'puppet/pops'
4
+ require 'puppet/loaders'
5
+
6
+ describe "the 'defined' function" do
7
+ after(:all) { Puppet::Pops::Loaders.clear }
8
+
9
+ # This loads the function once and makes it easy to call it
10
+ # It does not matter that it is not bound to the env used later since the function
11
+ # looks up everything via the scope that is given to it.
12
+ # The individual tests needs to have a fresh env/catalog set up
13
+ #
14
+ let(:loaders) { Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, [])) }
15
+ let(:func) { loaders.puppet_system_loader.load(:function, 'defined') }
16
+
17
+ before :each do
18
+ # This is only for the 4.x version of the defined function
19
+ Puppet[:parser] = 'future'
20
+ # A fresh environment is needed for each test since tests creates types and resources
21
+ environment = Puppet::Node::Environment.create(:testing, [])
22
+ @node = Puppet::Node.new('yaynode', :environment => environment)
23
+ @known_resource_types = environment.known_resource_types
24
+ @compiler = Puppet::Parser::Compiler.new(@node)
25
+ @scope = Puppet::Parser::Scope.new(@compiler)
26
+ end
27
+
28
+ def newclass(name)
29
+ @known_resource_types.add Puppet::Resource::Type.new(:hostclass, name)
30
+ end
31
+
32
+ def newdefine(name)
33
+ @known_resource_types.add Puppet::Resource::Type.new(:definition, name)
34
+ end
35
+
36
+ def newresource(type, title)
37
+ resource = Puppet::Resource.new(type, title)
38
+ @compiler.add_resource(@scope, resource)
39
+ resource
40
+ end
41
+
42
+ #--- CLASS
43
+ #
44
+ context 'can determine if a class' do
45
+ context 'is defined' do
46
+
47
+ it 'by using the class name in string form' do
48
+ newclass 'yayness'
49
+ expect(func.call(@scope, 'yayness')).to be_true
50
+ end
51
+
52
+ it 'by using a Type[Class[name]] type reference' do
53
+ name = 'yayness'
54
+ newclass name
55
+ class_type = Puppet::Pops::Types::TypeFactory.host_class(name)
56
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(class_type)
57
+ expect(func.call(@scope, type_type)).to be_true
58
+ end
59
+ end
60
+
61
+ context 'is not defined' do
62
+ it 'by using the class name in string form' do
63
+ expect(func.call(@scope, 'yayness')).to be_false
64
+ end
65
+
66
+ it 'even if there is a define, by using a Type[Class[name]] type reference' do
67
+ name = 'yayness'
68
+ newdefine name
69
+ class_type = Puppet::Pops::Types::TypeFactory.host_class(name)
70
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(class_type)
71
+ expect(func.call(@scope, type_type)).to be_false
72
+ end
73
+ end
74
+
75
+ context 'is defined and realized' do
76
+ it 'by using a Class[name] reference' do
77
+ name = 'cowabunga'
78
+ newclass name
79
+ newresource(:class, name)
80
+ class_type = Puppet::Pops::Types::TypeFactory.host_class(name)
81
+ expect(func.call(@scope, class_type)).to be_true
82
+ end
83
+ end
84
+
85
+ context 'is not realized' do
86
+ it '(although defined) by using a Class[name] reference' do
87
+ name = 'cowabunga'
88
+ newclass name
89
+ class_type = Puppet::Pops::Types::TypeFactory.host_class(name)
90
+ expect(func.call(@scope, class_type)).to be_false
91
+ end
92
+
93
+ it '(and not defined) by using a Class[name] reference' do
94
+ name = 'cowabunga'
95
+ class_type = Puppet::Pops::Types::TypeFactory.host_class(name)
96
+ expect(func.call(@scope, class_type)).to be_false
97
+ end
98
+ end
99
+ end
100
+
101
+ #---RESOURCE TYPE
102
+ #
103
+ context 'can determine if a resource type' do
104
+ context 'is defined' do
105
+
106
+ it 'by using the type name (of a built in type) in string form' do
107
+ expect(func.call(@scope, 'file')).to be_true
108
+ end
109
+
110
+ it 'by using the type name (of a resource type) in string form' do
111
+ newdefine 'yayness'
112
+ expect(func.call(@scope, 'yayness')).to be_true
113
+ end
114
+
115
+ it 'by using a File type reference (built in type)' do
116
+ resource_type = Puppet::Pops::Types::TypeFactory.resource('file')
117
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(resource_type)
118
+ expect(func.call(@scope, type_type)).to be_true
119
+ end
120
+
121
+ it 'by using a Type[File] type reference' do
122
+ resource_type = Puppet::Pops::Types::TypeFactory.resource('file')
123
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(resource_type)
124
+ expect(func.call(@scope, type_type)).to be_true
125
+ end
126
+
127
+ it 'by using a Resource[T] type reference (defined type)' do
128
+ name = 'yayness'
129
+ newdefine name
130
+ resource_type = Puppet::Pops::Types::TypeFactory.resource(name)
131
+ expect(func.call(@scope, resource_type)).to be_true
132
+ end
133
+
134
+ it 'by using a Type[Resource[T]] type reference (defined type)' do
135
+ name = 'yayness'
136
+ newdefine name
137
+ resource_type = Puppet::Pops::Types::TypeFactory.resource(name)
138
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(resource_type)
139
+ expect(func.call(@scope, type_type)).to be_true
140
+ end
141
+ end
142
+
143
+ context 'is not defined' do
144
+ it 'by using the resource name in string form' do
145
+ expect(func.call(@scope, 'notatype')).to be_false
146
+ end
147
+
148
+ it 'even if there is a class with the same name, by using a Type[Resource[T]] type reference' do
149
+ name = 'yayness'
150
+ newclass name
151
+ resource_type = Puppet::Pops::Types::TypeFactory.resource(name)
152
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(resource_type)
153
+ expect(func.call(@scope, type_type)).to be_false
154
+ end
155
+ end
156
+
157
+ context 'is defined and instance realized' do
158
+ it 'by using a Resource[T, title] reference for a built in type' do
159
+ type_name = 'file'
160
+ title = '/tmp/myfile'
161
+ newdefine type_name
162
+ newresource(type_name, title)
163
+ class_type = Puppet::Pops::Types::TypeFactory.resource(type_name, title)
164
+ expect(func.call(@scope, class_type)).to be_true
165
+ end
166
+
167
+ it 'by using a Resource[T, title] reference for a defined type' do
168
+ type_name = 'meme'
169
+ title = 'cowabunga'
170
+ newdefine type_name
171
+ newresource(type_name, title)
172
+ class_type = Puppet::Pops::Types::TypeFactory.resource(type_name, title)
173
+ expect(func.call(@scope, class_type)).to be_true
174
+ end
175
+ end
176
+
177
+ context 'is not realized' do
178
+ it '(although defined) by using a Resource[T, title] reference or Type[Resource[T, title]] reference' do
179
+ type_name = 'meme'
180
+ title = 'cowabunga'
181
+ newdefine type_name
182
+ resource_type = Puppet::Pops::Types::TypeFactory.resource(type_name, title)
183
+ expect(func.call(@scope, resource_type)).to be_false
184
+
185
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(resource_type)
186
+ expect(func.call(@scope, type_type)).to be_false
187
+ end
188
+
189
+ it '(and not defined) by using a Resource[T, title] reference or Type[Resource[T, title]] reference' do
190
+ type_name = 'meme'
191
+ title = 'cowabunga'
192
+ resource_type = Puppet::Pops::Types::TypeFactory.resource(type_name, title)
193
+ expect(func.call(@scope, resource_type)).to be_false
194
+
195
+ type_type = Puppet::Pops::Types::TypeFactory.type_type(resource_type)
196
+ expect(func.call(@scope, type_type)).to be_false
197
+ end
198
+ end
199
+ end
200
+
201
+ #---VARIABLES
202
+ #
203
+ context 'can determine if a variable' do
204
+ context 'is defined' do
205
+ it 'by giving the variable in string form' do
206
+ @scope['x'] = 'something'
207
+ expect(func.call(@scope, '$x')).to be_true
208
+ end
209
+
210
+ it 'by giving a :: prefixed variable in string form' do
211
+ @compiler.topscope['x'] = 'something'
212
+ expect(func.call(@scope, '$::x')).to be_true
213
+ end
214
+
215
+ it 'by giving a numeric variable in string form (when there is a match scope)' do
216
+ # with no match scope, there are no numeric variables defined
217
+ expect(func.call(@scope, '$0')).to be_false
218
+ expect(func.call(@scope, '$42')).to be_false
219
+ pattern = Regexp.new('.*')
220
+ @scope.new_match_scope(pattern.match('anything'))
221
+
222
+ # with a match scope, all numeric variables are set (the match defines if they have a value or not, but they are defined)
223
+ # even if their value is undef.
224
+ expect(func.call(@scope, '$0')).to be_true
225
+ expect(func.call(@scope, '$42')).to be_true
226
+ end
227
+ end
228
+
229
+ context 'is undefined' do
230
+ it 'by giving a :: prefixed or regular variable in string form' do
231
+ expect(func.call(@scope, '$x')).to be_false
232
+ expect(func.call(@scope, '$::x')).to be_false
233
+ end
234
+ end
235
+ end
236
+
237
+ context 'has any? semantics when given multiple arguments' do
238
+ it 'and one of the names is a defined user defined type' do
239
+ newdefine 'yayness'
240
+ expect(func.call(@scope, 'meh', 'yayness', 'booness')).to be_true
241
+ end
242
+
243
+ it 'and one of the names is a built type' do
244
+ expect(func.call(@scope, 'meh', 'file', 'booness')).to be_true
245
+ end
246
+
247
+ it 'and one of the names is a defined class' do
248
+ newclass 'yayness'
249
+ expect(func.call(@scope, 'meh', 'yayness', 'booness')).to be_true
250
+ end
251
+
252
+ it 'is true when at least one variable exists in scope' do
253
+ @scope['x'] = 'something'
254
+ expect(func.call(@scope, '$y', '$x', '$z')).to be_true
255
+ end
256
+
257
+ it 'is false when none of the names are defined' do
258
+ expect(func.call(@scope, 'meh', 'yayness', 'booness')).to be_false
259
+ end
260
+ end
261
+
262
+ it 'raises an argument error when asking if Resource type is defined' do
263
+ resource_type = Puppet::Pops::Types::TypeFactory.resource
264
+ expect { func.call(@scope, resource_type)}.to raise_error(ArgumentError, /reference to all.*type/)
265
+ end
266
+
267
+ it 'raises an argument error if you ask if Class is defined' do
268
+ class_type = Puppet::Pops::Types::TypeFactory.host_class
269
+ expect { func.call(@scope, class_type) }.to raise_error(ArgumentError, /reference to all.*class/)
270
+ end
271
+
272
+ it 'raises error if referencing undef' do
273
+ expect{func.call(@scope, nil)}.to raise_error(ArgumentError, /mis-matched arguments/)
274
+ end
275
+
276
+ it 'raises error if referencing a number' do
277
+ expect{func.call(@scope, 42)}.to raise_error(ArgumentError, /mis-matched arguments/)
278
+ end
279
+
280
+ it 'is false if referencing empty string' do
281
+ expect(func.call(@scope, '')).to be_false
282
+ end
283
+
284
+ it "is true if referencing 'main'" do
285
+ # mimic what compiler does with "main" in intial import
286
+ newclass ''
287
+ newresource :class, ''
288
+ expect(func.call(@scope, 'main')).to be_true
289
+ end
290
+
291
+ end
@@ -26,18 +26,20 @@ describe 'when calling' do
26
26
  expect(hiera.call(scope, 'key')).to eql('foo_result')
27
27
  end
28
28
 
29
- it 'should propagate optional default' do
30
- dflt = 'the_default'
31
- Hiera.any_instance.expects(:lookup).with { |*args| args[1].should be(dflt) }.returns('foo_result')
32
- expect(hiera.call(scope, 'key', dflt)).to eql('foo_result')
33
- end
34
-
35
29
  it 'should propagate optional override' do
36
30
  ovr = 'the_override'
37
31
  Hiera.any_instance.expects(:lookup).with { |*args| args[3].should be(ovr) }.returns('foo_result')
38
32
  expect(hiera.call(scope, 'key', nil, ovr)).to eql('foo_result')
39
33
  end
40
34
 
35
+ it 'should return default value nil when key is not found' do
36
+ expect(hiera.call(scope, 'foo', nil)).to be_nil
37
+ end
38
+
39
+ it "should return default value '' when key is not found" do
40
+ expect(hiera.call(scope, 'foo', '')).to eq('')
41
+ end
42
+
41
43
  it 'should use default block' do
42
44
  #expect(hiera.call(scope, 'foo', lambda_1(scope, loader) { |k| "default for key '#{k}'" })).to eql("default for key 'foo'")
43
45
  expect(hiera.call(scope, 'foo') { |k| "default for key '#{k}'" }).to eql("default for key 'foo'")
@@ -177,7 +177,7 @@ actual:
177
177
  end
178
178
 
179
179
  it 'an error includes optional indicators and count for last element when defined via dispatch' do
180
- f = create_function_with_optionals_and_varargs_via_dispatch()
180
+ f = create_function_with_optionals_and_repeated_via_dispatch()
181
181
  # TODO: Bogus parameters, not yet used
182
182
  func = f.new(:closure_scope, :loader)
183
183
  expect(func.is_a?(Puppet::Functions::Function)).to be_true
@@ -191,6 +191,39 @@ actual:
191
191
  min(Integer) - arg count {1}")
192
192
  end
193
193
 
194
+ it 'can create optional repeated parameter' do
195
+ f = create_function_with_repeated
196
+ func = f.new(:closure_scope, :loader)
197
+ expect(func.call({})).to eql(0)
198
+ expect(func.call({}, 1)).to eql(1)
199
+ expect(func.call({}, 1, 2)).to eql(2)
200
+
201
+ f = create_function_with_optional_repeated
202
+ func = f.new(:closure_scope, :loader)
203
+ expect(func.call({})).to eql(0)
204
+ expect(func.call({}, 1)).to eql(1)
205
+ expect(func.call({}, 1, 2)).to eql(2)
206
+ end
207
+
208
+ it 'can create required repeated parameter' do
209
+ f = create_function_with_required_repeated
210
+ func = f.new(:closure_scope, :loader)
211
+ expect(func.call({}, 1)).to eql(1)
212
+ expect(func.call({}, 1, 2)).to eql(2)
213
+ expect { func.call({}) }.to raise_error(ArgumentError,
214
+ "function 'count_args' called with mis-matched arguments
215
+ expected:
216
+ count_args(Any c{1,}) - arg count {1,}
217
+ actual:
218
+ count_args(Undef{0}) - arg count {0}")
219
+ end
220
+
221
+ it 'can create scope_param followed by repeated parameter' do
222
+ f = create_function_with_scope_param_required_repeat
223
+ func = f.new(:closure_scope, :loader)
224
+ expect(func.call({}, 'yay', 1,2,3)).to eql([{}, 'yay',1,2,3])
225
+ end
226
+
194
227
  it 'a function can use inexact argument mapping' do
195
228
  f = create_function_with_inexact_dispatch
196
229
  func = f.new(:closure_scope, :loader)
@@ -213,6 +246,10 @@ actual:
213
246
  expect { create_function_with_rq_after_opt }.to raise_error(ArgumentError, 'A required parameter cannot be added after an optional parameter')
214
247
  end
215
248
 
249
+ it 'a function can not be created with required repeated parameters declared after optional ones' do
250
+ expect { create_function_with_rq_repeated_after_opt }.to raise_error(ArgumentError, 'A required repeated parameter cannot be added after an optional parameter')
251
+ end
252
+
216
253
  it 'an error is raised with reference to multiple methods when called with mis-matched arguments' do
217
254
  f = create_min_function_class_disptaching_to_two_methods()
218
255
  # TODO: Bogus parameters, not yet used
@@ -563,7 +600,7 @@ actual:
563
600
  end
564
601
  end
565
602
 
566
- def create_function_with_optionals_and_varargs_via_dispatch
603
+ def create_function_with_optionals_and_repeated_via_dispatch
567
604
  f = Puppet::Functions.create_function('min') do
568
605
  dispatch :min do
569
606
  param 'Numeric', :x
@@ -578,6 +615,39 @@ actual:
578
615
  end
579
616
  end
580
617
 
618
+ def create_function_with_repeated
619
+ f = Puppet::Functions.create_function('count_args') do
620
+ dispatch :count_args do
621
+ repeated_param 'Any', :c
622
+ end
623
+ def count_args(*c)
624
+ c.size
625
+ end
626
+ end
627
+ end
628
+
629
+ def create_function_with_optional_repeated
630
+ f = Puppet::Functions.create_function('count_args') do
631
+ dispatch :count_args do
632
+ optional_repeated_param 'Any', :c
633
+ end
634
+ def count_args(*c)
635
+ c.size
636
+ end
637
+ end
638
+ end
639
+
640
+ def create_function_with_required_repeated
641
+ f = Puppet::Functions.create_function('count_args') do
642
+ dispatch :count_args do
643
+ required_repeated_param 'Any', :c
644
+ end
645
+ def count_args(*c)
646
+ c.size
647
+ end
648
+ end
649
+ end
650
+
581
651
  def create_function_with_inexact_dispatch
582
652
  f = Puppet::Functions.create_function('t1') do
583
653
  dispatch :t1 do
@@ -608,6 +678,18 @@ actual:
608
678
  end
609
679
  end
610
680
 
681
+ def create_function_with_rq_repeated_after_opt
682
+ f = Puppet::Functions.create_function('t1') do
683
+ dispatch :t1 do
684
+ optional_param 'Numeric', :x
685
+ required_repeated_param 'Numeric', :y
686
+ end
687
+ def t1(x, *y)
688
+ x
689
+ end
690
+ end
691
+ end
692
+
611
693
  def create_function_with_param_after_repeated
612
694
  f = Puppet::Functions.create_function('t1') do
613
695
  dispatch :t1 do
@@ -692,6 +774,19 @@ actual:
692
774
  end
693
775
  end
694
776
 
777
+ def create_function_with_scope_param_required_repeat
778
+ f = Puppet::Functions.create_function('test', Puppet::Functions::InternalFunction) do
779
+ dispatch :test do
780
+ scope_param
781
+ param 'Any', 'extra'
782
+ repeated_param 'Any', 'the_block'
783
+ end
784
+ def test(scope, *args)
785
+ [scope, *args]
786
+ end
787
+ end
788
+ end
789
+
695
790
  def create_function_with_required_block_given_type
696
791
  f = Puppet::Functions.create_function('test') do
697
792
  dispatch :test do