puppet 4.7.1-universal-darwin → 4.8.0-universal-darwin
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.
- data/Gemfile +0 -3
- data/MAINTAINERS +76 -0
- data/README.md +0 -6
- data/Rakefile +2 -2
- data/lib/puppet/agent.rb +3 -3
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/configurer.rb +2 -2
- data/lib/puppet/data_providers.rb +1 -0
- data/lib/puppet/data_providers/data_adapter.rb +1 -0
- data/lib/puppet/data_providers/data_function_support.rb +1 -0
- data/lib/puppet/data_providers/function_env_data_provider.rb +1 -0
- data/lib/puppet/data_providers/function_module_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_config.rb +1 -0
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +1 -0
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_support.rb +1 -2
- data/lib/puppet/data_providers/json_data_provider_factory.rb +2 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +2 -0
- data/lib/puppet/defaults.rb +20 -1
- data/lib/puppet/environments.rb +5 -2
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/epp.rb +57 -11
- data/lib/puppet/face/module/install.rb +6 -6
- data/lib/puppet/functions.rb +23 -24
- data/lib/puppet/functions/alert.rb +14 -0
- data/lib/puppet/functions/binary_file.rb +25 -0
- data/lib/puppet/functions/break.rb +22 -0
- data/lib/puppet/functions/contain.rb +33 -0
- data/lib/puppet/functions/crit.rb +14 -0
- data/lib/puppet/functions/debug.rb +14 -0
- data/lib/puppet/functions/emerg.rb +14 -0
- data/lib/puppet/functions/epp.rb +1 -1
- data/lib/puppet/functions/err.rb +14 -0
- data/lib/puppet/functions/find_file.rb +31 -0
- data/lib/puppet/functions/include.rb +21 -0
- data/lib/puppet/functions/info.rb +14 -0
- data/lib/puppet/functions/new.rb +1 -1
- data/lib/puppet/functions/next.rb +23 -0
- data/lib/puppet/functions/notice.rb +14 -0
- data/lib/puppet/functions/regsubst.rb +12 -16
- data/lib/puppet/functions/require.rb +37 -0
- data/lib/puppet/functions/return.rb +22 -0
- data/lib/puppet/functions/strftime.rb +35 -0
- data/lib/puppet/functions/warning.rb +14 -0
- data/lib/puppet/generate/models/type/type.rb +4 -0
- data/lib/puppet/generate/templates/type/pcore.erb +2 -1
- data/lib/puppet/indirector/face.rb +6 -1
- data/lib/puppet/network/http/error.rb +2 -2
- data/lib/puppet/network/http/handler.rb +2 -2
- data/lib/puppet/node/environment.rb +11 -0
- data/lib/puppet/parser/ast.rb +5 -0
- data/lib/puppet/parser/ast/pops_bridge.rb +17 -4
- data/lib/puppet/parser/compiler.rb +29 -1
- data/lib/puppet/parser/functions.rb +6 -0
- data/lib/puppet/parser/functions/assert_type.rb +1 -1
- data/lib/puppet/parser/functions/binary_file.rb +24 -0
- data/lib/puppet/parser/functions/break.rb +39 -0
- data/lib/puppet/parser/functions/contain.rb +7 -15
- data/lib/puppet/parser/functions/defined.rb +2 -2
- data/lib/puppet/parser/functions/dig.rb +1 -1
- data/lib/puppet/parser/functions/each.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +2 -2
- data/lib/puppet/parser/functions/filter.rb +1 -1
- data/lib/puppet/parser/functions/find_file.rb +28 -0
- data/lib/puppet/parser/functions/hiera.rb +4 -4
- data/lib/puppet/parser/functions/hiera_array.rb +1 -1
- data/lib/puppet/parser/functions/hiera_hash.rb +1 -1
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/include.rb +4 -8
- data/lib/puppet/parser/functions/inline_epp.rb +1 -1
- data/lib/puppet/parser/functions/lest.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +4 -2
- data/lib/puppet/parser/functions/map.rb +1 -1
- data/lib/puppet/parser/functions/match.rb +1 -1
- data/lib/puppet/parser/functions/new.rb +414 -18
- data/lib/puppet/parser/functions/next.rb +38 -0
- data/lib/puppet/parser/functions/reduce.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +4 -2
- data/lib/puppet/parser/functions/require.rb +4 -27
- data/lib/puppet/parser/functions/return.rb +71 -0
- data/lib/puppet/parser/functions/reverse_each.rb +1 -1
- data/lib/puppet/parser/functions/scanf.rb +13 -8
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/functions/split.rb +1 -1
- data/lib/puppet/parser/functions/step.rb +1 -1
- data/lib/puppet/parser/functions/strftime.rb +185 -0
- data/lib/puppet/parser/functions/then.rb +1 -1
- data/lib/puppet/parser/functions/type.rb +1 -1
- data/lib/puppet/parser/functions/with.rb +3 -3
- data/lib/puppet/parser/resource.rb +8 -5
- data/lib/puppet/parser/scope.rb +1 -1
- data/lib/puppet/plugins/configuration.rb +8 -0
- data/lib/puppet/plugins/data_providers.rb +1 -0
- data/lib/puppet/plugins/data_providers/data_provider.rb +7 -28
- data/lib/puppet/plugins/data_providers/registry.rb +1 -0
- data/lib/puppet/pops.rb +4 -0
- data/lib/puppet/pops/evaluator/access_operator.rb +36 -5
- data/lib/puppet/pops/evaluator/closure.rb +81 -12
- data/lib/puppet/pops/evaluator/compare_operator.rb +24 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +29 -5
- data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +53 -62
- data/lib/puppet/pops/evaluator/runtime3_support.rb +15 -6
- data/lib/puppet/pops/functions/dispatch.rb +9 -2
- data/lib/puppet/pops/functions/dispatcher.rb +3 -1
- data/lib/puppet/pops/functions/function.rb +19 -2
- data/lib/puppet/pops/issues.rb +9 -0
- data/lib/puppet/pops/label_provider.rb +2 -2
- data/lib/puppet/pops/loader/loader.rb +17 -0
- data/lib/puppet/pops/loader/static_loader.rb +0 -41
- data/lib/puppet/pops/lookup.rb +12 -0
- data/lib/puppet/pops/lookup/context.rb +86 -0
- data/lib/puppet/pops/lookup/explainer.rb +46 -6
- data/lib/puppet/pops/lookup/invocation.rb +19 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +20 -8
- data/lib/puppet/pops/model/model_label_provider.rb +3 -0
- data/lib/puppet/pops/model/model_meta.rb +2 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +14 -0
- data/lib/puppet/pops/parser/egrammar.ra +11 -6
- data/lib/puppet/pops/parser/eparser.rb +1112 -1086
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
- data/lib/puppet/pops/pcore.rb +1 -0
- data/lib/puppet/pops/puppet_stack.rb +3 -3
- data/lib/puppet/pops/resource/param.rb +5 -1
- data/lib/puppet/pops/resource/resource_type_impl.rb +8 -4
- data/lib/puppet/pops/resource/resource_type_set.pcore +1 -0
- data/lib/puppet/pops/serialization/abstract_reader.rb +19 -2
- data/lib/puppet/pops/serialization/abstract_writer.rb +16 -3
- data/lib/puppet/pops/serialization/deserializer.rb +5 -1
- data/lib/puppet/pops/serialization/extension.rb +2 -0
- data/lib/puppet/pops/serialization/json.rb +76 -26
- data/lib/puppet/pops/serialization/serializer.rb +5 -1
- data/lib/puppet/pops/serialization/time_factory.rb +2 -1
- data/lib/puppet/pops/time/timespan.rb +718 -0
- data/lib/puppet/pops/time/timestamp.rb +148 -0
- data/lib/puppet/pops/types/p_binary_type.rb +220 -0
- data/lib/puppet/pops/types/p_object_type.rb +12 -6
- data/lib/puppet/pops/types/p_sensitive_type.rb +5 -1
- data/lib/puppet/pops/types/p_timespan_type.rb +141 -0
- data/lib/puppet/pops/types/p_timestamp_type.rb +69 -0
- data/lib/puppet/pops/types/string_converter.rb +62 -0
- data/lib/puppet/pops/types/type_asserter.rb +1 -1
- data/lib/puppet/pops/types/type_calculator.rb +17 -3
- data/lib/puppet/pops/types/type_factory.rb +35 -1
- data/lib/puppet/pops/types/type_formatter.rb +64 -11
- data/lib/puppet/pops/types/type_mismatch_describer.rb +110 -61
- data/lib/puppet/pops/types/type_parser.rb +18 -4
- data/lib/puppet/pops/types/types.rb +98 -63
- data/lib/puppet/pops/validation.rb +9 -1
- data/lib/puppet/pops/validation/checker4_0.rb +7 -0
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/provider.rb +3 -6
- data/lib/puppet/provider/mcx/mcxcontent.rb +1 -1
- data/lib/puppet/provider/mount/parsed.rb +18 -4
- data/lib/puppet/provider/nameservice/directoryservice.rb +15 -7
- data/lib/puppet/provider/package/gem.rb +6 -1
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkg.rb +5 -1
- data/lib/puppet/provider/package/pkgng.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +10 -0
- data/lib/puppet/provider/service/launchd.rb +1 -0
- data/lib/puppet/provider/user/directoryservice.rb +6 -6
- data/lib/puppet/provider/yumrepo/inifile.rb +1 -1
- data/lib/puppet/provider/zpool/zpool.rb +1 -1
- data/lib/puppet/resource.rb +54 -12
- data/lib/puppet/resource/capability_finder.rb +15 -9
- data/lib/puppet/resource/catalog.rb +25 -6
- data/lib/puppet/resource/type.rb +3 -1
- data/lib/puppet/settings.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +12 -4
- data/lib/puppet/syntax_checkers/base64.rb +41 -0
- data/lib/puppet/syntax_checkers/json.rb +0 -2
- data/lib/puppet/transaction.rb +6 -0
- data/lib/puppet/transaction/additional_resource_generator.rb +5 -0
- data/lib/puppet/transaction/report.rb +7 -2
- data/lib/puppet/type.rb +2 -1
- data/lib/puppet/type/file/checksum.rb +1 -0
- data/lib/puppet/type/file/content.rb +4 -4
- data/lib/puppet/type/mount.rb +44 -0
- data/lib/puppet/type/ssh_authorized_key.rb +1 -1
- data/lib/puppet/type/tidy.rb +3 -0
- data/lib/puppet/type/user.rb +12 -6
- data/lib/puppet/util/log.rb +25 -0
- data/lib/puppet/util/plist.rb +8 -3
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_x.rb +7 -1
- data/spec/integration/application/apply_spec.rb +118 -0
- data/spec/integration/parser/compiler_spec.rb +28 -0
- data/spec/integration/parser/pcore_resource_spec.rb +40 -3
- data/spec/integration/provider/mount_spec.rb +2 -1
- data/spec/integration/util/windows/principal_spec.rb +2 -2
- data/spec/integration/util/windows/registry_spec.rb +4 -4
- data/spec/lib/puppet_spec/compiler.rb +5 -1
- data/spec/lib/puppet_spec/unindent.rb +5 -0
- data/spec/shared_contexts/types_setup.rb +6 -0
- data/spec/shared_examples/rhel_package_provider.rb +16 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/agent_spec.rb +11 -0
- data/spec/unit/application/lookup_spec.rb +94 -3
- data/spec/unit/capability_spec.rb +22 -0
- data/spec/unit/configurer_spec.rb +8 -0
- data/spec/unit/face/epp_face_spec.rb +22 -3
- data/spec/unit/functions/assert_type_spec.rb +3 -3
- data/spec/unit/functions/binary_file_spec.rb +46 -0
- data/spec/unit/functions/break_spec.rb +89 -0
- data/spec/unit/{parser/functions → functions}/contain_spec.rb +68 -3
- data/spec/unit/functions/find_file_spec.rb +69 -0
- data/spec/unit/functions/include_spec.rb +175 -0
- data/spec/unit/functions/logging_spec.rb +54 -0
- data/spec/unit/functions/lookup_spec.rb +3 -3
- data/spec/unit/functions/new_spec.rb +105 -5
- data/spec/unit/functions/next_spec.rb +93 -0
- data/spec/unit/functions/require_spec.rb +83 -0
- data/spec/unit/functions/return_spec.rb +105 -0
- data/spec/unit/{parser/functions → functions}/shared.rb +14 -11
- data/spec/unit/functions/strftime_spec.rb +152 -0
- data/spec/unit/functions4_spec.rb +22 -0
- data/spec/unit/indirector/face_spec.rb +10 -2
- data/spec/unit/network/http/error_spec.rb +1 -2
- data/spec/unit/network/http/handler_spec.rb +6 -5
- data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_spec.rb +1 -1
- data/spec/unit/parser/functions/lookup_spec.rb +1 -1
- data/spec/unit/parser/functions/regsubst_spec.rb +1 -1
- data/spec/unit/parser/functions/split_spec.rb +1 -1
- data/spec/unit/pops/evaluator/access_ops_spec.rb +81 -1
- data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +170 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +29 -4
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +112 -4
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +12 -0
- data/spec/unit/pops/loaders/static_loader_spec.rb +0 -26
- data/spec/unit/pops/lookup/context_spec.rb +149 -0
- data/spec/unit/pops/parser/parse_functions_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_lambda_spec.rb +19 -0
- data/spec/unit/pops/puppet_stack_spec.rb +1 -1
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +74 -0
- data/spec/unit/pops/serialization/packer_spec.rb +34 -14
- data/spec/unit/pops/serialization/serialization_spec.rb +67 -5
- data/spec/unit/pops/time/timespan_spec.rb +121 -0
- data/spec/unit/pops/types/p_binary_type_spec.rb +243 -0
- data/spec/unit/pops/types/p_object_type_spec.rb +7 -7
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +1 -1
- data/spec/unit/pops/types/p_timespan_type_spec.rb +273 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +311 -0
- data/spec/unit/pops/types/p_type_set_type_spec.rb +13 -13
- data/spec/unit/pops/types/ruby_generator_spec.rb +12 -12
- data/spec/unit/pops/types/string_converter_spec.rb +89 -0
- data/spec/unit/pops/types/type_asserter_spec.rb +3 -3
- data/spec/unit/pops/types/type_calculator_spec.rb +113 -5
- data/spec/unit/pops/types/type_formatter_spec.rb +40 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +49 -38
- data/spec/unit/pops/types/type_parser_spec.rb +87 -4
- data/spec/unit/pops/types/types_spec.rb +1 -1
- data/spec/unit/pops/validator/validator_spec.rb +23 -0
- data/spec/unit/provider/mount/parsed_spec.rb +47 -29
- data/spec/unit/provider/package/pkg_spec.rb +109 -99
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -0
- data/spec/unit/provider/user/aix_spec.rb +1 -1
- data/spec/unit/provider/user/directoryservice_spec.rb +101 -30
- data/spec/unit/resource/capability_finder_spec.rb +29 -7
- data/spec/unit/resource/catalog_spec.rb +127 -0
- data/spec/unit/ssl/certificate_request_spec.rb +1 -1
- data/spec/unit/transaction/additional_resource_generator_spec.rb +30 -0
- data/spec/unit/transaction/persistence_spec.rb +1 -6
- data/spec/unit/transaction/report_spec.rb +23 -0
- data/spec/unit/transaction_spec.rb +38 -0
- data/spec/unit/type/mount_spec.rb +5 -0
- data/spec/unit/util/plist_spec.rb +14 -2
- metadata +71 -12
- data/spec/integration/parser/functions/require_spec.rb +0 -43
- data/spec/unit/parser/functions/include_spec.rb +0 -55
- data/spec/unit/parser/functions/require_spec.rb +0 -68
@@ -111,6 +111,16 @@ describe TypeParser do
|
|
111
111
|
expect(the_type_parsed_from(opt_t)).to be_the_type(opt_t)
|
112
112
|
end
|
113
113
|
|
114
|
+
it "parses timespan type" do
|
115
|
+
timespan_t = types.timespan
|
116
|
+
expect(the_type_parsed_from(timespan_t)).to be_the_type(timespan_t)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "parses timestamp type" do
|
120
|
+
timestamp_t = types.timestamp
|
121
|
+
expect(the_type_parsed_from(timestamp_t)).to be_the_type(timestamp_t)
|
122
|
+
end
|
123
|
+
|
114
124
|
it "parses tuple type" do
|
115
125
|
tuple_t = types.tuple([Integer, String])
|
116
126
|
expect(the_type_parsed_from(tuple_t)).to be_the_type(tuple_t)
|
@@ -248,6 +258,38 @@ describe TypeParser do
|
|
248
258
|
expect(parser.parse("Collection[1,2]")).to be_the_type(types.collection(types.range(1,2)))
|
249
259
|
end
|
250
260
|
|
261
|
+
it 'parses a timespan type' do
|
262
|
+
expect(parser.parse("Timespan")).to be_the_type(types.timespan)
|
263
|
+
end
|
264
|
+
|
265
|
+
it 'parses a timespan type with a lower bound' do
|
266
|
+
expect(parser.parse("Timespan[{hours => 3}]")).to be_the_type(types.timespan({'hours' => 3}))
|
267
|
+
end
|
268
|
+
|
269
|
+
it 'parses a timespan type with an upper bound' do
|
270
|
+
expect(parser.parse("Timespan[default, {hours => 9}]")).to be_the_type(types.timespan(nil, {'hours' => 9}))
|
271
|
+
end
|
272
|
+
|
273
|
+
it 'parses a timespan type with both lower and upper bounds' do
|
274
|
+
expect(parser.parse("Timespan[{hours => 3}, {hours => 9}]")).to be_the_type(types.timespan({'hours' => 3}, {'hours' => 9}))
|
275
|
+
end
|
276
|
+
|
277
|
+
it 'parses a timestamp type' do
|
278
|
+
expect(parser.parse("Timestamp")).to be_the_type(types.timestamp)
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'parses a timestamp type with a lower bound' do
|
282
|
+
expect(parser.parse("Timestamp['2014-12-12T13:14:15 CET']")).to be_the_type(types.timestamp('2014-12-12T13:14:15 CET'))
|
283
|
+
end
|
284
|
+
|
285
|
+
it 'parses a timestamp type with an upper bound' do
|
286
|
+
expect(parser.parse("Timestamp[default, '2014-12-12T13:14:15 CET']")).to be_the_type(types.timestamp(nil, '2014-12-12T13:14:15 CET'))
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'parses a timestamp type with both lower and upper bounds' do
|
290
|
+
expect(parser.parse("Timestamp['2014-12-12T13:14:15 CET', '2016-08-23T17:50:00 CET']")).to be_the_type(types.timestamp('2014-12-12T13:14:15 CET', '2016-08-23T17:50:00 CET'))
|
291
|
+
end
|
292
|
+
|
251
293
|
it 'parses a type type' do
|
252
294
|
expect(parser.parse("Type[Integer]")).to be_the_type(types.type_type(types.integer))
|
253
295
|
end
|
@@ -257,25 +299,57 @@ describe TypeParser do
|
|
257
299
|
end
|
258
300
|
|
259
301
|
it 'parses a callable type' do
|
260
|
-
|
302
|
+
t = parser.parse("Callable")
|
303
|
+
expect(t).to be_the_type(types.all_callables())
|
304
|
+
expect(t.return_type).to be_nil
|
261
305
|
end
|
262
306
|
|
263
307
|
it 'parses a parameterized callable type' do
|
264
|
-
|
308
|
+
t = parser.parse("Callable[String, Integer]")
|
309
|
+
expect(t).to be_the_type(types.callable(String, Integer))
|
310
|
+
expect(t.return_type).to be_nil
|
265
311
|
end
|
266
312
|
|
267
313
|
it 'parses a parameterized callable type with min/max' do
|
268
|
-
|
314
|
+
t = parser.parse("Callable[String, Integer, 1, default]")
|
315
|
+
expect(t).to be_the_type(types.callable(String, Integer, 1, :default))
|
316
|
+
expect(t.return_type).to be_nil
|
269
317
|
end
|
270
318
|
|
271
319
|
it 'parses a parameterized callable type with block' do
|
272
|
-
|
320
|
+
t = parser.parse("Callable[String, Callable[Boolean]]")
|
321
|
+
expect(t).to be_the_type(types.callable(String, types.callable(true)))
|
322
|
+
expect(t.return_type).to be_nil
|
323
|
+
end
|
324
|
+
|
325
|
+
it 'parses a callable with no parameters and return type' do
|
326
|
+
expect(parser.parse("Callable[[],Float]")).to be_the_type(types.callable([],Float))
|
327
|
+
end
|
328
|
+
|
329
|
+
it 'parses a parameterized callable type with return type' do
|
330
|
+
expect(parser.parse("Callable[[String, Integer],Float]")).to be_the_type(types.callable([String, Integer],Float))
|
331
|
+
end
|
332
|
+
|
333
|
+
it 'parses a parameterized callable type with min/max and return type' do
|
334
|
+
expect(parser.parse("Callable[[String, Integer, 1, default],Float]")).to be_the_type(types.callable([String, Integer, 1, :default], Float))
|
335
|
+
end
|
336
|
+
|
337
|
+
it 'parses a parameterized callable type with block and return type' do
|
338
|
+
expect(parser.parse("Callable[[String, Callable[Boolean]],Float]")).to be_the_type(types.callable([String, types.callable(true)], Float))
|
273
339
|
end
|
274
340
|
|
275
341
|
it 'parses a parameterized callable type with 0 min/max' do
|
276
342
|
t = parser.parse("Callable[0,0]")
|
277
343
|
expect(t).to be_the_type(types.callable(0,0))
|
278
344
|
expect(t.param_types.types).to be_empty
|
345
|
+
expect(t.return_type).to be_nil
|
346
|
+
end
|
347
|
+
|
348
|
+
it 'parses a parameterized callable type with 0 min/max and return_type' do
|
349
|
+
t = parser.parse("Callable[[0,0],Float]")
|
350
|
+
expect(t).to be_the_type(types.callable([0,0],Float))
|
351
|
+
expect(t.param_types.types).to be_empty
|
352
|
+
expect(t.return_type).to be_the_type(types.float)
|
279
353
|
end
|
280
354
|
|
281
355
|
it 'parses a parameterized callable type with >0 min/max' do
|
@@ -283,6 +357,15 @@ describe TypeParser do
|
|
283
357
|
expect(t).to be_the_type(types.callable(0,1))
|
284
358
|
# Contains a Unit type to indicate "called with what you accept"
|
285
359
|
expect(t.param_types.types[0]).to be_the_type(PUnitType.new())
|
360
|
+
expect(t.return_type).to be_nil
|
361
|
+
end
|
362
|
+
|
363
|
+
it 'parses a parameterized callable type with >0 min/max and a return type' do
|
364
|
+
t = parser.parse("Callable[[0,1],Float]")
|
365
|
+
expect(t).to be_the_type(types.callable([0,1], Float))
|
366
|
+
# Contains a Unit type to indicate "called with what you accept"
|
367
|
+
expect(t.param_types.types[0]).to be_the_type(PUnitType.new())
|
368
|
+
expect(t.return_type).to be_the_type(types.float)
|
286
369
|
end
|
287
370
|
|
288
371
|
it 'parses all known literals' do
|
@@ -440,7 +440,7 @@ describe 'Puppet Type System' do
|
|
440
440
|
type Foo = Variant[Foo,String,Integer]
|
441
441
|
assert_type(Foo, /x/)
|
442
442
|
CODE
|
443
|
-
expect { eval_and_collect_notices(code) }.to raise_error(/
|
443
|
+
expect { eval_and_collect_notices(code) }.to raise_error(/expects a value of type String or Integer, got Regexp/)
|
444
444
|
end
|
445
445
|
|
446
446
|
it 'will handle a scalar correctly in combinations of nested aliased variants' do
|
@@ -440,6 +440,29 @@ describe "validating 4x" do
|
|
440
440
|
end
|
441
441
|
end
|
442
442
|
|
443
|
+
context 'that are functions' do
|
444
|
+
it 'accepts typed parameters' do
|
445
|
+
source = <<-CODE
|
446
|
+
function f(Integer $a) { $a }
|
447
|
+
CODE
|
448
|
+
expect(validate(parse(source))).not_to have_any_issues
|
449
|
+
end
|
450
|
+
|
451
|
+
it 'accepts return types' do
|
452
|
+
source = <<-CODE
|
453
|
+
function f() >> Integer { 42 }
|
454
|
+
CODE
|
455
|
+
expect(validate(parse(source))).not_to have_any_issues
|
456
|
+
end
|
457
|
+
|
458
|
+
it 'accepts block with return types' do
|
459
|
+
source = <<-CODE
|
460
|
+
map([1,2]) |Integer $x| >> Integer { $x + 3 }
|
461
|
+
CODE
|
462
|
+
expect(validate(parse(source))).not_to have_any_issues
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
443
466
|
context 'that are type mappings' do
|
444
467
|
it 'accepts a valid type mapping expression' do
|
445
468
|
source = <<-CODE
|
@@ -115,6 +115,7 @@ FSTAB
|
|
115
115
|
describe "mountinstances" do
|
116
116
|
it "should get name from mountoutput found on Solaris" do
|
117
117
|
Facter.stubs(:value).with(:osfamily).returns 'Solaris'
|
118
|
+
Facter.stubs(:value).with(:kernel).returns 'SunOS'
|
118
119
|
described_class.stubs(:mountcmd).returns(File.read(my_fixture('solaris.mount')))
|
119
120
|
mounts = described_class.mountinstances
|
120
121
|
expect(mounts.size).to eq(6)
|
@@ -128,6 +129,7 @@ FSTAB
|
|
128
129
|
|
129
130
|
it "should get name from mountoutput found on HP-UX" do
|
130
131
|
Facter.stubs(:value).with(:osfamily).returns 'HP-UX'
|
132
|
+
Facter.stubs(:value).with(:kernel).returns 'HP-UX'
|
131
133
|
described_class.stubs(:mountcmd).returns(File.read(my_fixture('hpux.mount')))
|
132
134
|
mounts = described_class.mountinstances
|
133
135
|
expect(mounts.size).to eq(17)
|
@@ -150,32 +152,35 @@ FSTAB
|
|
150
152
|
expect(mounts[16]).to eq({ :name => '/ghost', :mounted => :yes })
|
151
153
|
end
|
152
154
|
|
153
|
-
it "should get name from mountoutput found on Darwin" do
|
155
|
+
it "should get name and mount options from mountoutput found on Darwin" do
|
154
156
|
Facter.stubs(:value).with(:osfamily).returns 'Darwin'
|
157
|
+
Facter.stubs(:value).with(:kernel).returns 'Darwin'
|
155
158
|
described_class.stubs(:mountcmd).returns(File.read(my_fixture('darwin.mount')))
|
156
159
|
mounts = described_class.mountinstances
|
157
160
|
expect(mounts.size).to eq(6)
|
158
|
-
expect(mounts[0]).to eq({ :name => '/', :mounted => :yes })
|
159
|
-
expect(mounts[1]).to eq({ :name => '/dev', :mounted => :yes })
|
160
|
-
expect(mounts[2]).to eq({ :name => '/net', :mounted => :yes })
|
161
|
-
expect(mounts[3]).to eq({ :name => '/home', :mounted => :yes })
|
162
|
-
expect(mounts[4]).to eq({ :name => '/usr', :mounted => :yes })
|
163
|
-
expect(mounts[5]).to eq({ :name => '/ghost', :mounted => :yes })
|
161
|
+
expect(mounts[0]).to eq({ :name => '/', :mounted => :yes, :live_options=>"hfs, local, journaled"})
|
162
|
+
expect(mounts[1]).to eq({ :name => '/dev', :mounted => :yes, :live_options=>"devfs, local, nobrowse"})
|
163
|
+
expect(mounts[2]).to eq({ :name => '/net', :mounted => :yes, :live_options=>"autofs, nosuid, automounted, nobrowse"})
|
164
|
+
expect(mounts[3]).to eq({ :name => '/home', :mounted => :yes, :mounted=>:yes, :live_options=>"autofs, automounted, nobrowse"})
|
165
|
+
expect(mounts[4]).to eq({ :name => '/usr', :mounted => :yes, :mounted=>:yes, :live_options=>"hfs, local, journaled"})
|
166
|
+
expect(mounts[5]).to eq({ :name => '/ghost', :mounted => :yes, :live_options => "hfs, local, journaled"})
|
164
167
|
end
|
165
168
|
|
166
|
-
it "should get name from mountoutput found on Linux" do
|
169
|
+
it "should get name and mount options from mountoutput found on Linux" do
|
167
170
|
Facter.stubs(:value).with(:osfamily).returns 'Gentoo'
|
171
|
+
Facter.stubs(:value).with(:kernel).returns 'Linux'
|
168
172
|
described_class.stubs(:mountcmd).returns(File.read(my_fixture('linux.mount')))
|
169
173
|
mounts = described_class.mountinstances
|
170
|
-
expect(mounts[0]).to eq({ :name => '/', :mounted => :yes })
|
171
|
-
expect(mounts[1]).to eq({ :name => '/lib64/rc/init.d', :mounted => :yes })
|
172
|
-
expect(mounts[2]).to eq({ :name => '/sys', :mounted => :yes })
|
173
|
-
expect(mounts[3]).to eq({ :name => '/usr/portage', :mounted => :yes })
|
174
|
-
expect(mounts[4]).to eq({ :name => '/ghost', :mounted => :yes })
|
174
|
+
expect(mounts[0]).to eq({ :name => '/', :mounted => :yes, :live_options=>"rw,noatime"})
|
175
|
+
expect(mounts[1]).to eq({ :name => '/lib64/rc/init.d', :mounted => :yes, :live_options => "rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755" })
|
176
|
+
expect(mounts[2]).to eq({ :name => '/sys', :mounted => :yes, :live_options => "rw,nosuid,nodev,noexec,relatime"})
|
177
|
+
expect(mounts[3]).to eq({ :name => '/usr/portage', :mounted => :yes, :live_options => "rw" })
|
178
|
+
expect(mounts[4]).to eq({ :name => '/ghost', :mounted => :yes, :live_options => "rw" })
|
175
179
|
end
|
176
180
|
|
177
181
|
it "should get name from mountoutput found on AIX" do
|
178
182
|
Facter.stubs(:value).with(:osfamily).returns 'AIX'
|
183
|
+
Facter.stubs(:value).with(:kernel).returns 'AIX'
|
179
184
|
described_class.stubs(:mountcmd).returns(File.read(my_fixture('aix.mount')))
|
180
185
|
mounts = described_class.mountinstances
|
181
186
|
expect(mounts[0]).to eq({ :name => '/', :mounted => :yes })
|
@@ -224,29 +229,42 @@ FSTAB
|
|
224
229
|
platform != 'solaris' or
|
225
230
|
skip "We need to stub the operatingsystem fact at load time, but can't"
|
226
231
|
end
|
227
|
-
|
228
|
-
# Stub the mount output to our fixture.
|
229
|
-
begin
|
230
|
-
mount = my_fixture(platform + '.mount')
|
231
|
-
described_class.stubs(:mountcmd).returns File.read(mount)
|
232
|
-
rescue
|
233
|
-
skip "is #{platform}.mount missing at this point?"
|
234
|
-
end
|
235
|
-
|
236
|
-
# Note: we have to stub default_target before creating resources
|
237
|
-
# because it is used by Puppet::Type::Mount.new to populate the
|
238
|
-
# :target property.
|
239
|
-
described_class.stubs(:default_target).returns fstab
|
240
|
-
@retrieve = described_class.instances.collect { |prov| {:name => prov.get(:name), :ensure => prov.get(:ensure)}}
|
241
232
|
end
|
242
233
|
|
243
234
|
# Following mountpoint are present in all fstabs/mountoutputs
|
244
235
|
describe "on other platforms than Solaris", :if => Facter.value(:osfamily) != 'Solaris' do
|
245
|
-
|
236
|
+
before :each do
|
237
|
+
# Stub the mount output to our fixture.
|
238
|
+
begin
|
239
|
+
mount = my_fixture(platform + '.mount')
|
240
|
+
described_class.stubs(:mountcmd).returns File.read(mount)
|
241
|
+
rescue
|
242
|
+
skip "is #{platform}.mount missing at this point?"
|
243
|
+
end
|
244
|
+
|
245
|
+
# Note: we have to stub default_target before creating resources
|
246
|
+
# because it is used by Puppet::Type::Mount.new to populate the
|
247
|
+
# :target property.
|
248
|
+
described_class.stubs(:default_target).returns fstab
|
249
|
+
|
250
|
+
platforms = {
|
251
|
+
'linux' => ['Gentoo', 'Linux'],
|
252
|
+
'freebsd' => ['BSD', 'BSD'],
|
253
|
+
'openbsd' => ['BSD', 'BSD'],
|
254
|
+
'netbsd' => ['BSd', 'BSD']
|
255
|
+
}
|
256
|
+
Facter.stubs(:value).with(:osfamily).returns(platforms[platform][0])
|
257
|
+
Facter.stubs(:value).with(:kernel).returns(platforms[platform][1])
|
258
|
+
|
259
|
+
@retrieve = described_class.instances.collect { |prov| {:name => prov.get(:name), :ensure => prov.get(:ensure)}}
|
260
|
+
end
|
261
|
+
|
262
|
+
it "should include mounted resources" do
|
246
263
|
expect(@retrieve).to include(:name => '/', :ensure => :mounted)
|
247
264
|
end
|
248
265
|
|
249
|
-
it "should include
|
266
|
+
it "should include unmounted resources" do
|
267
|
+
@retrieve = described_class.instances.collect { |prov| {:name => prov.get(:name), :ensure => prov.get(:ensure)}}
|
250
268
|
expect(@retrieve).to include(:name => '/boot', :ensure => :unmounted)
|
251
269
|
end
|
252
270
|
|
@@ -201,105 +201,115 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
201
201
|
end
|
202
202
|
|
203
203
|
context ":install" do
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
204
|
+
[
|
205
|
+
{ :osrel => '11.0', :flags => ['--accept'] },
|
206
|
+
{ :osrel => '11.2', :flags => ['--accept', '--sync-actuators-timeout', '900'] },
|
207
|
+
].each do |hash|
|
208
|
+
context "with :operatingsystemrelease #{hash[:osrel]}" do
|
209
|
+
before :each do
|
210
|
+
Facter.stubs(:value).with(:operatingsystemrelease).returns hash[:osrel]
|
211
|
+
end
|
212
|
+
it "should accept all licenses" do
|
213
|
+
provider.expects(:query).with().returns({:ensure => :absent})
|
214
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).returns ''
|
215
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}).returns ''
|
216
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
217
|
+
provider.install
|
218
|
+
end
|
219
|
+
|
220
|
+
it "should install specific version(1)" do
|
221
|
+
# Should install also check if the version installed is the same version we are asked to install? or should we rely on puppet for that?
|
222
|
+
resource[:ensure] = '0.0.7,5.11-0.151006:20131230T130000Z'
|
223
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
224
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
225
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns 'pkg://foo/dummy@0.0.6,5.11-0.151006:20131230T130000Z installed -----'
|
226
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7,5.11-0.151006:20131230T130000Z'], {:failonfail => false, :combine => true}).returns ''
|
227
|
+
provider.install
|
228
|
+
end
|
229
|
+
|
230
|
+
it "should install specific version(2)" do
|
231
|
+
resource[:ensure] = '0.0.8'
|
232
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
233
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns 'pkg://foo/dummy@0.0.7,5.11-0.151006:20131230T130000Z installed -----'
|
234
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.8'], {:failonfail => false, :combine => true}).returns ''
|
235
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
236
|
+
provider.install
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should downgrade to specific version" do
|
240
|
+
resource[:ensure] = '0.0.7'
|
241
|
+
provider.expects(:query).with().returns({:ensure => '0.0.8,5.11-0.151106:20131230T130000Z'})
|
242
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
243
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
244
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
|
245
|
+
provider.install
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should install any if version is not specified" do
|
249
|
+
resource[:ensure] = :present
|
250
|
+
provider.expects(:query).with().returns({:ensure => :absent})
|
251
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).returns ''
|
252
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
253
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
254
|
+
provider.install
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should install if no version was previously installed, and a specific version was requested" do
|
258
|
+
resource[:ensure] = '0.0.7'
|
259
|
+
provider.expects(:query).with().returns({:ensure => :absent})
|
260
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
261
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
|
262
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
263
|
+
provider.install
|
264
|
+
end
|
265
|
+
|
266
|
+
it "installs the latest matching version when given implicit version, and none are installed" do
|
267
|
+
resource[:ensure] = '1.0-0.151006'
|
268
|
+
is = :absent
|
269
|
+
provider.expects(:query).with().returns({:ensure => is})
|
270
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
271
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
272
|
+
provider.expects(:unhold).with()
|
273
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
274
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
275
|
+
provider.insync?(is)
|
276
|
+
provider.install
|
277
|
+
end
|
278
|
+
|
279
|
+
it "updates to the latest matching version when given implicit version" do
|
280
|
+
resource[:ensure] = '1.0-0.151006'
|
281
|
+
is = '1.0,5.11-0.151006:20140219T191204Z'
|
282
|
+
provider.expects(:query).with().returns({:ensure => is})
|
283
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
284
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
285
|
+
provider.expects(:unhold).with()
|
286
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
287
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
288
|
+
provider.insync?(is)
|
289
|
+
provider.install
|
290
|
+
end
|
291
|
+
|
292
|
+
it "issues a warning when an implicit version number is used, and in sync" do
|
293
|
+
resource[:ensure] = '1.0-0.151006'
|
294
|
+
is = '1.0,5.11-0.151006:20140220T084443Z'
|
295
|
+
provider.expects(:warning).with("Implicit version 1.0-0.151006 has 3 possible matches")
|
296
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
297
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
298
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 4
|
299
|
+
provider.insync?(is)
|
300
|
+
end
|
301
|
+
|
302
|
+
it "issues a warning when choosing a version number for an implicit match" do
|
303
|
+
resource[:ensure] = '1.0-0.151006'
|
304
|
+
is = :absent
|
305
|
+
provider.expects(:warning).with("Implicit version 1.0-0.151006 has 3 possible matches")
|
306
|
+
provider.expects(:warning).with("Selecting version '1.0,5.11-0.151006:20140220T084443Z' for implicit '1.0-0.151006'")
|
307
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
308
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
309
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
310
|
+
provider.insync?(is)
|
311
|
+
end
|
312
|
+
end
|
303
313
|
end
|
304
314
|
end
|
305
315
|
|