puppet 4.4.2-x64-mingw32 → 4.5.0-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.
- data/CONTRIBUTING.md +5 -5
- data/Gemfile +2 -2
- data/LICENSE +2 -2
- data/README.md +5 -0
- data/ext/project_data.yaml +2 -0
- data/lib/hiera_puppet.rb +6 -14
- data/lib/puppet/application/agent.rb +2 -3
- data/lib/puppet/data_providers/hiera_config.rb +2 -4
- data/lib/puppet/data_providers/hiera_interpolate.rb +12 -154
- data/lib/puppet/data_providers/json_data_provider_factory.rb +0 -7
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +2 -8
- data/lib/puppet/defaults.rb +70 -7
- data/lib/puppet/functions.rb +69 -0
- data/lib/puppet/functions/dig.rb +39 -0
- data/lib/puppet/functions/lest.rb +53 -0
- data/lib/puppet/functions/lookup.rb +40 -27
- data/lib/puppet/functions/new.rb +502 -0
- data/lib/puppet/functions/regsubst.rb +11 -10
- data/lib/puppet/functions/then.rb +74 -0
- data/lib/puppet/functions/type.rb +4 -4
- data/lib/puppet/functions/with.rb +1 -1
- data/lib/puppet/indirector/catalog/compiler.rb +2 -0
- data/lib/puppet/indirector/resource_type/parser.rb +5 -0
- data/lib/puppet/indirector/rest.rb +5 -1
- data/lib/puppet/loaders.rb +2 -0
- data/lib/puppet/metatype/manager.rb +19 -2
- data/lib/puppet/module_tool/applications/application.rb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/Gemfile +6 -2
- data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +19 -4
- data/lib/puppet/module_tool/skeleton/templates/generator/{tests → examples}/init.pp.erb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +0 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +6 -2
- data/lib/puppet/parser/ast/pops_bridge.rb +20 -3
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +24 -2
- data/lib/puppet/parser/e4_parser_adapter.rb +13 -12
- data/lib/puppet/parser/environment_compiler.rb +2 -2
- data/lib/puppet/parser/resource.rb +14 -5
- data/lib/puppet/parser/scope.rb +18 -15
- data/lib/puppet/plugins/data_providers/data_provider.rb +19 -8
- data/lib/puppet/pops.rb +6 -0
- data/lib/puppet/pops/adapters.rb +5 -1
- data/lib/puppet/pops/evaluator/access_operator.rb +52 -14
- data/lib/puppet/pops/evaluator/compare_operator.rb +34 -4
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +75 -22
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +7 -6
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +13 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +14 -4
- data/lib/puppet/pops/functions/dispatcher.rb +1 -1
- data/lib/puppet/pops/issues.rb +18 -2
- data/lib/puppet/pops/loader/base_loader.rb +48 -7
- data/lib/puppet/pops/loader/dependency_loader.rb +27 -2
- data/lib/puppet/pops/loader/loader.rb +12 -0
- data/lib/puppet/pops/loader/predefined_loader.rb +29 -0
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +57 -0
- data/lib/puppet/pops/loader/static_loader.rb +92 -5
- data/lib/puppet/pops/loader/type_definition_instantiator.rb +25 -3
- data/lib/puppet/pops/loaders.rb +84 -14
- data/lib/puppet/pops/lookup/explainer.rb +38 -1
- data/lib/puppet/pops/lookup/interpolation.rb +115 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +86 -0
- data/lib/puppet/pops/model/ast_transformer.rb +8 -1
- data/lib/puppet/pops/model/factory.rb +31 -8
- data/lib/puppet/pops/model/model.rb +8 -0
- data/lib/puppet/pops/model/model_label_provider.rb +1 -0
- data/lib/puppet/pops/model/model_meta.rb +7 -1
- data/lib/puppet/pops/model/model_tree_dumper.rb +4 -0
- data/lib/puppet/pops/parser/egrammar.ra +24 -7
- data/lib/puppet/pops/parser/eparser.rb +863 -798
- data/lib/puppet/pops/parser/evaluating_parser.rb +4 -0
- data/lib/puppet/pops/parser/locator.rb +8 -4
- data/lib/puppet/pops/pcore.rb +30 -0
- data/lib/puppet/pops/types/class_loader.rb +2 -4
- data/lib/puppet/pops/types/implementation_registry.rb +146 -0
- data/lib/puppet/pops/types/iterable.rb +4 -4
- data/lib/puppet/pops/types/p_object_type.rb +846 -0
- data/lib/puppet/pops/types/p_runtime_type.rb +102 -0
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +164 -0
- data/lib/puppet/pops/types/p_sem_ver_type.rb +113 -0
- data/lib/puppet/pops/types/puppet_object.rb +21 -0
- data/lib/puppet/pops/types/ruby_generator.rb +258 -0
- data/lib/puppet/pops/types/string_converter.rb +922 -0
- data/lib/puppet/pops/types/type_calculator.rb +29 -5
- data/lib/puppet/pops/types/type_conversion_error.rb +15 -0
- data/lib/puppet/pops/types/type_factory.rb +49 -16
- data/lib/puppet/pops/types/type_formatter.rb +335 -112
- data/lib/puppet/pops/types/type_mismatch_describer.rb +110 -29
- data/lib/puppet/pops/types/type_parser.rb +205 -197
- data/lib/puppet/pops/types/types.rb +481 -103
- data/lib/puppet/pops/validation.rb +1 -1
- data/lib/puppet/pops/validation/checker4_0.rb +66 -4
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/pops/visitor.rb +3 -1
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +64 -20
- data/lib/puppet/provider/package/rpm.rb +112 -0
- data/lib/puppet/provider/package/yum.rb +7 -68
- data/lib/puppet/provider/service/daemontools.rb +3 -3
- data/lib/puppet/provider/service/init.rb +4 -2
- data/lib/puppet/provider/service/runit.rb +3 -3
- data/lib/puppet/provider/service/smf.rb +6 -3
- data/lib/puppet/provider/service/systemd.rb +59 -73
- data/lib/puppet/reference/providers.rb +1 -2
- data/lib/puppet/resource.rb +54 -37
- data/lib/puppet/resource/catalog.rb +31 -29
- data/lib/puppet/resource/type_collection.rb +23 -8
- data/lib/puppet/settings.rb +4 -2
- data/lib/puppet/settings/base_setting.rb +9 -3
- data/lib/puppet/settings/symbolic_enum_setting.rb +17 -0
- data/lib/puppet/test/test_helper.rb +0 -1
- data/lib/puppet/type.rb +9 -3
- data/lib/puppet/type/exec.rb +17 -17
- data/lib/puppet/type/file.rb +12 -0
- data/lib/puppet/type/file/content.rb +6 -6
- data/lib/puppet/type/file/ensure.rb +4 -4
- data/lib/puppet/type/file/source.rb +4 -4
- data/lib/puppet/type/file/target.rb +2 -2
- data/lib/puppet/type/mount.rb +18 -1
- data/lib/puppet/type/package.rb +3 -3
- data/lib/puppet/type/schedule.rb +4 -4
- data/lib/puppet/type/service.rb +15 -0
- data/lib/puppet/type/sshkey.rb +5 -3
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/zone.rb +5 -5
- data/lib/puppet/util/feature.rb +1 -1
- data/lib/puppet/util/monkey_patches.rb +8 -0
- data/lib/puppet/util/network_device/cisco/device.rb +16 -6
- data/lib/puppet/util/network_device/cisco/interface.rb +5 -6
- data/lib/puppet/util/plist.rb +3 -3
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +13 -0
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/functions/abc/data.rb +2 -1
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/manifests/init.pp +2 -1
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_json/data/empty_key.json +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_json/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_json/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/data/empty_key.yaml +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_yaml/data/empty.yaml +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/lib/puppet/type/usee_type.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/manifests/init.pp +6 -0
- data/spec/fixtures/unit/provider/service/smf/svcs.out +4 -3
- data/spec/integration/module_tool/tar/mini_spec.rb +27 -27
- data/spec/integration/parser/catalog_spec.rb +14 -2
- data/spec/integration/parser/compiler_spec.rb +94 -3
- data/spec/integration/parser/resource_expressions_spec.rb +1 -1
- data/spec/integration/resource/type_collection_spec.rb +8 -0
- data/spec/lib/puppet_spec/compiler.rb +11 -4
- data/spec/shared_contexts/types_setup.rb +4 -0
- data/spec/unit/application/lookup_spec.rb +91 -9
- data/spec/unit/appmgmt_spec.rb +44 -35
- data/spec/unit/capability_spec.rb +33 -53
- data/spec/unit/data_providers/function_data_provider_spec.rb +19 -1
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +1 -1
- data/spec/unit/defaults_spec.rb +18 -0
- data/spec/unit/functions/assert_type_spec.rb +1 -1
- data/spec/unit/functions/dig_spec.rb +58 -0
- data/spec/unit/functions/lest_spec.rb +34 -0
- data/spec/unit/functions/lookup_spec.rb +108 -2
- data/spec/unit/functions/new_spec.rb +543 -0
- data/spec/unit/functions/regsubst_spec.rb +8 -0
- data/spec/unit/functions/then_spec.rb +40 -0
- data/spec/unit/functions4_spec.rb +78 -10
- data/spec/unit/hiera_puppet_spec.rb +49 -8
- data/spec/unit/indirector/resource_type/parser_spec.rb +5 -0
- data/spec/unit/indirector/rest_spec.rb +12 -0
- data/spec/unit/network/http/api/master/v3/environment_spec.rb +60 -0
- data/spec/unit/node/environment_spec.rb +10 -0
- data/spec/unit/parser/compiler_spec.rb +20 -1
- data/spec/unit/parser/functions/create_resources_spec.rb +2 -2
- data/spec/unit/parser/functions/shared.rb +1 -1
- data/spec/unit/parser/resource_spec.rb +8 -1
- data/spec/unit/parser/scope_spec.rb +45 -0
- data/spec/unit/pops/evaluator/access_ops_spec.rb +14 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +13 -5
- data/spec/unit/pops/loaders/static_loader_spec.rb +92 -1
- data/spec/unit/{data_providers/hiera_interpolation_spec.rb → pops/lookup/interpolation_spec.rb} +7 -5
- data/spec/unit/pops/parser/lexer2_spec.rb +2 -9
- data/spec/unit/pops/parser/parse_application_spec.rb +3 -8
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +3 -10
- data/spec/unit/pops/parser/parse_site_spec.rb +19 -10
- data/spec/unit/pops/parser/parser_rspec_helper.rb +0 -4
- data/spec/unit/pops/types/enumeration_spec.rb +13 -12
- data/spec/unit/pops/types/iterable_spec.rb +2 -2
- data/spec/unit/pops/types/p_object_type_spec.rb +1060 -0
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +285 -0
- data/spec/unit/pops/types/recursion_guard_spec.rb +19 -17
- data/spec/unit/pops/types/ruby_generator_spec.rb +261 -0
- data/spec/unit/pops/types/string_converter_spec.rb +904 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +430 -406
- data/spec/unit/pops/types/type_factory_spec.rb +119 -104
- data/spec/unit/pops/types/type_formatter_spec.rb +73 -6
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +2 -2
- data/spec/unit/pops/types/type_parser_spec.rb +54 -15
- data/spec/unit/pops/types/types_spec.rb +113 -8
- data/spec/unit/pops/validator/validator_spec.rb +84 -10
- data/spec/unit/provider/package/pip3_spec.rb +9 -270
- data/spec/unit/provider/package/pip_spec.rb +85 -30
- data/spec/unit/provider/package/rpm_spec.rb +160 -3
- data/spec/unit/provider/package/yum_spec.rb +23 -134
- data/spec/unit/provider/service/smf_spec.rb +14 -2
- data/spec/unit/provider/service/systemd_spec.rb +33 -41
- data/spec/unit/resource/capability_finder_spec.rb +10 -2
- data/spec/unit/settings/file_setting_spec.rb +6 -0
- data/spec/unit/transaction/additional_resource_generator_spec.rb +80 -65
- data/spec/unit/type/mount_spec.rb +51 -10
- data/spec/unit/type/service_spec.rb +16 -0
- data/spec/unit/type_spec.rb +14 -0
- data/spec/unit/util/feature_spec.rb +1 -1
- data/spec/unit/util/monkey_patches_spec.rb +60 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
- metadata +63 -11
- data/lib/puppet/pops/types/types_meta.rb +0 -0
- data/spec/integration/provider/package_spec.rb +0 -35
data/lib/puppet/type/tidy.rb
CHANGED
@@ -56,10 +56,10 @@ Puppet::Type.newtype(:tidy) do
|
|
56
56
|
|
57
57
|
Example:
|
58
58
|
|
59
|
-
tidy {
|
60
|
-
age =>
|
59
|
+
tidy { '/tmp':
|
60
|
+
age => '1w',
|
61
61
|
recurse => 1,
|
62
|
-
matches => [
|
62
|
+
matches => [ '[0-9]pub*.tmp', '*.temp', 'tmpfile?' ],
|
63
63
|
}
|
64
64
|
|
65
65
|
This removes files from `/tmp` if they are one week old or older,
|
data/lib/puppet/type/zone.rb
CHANGED
@@ -282,11 +282,11 @@ end
|
|
282
282
|
|
283
283
|
And then call that:
|
284
284
|
|
285
|
-
zone { myzone:
|
286
|
-
ip =>
|
287
|
-
sysidcfg => template(
|
288
|
-
path =>
|
289
|
-
realhostname =>
|
285
|
+
zone { 'myzone':
|
286
|
+
ip => 'bge0:192.168.0.23',
|
287
|
+
sysidcfg => template('site/sysidcfg.erb'),
|
288
|
+
path => '/opt/zones/myzone',
|
289
|
+
realhostname => 'fully.qualified.domain.name',
|
290
290
|
}
|
291
291
|
|
292
292
|
The `sysidcfg` only matters on the first booting of the zone,
|
data/lib/puppet/util/feature.rb
CHANGED
@@ -32,7 +32,7 @@ class Puppet::Util::Feature
|
|
32
32
|
# configured to always cache
|
33
33
|
if block_given? ||
|
34
34
|
@results[name] ||
|
35
|
-
(@results.has_key?(name)
|
35
|
+
(@results.has_key?(name) && (Puppet[:always_cache_features] || !Puppet[:always_retry_plugins]))
|
36
36
|
@results[name]
|
37
37
|
else
|
38
38
|
@results[name] = test(name, options)
|
@@ -20,6 +20,14 @@ end
|
|
20
20
|
|
21
21
|
class Symbol
|
22
22
|
def <=> (other)
|
23
|
+
if (other.class != Symbol)
|
24
|
+
case Puppet[:strict]
|
25
|
+
when :warning
|
26
|
+
Puppet.warn_once('deprecation', 'symbol_comparison', 'Comparing Symbols to non-Symbol values is deprecated')
|
27
|
+
when :error
|
28
|
+
raise ArgumentError.new("Comparing Symbols to non-Symbol values is no longer allowed")
|
29
|
+
end
|
30
|
+
end
|
23
31
|
self.to_s <=> other.to_s
|
24
32
|
end
|
25
33
|
|
@@ -47,7 +47,13 @@ class Puppet::Util::NetworkDevice::Cisco::Device < Puppet::Util::NetworkDevice::
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def execute(cmd)
|
50
|
-
transport.command(cmd)
|
50
|
+
transport.command(cmd) do |out|
|
51
|
+
if out =~ /^%/mo or out =~ /^Command rejected:/mo
|
52
|
+
# strip off the command just sent
|
53
|
+
error = out.sub(cmd,'')
|
54
|
+
Puppet.err "Error while executing '#{cmd}', device returned: #{error}"
|
55
|
+
end
|
56
|
+
end
|
51
57
|
end
|
52
58
|
|
53
59
|
def login
|
@@ -209,6 +215,12 @@ class Puppet::Util::NetworkDevice::Cisco::Device < Puppet::Util::NetworkDevice::
|
|
209
215
|
return
|
210
216
|
end
|
211
217
|
|
218
|
+
# Cisco VLANs are supposed to be alphanumeric only
|
219
|
+
if should[:description] =~ /[^\w]/
|
220
|
+
Puppet.err "Invalid VLAN name '#{should[:description]}' for Cisco device.\nVLAN name must be alphanumeric, no spaces or special characters."
|
221
|
+
return
|
222
|
+
end
|
223
|
+
|
212
224
|
# We're creating or updating an entry
|
213
225
|
execute("conf t")
|
214
226
|
execute("vlan #{id}")
|
@@ -250,12 +262,10 @@ class Puppet::Util::NetworkDevice::Cisco::Device < Puppet::Util::NetworkDevice::
|
|
250
262
|
else
|
251
263
|
raise "Unknown switchport encapsulation: #{$1} for #{interface}"
|
252
264
|
end
|
253
|
-
when /^Access Mode VLAN:\s+(.*) \(
|
254
|
-
|
255
|
-
when /^Access Mode VLAN:\s+(.*) \(.*\)$/
|
256
|
-
trunking[:access_vlan] = $1 if trunking[:mode] != :trunk
|
265
|
+
when /^Access Mode VLAN:\s+(.*) \((.*)\)$/
|
266
|
+
trunking[:access_vlan] = $1 if $2 != '(Inactive)'
|
257
267
|
when /^Trunking Native Mode VLAN:\s+(.*) \(.*\)$/
|
258
|
-
trunking[:native_vlan] = $1
|
268
|
+
trunking[:native_vlan] = $1
|
259
269
|
when /^Trunking VLANs Enabled:\s+(.*)$/
|
260
270
|
next if trunking[:mode] == :access
|
261
271
|
vlans = $1
|
@@ -45,11 +45,6 @@ class Puppet::Util::NetworkDevice::Cisco::Interface
|
|
45
45
|
should[:access_vlan] = should[:native_vlan]
|
46
46
|
end
|
47
47
|
|
48
|
-
# Don't change non-operational mode parameters
|
49
|
-
next if property == :access_vlan and should[:mode] == :trunk
|
50
|
-
next if property == :native_vlan and should[:mode] == :access
|
51
|
-
next if property == :encapsulation and should[:mode] == :access
|
52
|
-
|
53
48
|
Puppet.debug("comparing #{property}: #{is[property]} == #{should[property]}")
|
54
49
|
|
55
50
|
# They're equal, so do nothing.
|
@@ -89,7 +84,11 @@ class Puppet::Util::NetworkDevice::Cisco::Interface
|
|
89
84
|
|
90
85
|
def command(command)
|
91
86
|
transport.command(command) do |out|
|
92
|
-
|
87
|
+
if out =~ /^%/mo or out =~ /^Command rejected:/mo
|
88
|
+
# strip off the command just sent
|
89
|
+
error = out.sub(command,'')
|
90
|
+
Puppet.err "Error while executing '#{command}', device returned: #{error}"
|
91
|
+
end
|
93
92
|
end
|
94
93
|
end
|
95
94
|
end
|
data/lib/puppet/util/plist.rb
CHANGED
@@ -115,16 +115,16 @@ module Puppet::Util::Plist
|
|
115
115
|
begin
|
116
116
|
plist_to_save = CFPropertyList::List.new
|
117
117
|
plist_to_save.value = CFPropertyList.guess(plist)
|
118
|
-
plist_to_save.save(file_path, to_format(format))
|
118
|
+
plist_to_save.save(file_path, to_format(format), :formatted => true)
|
119
119
|
rescue IOError => e
|
120
|
-
Puppet.
|
120
|
+
Puppet.err("Unable to write the file #{file_path}. #{e.inspect}")
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
124
|
def dump_plist(plist_data, format = :xml)
|
125
125
|
plist_to_save = CFPropertyList::List.new
|
126
126
|
plist_to_save.value = CFPropertyList.guess(plist_data)
|
127
|
-
plist_to_save.to_str(to_format(format))
|
127
|
+
plist_to_save.to_str(to_format(format), :formatted => true)
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
data/lib/puppet/version.rb
CHANGED
@@ -2,7 +2,8 @@ Puppet::Functions.create_function(:'abc::data') do
|
|
2
2
|
def data()
|
3
3
|
{ 'abc::def::test1' => 'module_test1',
|
4
4
|
'abc::def::test2' => 'module_test2',
|
5
|
-
'abc::def::test3' => 'module_test3'
|
5
|
+
'abc::def::test3' => 'module_test3',
|
6
|
+
'abc::def::ipl' => '%{lookup("abc::def::test2")}-ipl'
|
6
7
|
}
|
7
8
|
end
|
8
9
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{ "empty_key_json::has_undef_value": null }
|
@@ -0,0 +1 @@
|
|
1
|
+
empty_key_yaml::has_undef_value: ~
|
@@ -11,6 +11,12 @@ function puppet_init_calling_ruby() {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
class user {
|
14
|
+
# Dummy resource. Added just to assert that a ruby type in another module is loaded correctly
|
15
|
+
# by the auto loader
|
16
|
+
Usee_type {
|
17
|
+
name => 'pelle'
|
18
|
+
}
|
19
|
+
|
14
20
|
case $::case_number {
|
15
21
|
1: {
|
16
22
|
# Call a puppet function that resides in usee/functions directly from init.pp
|
@@ -1,3 +1,4 @@
|
|
1
|
-
legacy_run
|
2
|
-
online
|
3
|
-
maintenance
|
1
|
+
legacy_run lrc:/etc/rcS_d/S50sk98sol
|
2
|
+
online svc:/system/svc/restarter:default
|
3
|
+
maintenance svc:/network/cswrsyncd:default
|
4
|
+
degraded svc:/network/dns/client:default
|
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'puppet/module_tool'
|
3
|
-
require 'puppet_spec/files'
|
4
|
-
|
5
|
-
describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? && Puppet.features.zlib?) do
|
6
|
-
let(:minitar) { described_class.new }
|
7
|
-
|
8
|
-
describe "Extracts tars with long and short pathnames" do
|
9
|
-
let (:sourcetar) { File.expand_path('../../../../fixtures/module.tar.gz', __FILE__) }
|
10
|
-
|
11
|
-
let (:longfilepath) { "puppetlabs-dsc-1.0.0/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof" }
|
12
|
-
let (:shortfilepath) { "puppetlabs-dsc-1.0.0/README.md" }
|
13
|
-
|
14
|
-
it "unpacks a tar with a short path length" do
|
15
|
-
extractdir = PuppetSpec::Files.tmpdir('minitar')
|
16
|
-
|
17
|
-
minitar.unpack(sourcetar,extractdir,'module')
|
18
|
-
expect(File).to exist(File.expand_path("#{extractdir}/#{shortfilepath}"))
|
19
|
-
end
|
20
|
-
|
21
|
-
it "unpacks a tar with a long path length" do
|
22
|
-
extractdir = PuppetSpec::Files.tmpdir('minitar')
|
23
|
-
|
24
|
-
minitar.unpack(sourcetar,extractdir,'module')
|
25
|
-
expect(File).to exist(File.expand_path("#{extractdir}/#{longfilepath}"))
|
26
|
-
end
|
27
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet/module_tool'
|
3
|
+
require 'puppet_spec/files'
|
4
|
+
|
5
|
+
describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? && Puppet.features.zlib?) do
|
6
|
+
let(:minitar) { described_class.new }
|
7
|
+
|
8
|
+
describe "Extracts tars with long and short pathnames" do
|
9
|
+
let (:sourcetar) { File.expand_path('../../../../fixtures/module.tar.gz', __FILE__) }
|
10
|
+
|
11
|
+
let (:longfilepath) { "puppetlabs-dsc-1.0.0/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof" }
|
12
|
+
let (:shortfilepath) { "puppetlabs-dsc-1.0.0/README.md" }
|
13
|
+
|
14
|
+
it "unpacks a tar with a short path length" do
|
15
|
+
extractdir = PuppetSpec::Files.tmpdir('minitar')
|
16
|
+
|
17
|
+
minitar.unpack(sourcetar,extractdir,'module')
|
18
|
+
expect(File).to exist(File.expand_path("#{extractdir}/#{shortfilepath}"))
|
19
|
+
end
|
20
|
+
|
21
|
+
it "unpacks a tar with a long path length" do
|
22
|
+
extractdir = PuppetSpec::Files.tmpdir('minitar')
|
23
|
+
|
24
|
+
minitar.unpack(sourcetar,extractdir,'module')
|
25
|
+
expect(File).to exist(File.expand_path("#{extractdir}/#{longfilepath}"))
|
26
|
+
end
|
27
|
+
end
|
28
28
|
end
|
@@ -7,6 +7,18 @@ describe "A catalog" do
|
|
7
7
|
include PuppetSpec::Compiler
|
8
8
|
|
9
9
|
context "when compiled" do
|
10
|
+
let(:env) { Puppet::Node::Environment.create(:testing, []) }
|
11
|
+
let(:node) { Puppet::Node.new('test', :environment => env) }
|
12
|
+
let(:loaders) { Puppet::Pops::Loaders.new(env) }
|
13
|
+
|
14
|
+
around :each do |example|
|
15
|
+
Puppet::Parser::Compiler.any_instance.stubs(:loaders).returns(loaders)
|
16
|
+
Puppet.override(:loaders => loaders, :current_environment => env) do
|
17
|
+
example.run
|
18
|
+
Puppet::Pops::Loaders.clear
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
10
22
|
context "when transmitted to the agent" do
|
11
23
|
|
12
24
|
it "preserves the order in which the resources are added to the catalog" do
|
@@ -78,12 +90,12 @@ describe "A catalog" do
|
|
78
90
|
end
|
79
91
|
|
80
92
|
def master_catalog_for(manifest)
|
81
|
-
master_catalog = Puppet::Resource::Catalog::Compiler.new.filter(compile_to_catalog(manifest))
|
93
|
+
master_catalog = Puppet::Resource::Catalog::Compiler.new.filter(compile_to_catalog(manifest, node))
|
82
94
|
end
|
83
95
|
|
84
96
|
def master_and_agent_catalogs_for(manifest)
|
85
97
|
compiler = Puppet::Resource::Catalog::Compiler.new
|
86
|
-
master_catalog = compiler.filter(compile_to_catalog(manifest))
|
98
|
+
master_catalog = compiler.filter(compile_to_catalog(manifest, node))
|
87
99
|
agent_catalog = Puppet::Resource::Catalog.convert_from(:pson, master_catalog.render(:pson))
|
88
100
|
[master_catalog, agent_catalog]
|
89
101
|
end
|
@@ -1048,6 +1048,37 @@ describe Puppet::Parser::Compiler do
|
|
1048
1048
|
end
|
1049
1049
|
end
|
1050
1050
|
|
1051
|
+
it 'assigns multiple variables from a class' do
|
1052
|
+
node = Puppet::Node.new("testnodex")
|
1053
|
+
catalog = compile_to_catalog(<<-PP, node)
|
1054
|
+
class foo::bar::example($x = 100) {
|
1055
|
+
$a = 10
|
1056
|
+
$c = undef
|
1057
|
+
}
|
1058
|
+
include foo::bar::example
|
1059
|
+
|
1060
|
+
[$a, $x, $c] = Class['foo::bar::example']
|
1061
|
+
notify{'check_me': message => "$a, $x, -${c}-" }
|
1062
|
+
PP
|
1063
|
+
expect(catalog).to have_resource("Notify[check_me]").with_parameter(:message, "10, 100, --")
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
it 'errors on attempt to assigns multiple variables from a class when variable does not exist' do
|
1067
|
+
node = Puppet::Node.new("testnodex")
|
1068
|
+
expect do
|
1069
|
+
compile_to_catalog(<<-PP, node)
|
1070
|
+
class foo::bar::example($x = 100) {
|
1071
|
+
$ah = 10
|
1072
|
+
$c = undef
|
1073
|
+
}
|
1074
|
+
include foo::bar::example
|
1075
|
+
|
1076
|
+
[$a, $x, $c] = Class['foo::bar::example']
|
1077
|
+
notify{'check_me': message => "$a, $x, -${c}-" }
|
1078
|
+
PP
|
1079
|
+
end.to raise_error(/No value for required variable '\$foo::bar::example::a'/)
|
1080
|
+
end
|
1081
|
+
|
1051
1082
|
it "should not create duplicate resources when a class is referenced both directly and indirectly by the node classifier (4792)" do
|
1052
1083
|
node = Puppet::Node.new("testnodex")
|
1053
1084
|
node.classes = ['foo', 'bar']
|
@@ -1243,6 +1274,66 @@ describe Puppet::Parser::Compiler do
|
|
1243
1274
|
end
|
1244
1275
|
end
|
1245
1276
|
|
1277
|
+
describe "relationships to non existing resources when strict == :error" do
|
1278
|
+
before(:each) do
|
1279
|
+
Puppet[:strict] = :error
|
1280
|
+
end
|
1281
|
+
|
1282
|
+
[ 'before',
|
1283
|
+
'subscribe',
|
1284
|
+
'notify',
|
1285
|
+
'require'].each do |meta_param|
|
1286
|
+
it "are reported as an error when formed via meta parameter #{meta_param}" do
|
1287
|
+
expect {
|
1288
|
+
compile_to_catalog(<<-PP)
|
1289
|
+
notify{ x : #{meta_param} => Notify[tooth_fairy] }
|
1290
|
+
PP
|
1291
|
+
}.to raise_error(/Could not find resource 'Notify\[tooth_fairy\]' in parameter '#{meta_param}'/)
|
1292
|
+
end
|
1293
|
+
end
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
describe "relationships to non existing resources when strict == :warning" do
|
1297
|
+
before(:each) do
|
1298
|
+
Puppet[:strict] = :warning
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
[ 'before',
|
1302
|
+
'subscribe',
|
1303
|
+
'notify',
|
1304
|
+
'require'].each do |meta_param|
|
1305
|
+
it "are reported as a warning when formed via meta parameter #{meta_param}" do
|
1306
|
+
expect {
|
1307
|
+
compile_to_catalog(<<-PP)
|
1308
|
+
notify{ x : #{meta_param} => Notify[tooth_fairy] }
|
1309
|
+
PP
|
1310
|
+
expect(@logs).to have_matching_log(/Could not find resource 'Notify\[tooth_fairy\]' in parameter '#{meta_param}'/)
|
1311
|
+
|
1312
|
+
}.to_not raise_error()
|
1313
|
+
end
|
1314
|
+
end
|
1315
|
+
end
|
1316
|
+
|
1317
|
+
describe "relationships to non existing resources when strict == :off" do
|
1318
|
+
before(:each) do
|
1319
|
+
Puppet[:strict] = :off
|
1320
|
+
end
|
1321
|
+
|
1322
|
+
[ 'before',
|
1323
|
+
'subscribe',
|
1324
|
+
'notify',
|
1325
|
+
'require'].each do |meta_param|
|
1326
|
+
it "does not log an error for meta parameter #{meta_param}" do
|
1327
|
+
expect {
|
1328
|
+
compile_to_catalog(<<-PP)
|
1329
|
+
notify{ x : #{meta_param} => Notify[tooth_fairy] }
|
1330
|
+
PP
|
1331
|
+
expect(@logs).to_not have_matching_log(/Could not find resource 'Notify\[tooth_fairy\]' in parameter '#{meta_param}'/)
|
1332
|
+
}.to_not raise_error()
|
1333
|
+
end
|
1334
|
+
end
|
1335
|
+
end
|
1336
|
+
|
1246
1337
|
describe "relationships can be formed" do
|
1247
1338
|
def extract_name(ref)
|
1248
1339
|
ref.sub(/File\[(\w+)\]/, '\1')
|
@@ -1488,10 +1579,10 @@ describe Puppet::Parser::Compiler do
|
|
1488
1579
|
|
1489
1580
|
it 'accepts a Resource as a Type' do
|
1490
1581
|
catalog = compile_to_catalog(<<-MANIFEST)
|
1582
|
+
define bar($text) { }
|
1491
1583
|
define foo(Type[Bar] $x) {
|
1492
1584
|
notify { 'test': message => $x[text] }
|
1493
1585
|
}
|
1494
|
-
define bar($text) { }
|
1495
1586
|
bar { 'joke': text => 'knock knock' }
|
1496
1587
|
foo { 'test': x => Bar[joke] }
|
1497
1588
|
MANIFEST
|
@@ -1504,7 +1595,7 @@ describe Puppet::Parser::Compiler do
|
|
1504
1595
|
define foo(Struct[{b => Integer, d=>String}] $a) { }
|
1505
1596
|
foo{ bar: a => {b => 5, c => 'stuff'}}
|
1506
1597
|
MANIFEST
|
1507
|
-
end.to raise_error(/Foo\[bar\]:\s+parameter 'a' expects a value for key 'd'\s+parameter 'a'
|
1598
|
+
end.to raise_error(/Foo\[bar\]:\s+parameter 'a' expects a value for key 'd'\s+parameter 'a' unrecognized key 'c'/m)
|
1508
1599
|
end
|
1509
1600
|
end
|
1510
1601
|
|
@@ -1574,10 +1665,10 @@ describe Puppet::Parser::Compiler do
|
|
1574
1665
|
|
1575
1666
|
it 'accepts a Resource as a Type' do
|
1576
1667
|
catalog = compile_to_catalog(<<-MANIFEST)
|
1668
|
+
define bar($text) { }
|
1577
1669
|
class foo(Type[Bar] $x) {
|
1578
1670
|
notify { 'test': message => $x[text] }
|
1579
1671
|
}
|
1580
|
-
define bar($text) { }
|
1581
1672
|
bar { 'joke': text => 'knock knock' }
|
1582
1673
|
class { 'foo': x => Bar[joke] }
|
1583
1674
|
MANIFEST
|