puppet 6.6.0 → 6.7.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/ext/solaris/smf/puppet.xml +2 -0
- data/ext/yaml_nodes.rb +7 -7
- data/lib/hiera_puppet.rb +2 -1
- data/lib/puppet/application/apply.rb +2 -3
- data/lib/puppet/application/doc.rb +2 -1
- data/lib/puppet/application/face_base.rb +22 -15
- data/lib/puppet/application/script.rb +4 -6
- data/lib/puppet/configurer.rb +10 -5
- data/lib/puppet/confine_collection.rb +2 -1
- data/lib/puppet/daemon.rb +3 -2
- data/lib/puppet/defaults.rb +8 -0
- data/lib/puppet/environments.rb +9 -7
- data/lib/puppet/etc.rb +1 -1
- data/lib/puppet/external/pson/pure/parser.rb +2 -1
- data/lib/puppet/face/epp.rb +4 -2
- data/lib/puppet/face/help.rb +3 -2
- data/lib/puppet/face/module/changes.rb +2 -1
- data/lib/puppet/file_bucket/dipper.rb +2 -1
- data/lib/puppet/file_serving/configuration.rb +2 -1
- data/lib/puppet/file_serving/fileset.rb +1 -1
- data/lib/puppet/file_serving/http_metadata.rb +4 -2
- data/lib/puppet/file_serving/metadata.rb +2 -1
- data/lib/puppet/file_serving/mount/file.rb +2 -1
- data/lib/puppet/file_serving/mount/locales.rb +2 -1
- data/lib/puppet/file_serving/mount/modules.rb +4 -2
- data/lib/puppet/file_serving/mount/pluginfacts.rb +2 -1
- data/lib/puppet/file_serving/mount/plugins.rb +2 -1
- data/lib/puppet/file_serving/mount/tasks.rb +4 -2
- data/lib/puppet/file_system/uniquefile.rb +4 -2
- data/lib/puppet/functions/match.rb +2 -3
- data/lib/puppet/generate/type.rb +2 -1
- data/lib/puppet/graph/relationship_graph.rb +2 -1
- data/lib/puppet/graph/simple_graph.rb +3 -2
- data/lib/puppet/indirector/catalog/compiler.rb +16 -8
- data/lib/puppet/indirector/certificate/rest.rb +2 -1
- data/lib/puppet/indirector/face.rb +2 -2
- data/lib/puppet/indirector/file_server.rb +4 -2
- data/lib/puppet/indirector/indirection.rb +12 -6
- data/lib/puppet/indirector/node/exec.rb +2 -1
- data/lib/puppet/indirector/report/processor.rb +2 -1
- data/lib/puppet/indirector/request.rb +9 -5
- data/lib/puppet/indirector/ssl_file.rb +10 -8
- data/lib/puppet/indirector/terminus.rb +6 -3
- data/lib/puppet/info_service.rb +9 -0
- data/lib/puppet/info_service/plan_information_service.rb +36 -0
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/interface/action.rb +10 -5
- data/lib/puppet/interface/action_manager.rb +2 -1
- data/lib/puppet/interface/documentation.rb +10 -7
- data/lib/puppet/interface/face_collection.rb +6 -3
- data/lib/puppet/interface/option.rb +4 -2
- data/lib/puppet/interface/option_manager.rb +4 -2
- data/lib/puppet/module.rb +35 -1
- data/lib/puppet/module/plan.rb +160 -0
- data/lib/puppet/module_tool.rb +2 -1
- data/lib/puppet/module_tool/applications/application.rb +2 -1
- data/lib/puppet/module_tool/applications/installer.rb +4 -2
- data/lib/puppet/module_tool/applications/upgrader.rb +4 -2
- data/lib/puppet/module_tool/contents_description.rb +2 -1
- data/lib/puppet/module_tool/metadata.rb +2 -3
- data/lib/puppet/module_tool/shared_behaviors.rb +2 -1
- data/lib/puppet/network/authconfig.rb +4 -2
- data/lib/puppet/network/authstore.rb +2 -1
- data/lib/puppet/network/formats.rb +2 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +6 -4
- data/lib/puppet/network/http/handler.rb +2 -1
- data/lib/puppet/network/http/request.rb +2 -1
- data/lib/puppet/network/http/route.rb +2 -1
- data/lib/puppet/network/resolver.rb +3 -2
- data/lib/puppet/network/rights.rb +2 -1
- data/lib/puppet/node.rb +8 -4
- data/lib/puppet/pal/catalog_compiler.rb +8 -1
- data/lib/puppet/pal/compiler.rb +2 -1
- data/lib/puppet/pal/pal_impl.rb +8 -0
- data/lib/puppet/pal/script_compiler.rb +4 -2
- data/lib/puppet/parameter.rb +4 -2
- data/lib/puppet/parameter/value_collection.rb +8 -8
- data/lib/puppet/parser/ast/pops_bridge.rb +2 -1
- data/lib/puppet/parser/compiler.rb +10 -5
- data/lib/puppet/parser/files.rb +2 -1
- data/lib/puppet/parser/functions.rb +2 -1
- data/lib/puppet/parser/relationship.rb +2 -1
- data/lib/puppet/parser/resource.rb +6 -3
- data/lib/puppet/parser/scope.rb +6 -4
- data/lib/puppet/parser/templatewrapper.rb +2 -1
- data/lib/puppet/parser/type_loader.rb +2 -1
- data/lib/puppet/pops/adaptable.rb +2 -5
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +2 -1
- data/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +2 -1
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +8 -4
- data/lib/puppet/pops/loader/base_loader.rb +4 -2
- data/lib/puppet/pops/loader/dependency_loader.rb +4 -2
- data/lib/puppet/pops/loader/gem_support.rb +4 -2
- data/lib/puppet/pops/loader/loader.rb +4 -2
- data/lib/puppet/pops/loader/loader_paths.rb +2 -1
- data/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/lib/puppet/pops/lookup/interpolation.rb +2 -1
- data/lib/puppet/pops/model/factory.rb +4 -2
- data/lib/puppet/pops/parser/epp_support.rb +2 -1
- data/lib/puppet/pops/parser/heredoc_support.rb +2 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +10 -5
- data/lib/puppet/pops/parser/lexer2.rb +6 -3
- data/lib/puppet/pops/parser/locator.rb +2 -1
- data/lib/puppet/pops/types/type_calculator.rb +1 -1
- data/lib/puppet/pops/types/type_parser.rb +4 -2
- data/lib/puppet/pops/validation.rb +2 -1
- data/lib/puppet/pops/validation/checker4_0.rb +6 -3
- data/lib/puppet/pops/visitor.rb +12 -6
- data/lib/puppet/property.rb +19 -16
- data/lib/puppet/property/ensure.rb +2 -1
- data/lib/puppet/property/keyvalue.rb +2 -1
- data/lib/puppet/property/list.rb +2 -1
- data/lib/puppet/provider.rb +10 -8
- data/lib/puppet/provider/exec.rb +7 -4
- data/lib/puppet/provider/file/posix.rb +6 -3
- data/lib/puppet/provider/group/groupadd.rb +2 -1
- data/lib/puppet/provider/group/ldap.rb +7 -4
- data/lib/puppet/provider/group/pw.rb +4 -2
- data/lib/puppet/provider/ldap.rb +8 -4
- data/lib/puppet/provider/nameservice.rb +8 -5
- data/lib/puppet/provider/nameservice/directoryservice.rb +8 -4
- data/lib/puppet/provider/network_device.rb +4 -2
- data/lib/puppet/provider/package.rb +2 -1
- data/lib/puppet/provider/package/aix.rb +4 -2
- data/lib/puppet/provider/package/appdmg.rb +4 -2
- data/lib/puppet/provider/package/apple.rb +2 -1
- data/lib/puppet/provider/package/apt.rb +4 -2
- data/lib/puppet/provider/package/blastwave.rb +2 -1
- data/lib/puppet/provider/package/dpkg.rb +6 -3
- data/lib/puppet/provider/package/fink.rb +2 -1
- data/lib/puppet/provider/package/gem.rb +4 -2
- data/lib/puppet/provider/package/macports.rb +6 -3
- data/lib/puppet/provider/package/nim.rb +8 -4
- data/lib/puppet/provider/package/openbsd.rb +14 -8
- data/lib/puppet/provider/package/opkg.rb +2 -1
- data/lib/puppet/provider/package/pacman.rb +2 -1
- data/lib/puppet/provider/package/pip.rb +2 -1
- data/lib/puppet/provider/package/pkgdmg.rb +4 -2
- data/lib/puppet/provider/package/pkgng.rb +4 -2
- data/lib/puppet/provider/package/pkgutil.rb +2 -1
- data/lib/puppet/provider/package/portupgrade.rb +2 -1
- data/lib/puppet/provider/package/rpm.rb +8 -4
- data/lib/puppet/provider/package/windows/package.rb +2 -1
- data/lib/puppet/provider/parsedfile.rb +14 -7
- data/lib/puppet/provider/service/base.rb +7 -4
- data/lib/puppet/provider/service/launchd.rb +4 -2
- data/lib/puppet/provider/service/service.rb +2 -1
- data/lib/puppet/provider/service/upstart.rb +11 -8
- data/lib/puppet/provider/user/directoryservice.rb +2 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/ldap.rb +8 -4
- data/lib/puppet/provider/user/openbsd.rb +2 -1
- data/lib/puppet/provider/user/pw.rb +2 -1
- data/lib/puppet/provider/user/user_role_add.rb +4 -2
- data/lib/puppet/provider/user/useradd.rb +7 -4
- data/lib/puppet/reference/providers.rb +2 -3
- data/lib/puppet/reference/type.rb +4 -2
- data/lib/puppet/relationship.rb +4 -9
- data/lib/puppet/resource.rb +16 -9
- data/lib/puppet/resource/capability_finder.rb +12 -8
- data/lib/puppet/resource/catalog.rb +36 -40
- data/lib/puppet/resource/type.rb +7 -3
- data/lib/puppet/resource/type_collection.rb +4 -2
- data/lib/puppet/settings.rb +36 -19
- data/lib/puppet/settings/base_setting.rb +2 -1
- data/lib/puppet/settings/config_file.rb +2 -1
- data/lib/puppet/settings/file_setting.rb +2 -1
- data/lib/puppet/settings/ini_file.rb +2 -1
- data/lib/puppet/ssl/base.rb +2 -1
- data/lib/puppet/ssl/host.rb +16 -8
- data/lib/puppet/ssl/key.rb +2 -2
- data/lib/puppet/ssl/state_machine.rb +22 -3
- data/lib/puppet/transaction/event.rb +2 -1
- data/lib/puppet/transaction/event_manager.rb +4 -2
- data/lib/puppet/transaction/report.rb +10 -10
- data/lib/puppet/transaction/resource_harness.rb +4 -2
- data/lib/puppet/type.rb +84 -48
- data/lib/puppet/type/component.rb +2 -1
- data/lib/puppet/type/exec.rb +11 -7
- data/lib/puppet/type/file.rb +15 -9
- data/lib/puppet/type/file/content.rb +7 -3
- data/lib/puppet/type/file/ctime.rb +2 -1
- data/lib/puppet/type/file/data_sync.rb +2 -1
- data/lib/puppet/type/file/ensure.rb +10 -7
- data/lib/puppet/type/file/mode.rb +2 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/file/selcontext.rb +2 -1
- data/lib/puppet/type/file/source.rb +6 -7
- data/lib/puppet/type/file/target.rb +2 -1
- data/lib/puppet/type/file/type.rb +2 -1
- data/lib/puppet/type/package.rb +6 -3
- data/lib/puppet/type/resources.rb +2 -1
- data/lib/puppet/type/service.rb +2 -1
- data/lib/puppet/type/tidy.rb +14 -7
- data/lib/puppet/type/user.rb +19 -7
- data/lib/puppet/util.rb +6 -3
- data/lib/puppet/util/checksums.rb +1 -1
- data/lib/puppet/util/classgen.rb +12 -6
- data/lib/puppet/util/command_line.rb +8 -4
- data/lib/puppet/util/connection.rb +4 -2
- data/lib/puppet/util/diff.rb +4 -2
- data/lib/puppet/util/execution.rb +4 -2
- data/lib/puppet/util/feature.rb +7 -4
- data/lib/puppet/util/fileparsing.rb +57 -46
- data/lib/puppet/util/filetype.rb +2 -1
- data/lib/puppet/util/http_proxy.rb +2 -1
- data/lib/puppet/util/instance_loader.rb +2 -1
- data/lib/puppet/util/ldap/connection.rb +4 -2
- data/lib/puppet/util/ldap/manager.rb +6 -3
- data/lib/puppet/util/log.rb +6 -3
- data/lib/puppet/util/metric.rb +2 -1
- data/lib/puppet/util/posix.rb +4 -2
- data/lib/puppet/util/rdoc/code_objects.rb +2 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +4 -2
- data/lib/puppet/util/selinux.rb +2 -1
- data/lib/puppet/version.rb +2 -5
- data/locales/puppet.pot +713 -685
- data/man/man5/puppet.conf.5 +9 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/lib/puppet_spec/modules.rb +16 -2
- data/spec/unit/indirector/request_spec.rb +5 -6
- data/spec/unit/info_service_spec.rb +48 -0
- data/spec/unit/module_spec.rb +73 -0
- data/spec/unit/plan_spec.rb +65 -0
- data/spec/unit/puppet_pal_catalog_spec.rb +12 -0
- data/spec/unit/ssl/state_machine_spec.rb +68 -5
- metadata +6 -2
@@ -34,7 +34,8 @@ class TypeParser
|
|
34
34
|
#
|
35
35
|
def parse(string, context = nil)
|
36
36
|
# quick "peephole" optimization of common data types
|
37
|
-
|
37
|
+
t = self.class.opt_type_map[string]
|
38
|
+
if t
|
38
39
|
return t
|
39
40
|
end
|
40
41
|
model = @parser.parse_string(string)
|
@@ -276,7 +277,8 @@ class TypeParser
|
|
276
277
|
# @api private
|
277
278
|
def interpret_QualifiedReference(name_ast, context)
|
278
279
|
name = name_ast.value
|
279
|
-
|
280
|
+
found = self.class.type_map[name]
|
281
|
+
if found
|
280
282
|
found
|
281
283
|
else
|
282
284
|
loader = loader_from_context(name_ast, context)
|
@@ -512,7 +512,8 @@ class Checker4_0 < Evaluator::LiteralEvaluator
|
|
512
512
|
end
|
513
513
|
|
514
514
|
def internal_check_no_idem_last(o)
|
515
|
-
|
515
|
+
violator = ends_with_idem(o.body)
|
516
|
+
if violator
|
516
517
|
acceptor.accept(Issues::IDEM_NOT_ALLOWED_LAST, violator, {:container => o}) unless resource_without_title?(violator)
|
517
518
|
end
|
518
519
|
end
|
@@ -731,7 +732,8 @@ class Checker4_0 < Evaluator::LiteralEvaluator
|
|
731
732
|
# Check that hostnames are valid hostnames (or regular expressions)
|
732
733
|
hostname(o.host_matches, o)
|
733
734
|
top(o)
|
734
|
-
|
735
|
+
violator = ends_with_idem(o.body)
|
736
|
+
if violator
|
735
737
|
acceptor.accept(Issues::IDEM_NOT_ALLOWED_LAST, violator, {:container => o}) unless resource_without_title?(violator)
|
736
738
|
end
|
737
739
|
unless o.parent.nil?
|
@@ -917,7 +919,8 @@ class Checker4_0 < Evaluator::LiteralEvaluator
|
|
917
919
|
|
918
920
|
def hostname_ConcatenatedString(o, semantic)
|
919
921
|
# Puppet 3.1. only accepts a concatenated string without interpolated expressions
|
920
|
-
|
922
|
+
the_expr = o.segments.index {|s| s.is_a?(Model::TextExpression) }
|
923
|
+
if the_expr
|
921
924
|
acceptor.accept(Issues::ILLEGAL_HOSTNAME_INTERPOLATION, o.segments[the_expr].expr)
|
922
925
|
elsif o.segments.size() != 1
|
923
926
|
# corner case, bad model, concatenation of several plain strings
|
data/lib/puppet/pops/visitor.rb
CHANGED
@@ -36,7 +36,8 @@ class Visitor
|
|
36
36
|
if @max_args
|
37
37
|
raise "Visitor Error: Too many arguments passed. max = #{@max_args}" unless args.length <= @max_args
|
38
38
|
end
|
39
|
-
|
39
|
+
method_name = @cache[thing.class]
|
40
|
+
if method_name
|
40
41
|
return receiver.send(method_name, thing, *args)
|
41
42
|
else
|
42
43
|
thing.class.ancestors().each do |ancestor|
|
@@ -57,7 +58,8 @@ class Visitor
|
|
57
58
|
if @max_args
|
58
59
|
raise "Visitor Error: Too many arguments passed. max = #{@max_args}" unless args.length <= @max_args
|
59
60
|
end
|
60
|
-
|
61
|
+
method_name = @cache[clazz]
|
62
|
+
if method_name
|
61
63
|
return receiver.send(method_name, clazz, *args)
|
62
64
|
else
|
63
65
|
clazz.ancestors().each do |ancestor|
|
@@ -76,7 +78,8 @@ class Visitor
|
|
76
78
|
# (This is ~30% faster than calling the general method)
|
77
79
|
#
|
78
80
|
def visit_this_0(receiver, thing)
|
79
|
-
|
81
|
+
method_name = @cache[thing.class]
|
82
|
+
if method_name
|
80
83
|
return receiver.send(method_name, thing)
|
81
84
|
end
|
82
85
|
visit_this(receiver, thing, NO_ARGS)
|
@@ -86,7 +89,8 @@ class Visitor
|
|
86
89
|
# (This is ~30% faster than calling the general method)
|
87
90
|
#
|
88
91
|
def visit_this_1(receiver, thing, arg)
|
89
|
-
|
92
|
+
method_name = @cache[thing.class]
|
93
|
+
if method_name
|
90
94
|
return receiver.send(method_name, thing, arg)
|
91
95
|
end
|
92
96
|
visit_this(receiver, thing, [arg])
|
@@ -96,7 +100,8 @@ class Visitor
|
|
96
100
|
# (This is ~30% faster than calling the general method)
|
97
101
|
#
|
98
102
|
def visit_this_2(receiver, thing, arg1, arg2)
|
99
|
-
|
103
|
+
method_name = @cache[thing.class]
|
104
|
+
if method_name
|
100
105
|
return receiver.send(method_name, thing, arg1, arg2)
|
101
106
|
end
|
102
107
|
visit_this(receiver, thing, [arg1, arg2])
|
@@ -106,7 +111,8 @@ class Visitor
|
|
106
111
|
# (This is ~30% faster than calling the general method)
|
107
112
|
#
|
108
113
|
def visit_this_3(receiver, thing, arg1, arg2, arg3)
|
109
|
-
|
114
|
+
method_name = @cache[thing.class]
|
115
|
+
if method_name
|
110
116
|
return receiver.send(method_name, thing, arg1, arg2, arg3)
|
111
117
|
end
|
112
118
|
visit_this(receiver, thing, [arg1, arg2, arg3])
|
data/lib/puppet/property.rb
CHANGED
@@ -123,9 +123,8 @@ class Puppet::Property < Puppet::Parameter
|
|
123
123
|
# @api private
|
124
124
|
#
|
125
125
|
def self.value_name(name)
|
126
|
-
|
127
|
-
|
128
|
-
end
|
126
|
+
value = value_collection.match?(name)
|
127
|
+
value.name if value
|
129
128
|
end
|
130
129
|
|
131
130
|
# Returns the value of the given option (set when a valid value with the given "name" was defined).
|
@@ -137,9 +136,8 @@ class Puppet::Property < Puppet::Parameter
|
|
137
136
|
# @api private
|
138
137
|
#
|
139
138
|
def self.value_option(name, option)
|
140
|
-
|
141
|
-
|
142
|
-
end
|
139
|
+
value = value_collection.value(name)
|
140
|
+
value.send(option) if value
|
143
141
|
end
|
144
142
|
|
145
143
|
# Defines a new valid value for this property.
|
@@ -255,9 +253,9 @@ class Puppet::Property < Puppet::Parameter
|
|
255
253
|
# @see Puppet::Type#event
|
256
254
|
def event(options = {})
|
257
255
|
attrs = { :name => event_name, :desired_value => should, :property => self, :source_description => path }.merge(options)
|
258
|
-
|
259
|
-
|
260
|
-
|
256
|
+
value = self.class.value_collection.match?(should) if should
|
257
|
+
|
258
|
+
attrs[:invalidate_refreshes] = true if value && value.invalidate_refreshes
|
261
259
|
attrs[:redacted] = @sensitive
|
262
260
|
resource.event attrs
|
263
261
|
end
|
@@ -486,7 +484,8 @@ class Puppet::Property < Puppet::Parameter
|
|
486
484
|
def set(value)
|
487
485
|
# Set a name for looking up associated options like the event.
|
488
486
|
name = self.class.value_name(value)
|
489
|
-
|
487
|
+
method = self.class.value_option(name, :method)
|
488
|
+
if method && self.respond_to?(method)
|
490
489
|
begin
|
491
490
|
self.send(method)
|
492
491
|
rescue Puppet::Error
|
@@ -498,12 +497,15 @@ class Puppet::Property < Puppet::Parameter
|
|
498
497
|
Puppet.log_exception(detail, error.message)
|
499
498
|
raise error
|
500
499
|
end
|
501
|
-
elsif block = self.class.value_option(name, :block)
|
502
|
-
# FIXME It'd be better here to define a method, so that
|
503
|
-
# the blocks could return values.
|
504
|
-
self.instance_eval(&block)
|
505
500
|
else
|
506
|
-
|
501
|
+
block = self.class.value_option(name, :block)
|
502
|
+
if block
|
503
|
+
# FIXME It'd be better here to define a method, so that
|
504
|
+
# the blocks could return values.
|
505
|
+
self.instance_eval(&block)
|
506
|
+
else
|
507
|
+
call_provider(value)
|
508
|
+
end
|
507
509
|
end
|
508
510
|
end
|
509
511
|
|
@@ -585,7 +587,8 @@ class Puppet::Property < Puppet::Parameter
|
|
585
587
|
# @api private
|
586
588
|
#
|
587
589
|
def validate_features_per_value(value)
|
588
|
-
|
590
|
+
features = self.class.value_option(self.class.value_name(value), :required_features)
|
591
|
+
if features
|
589
592
|
features = Array(features)
|
590
593
|
needed_features = features.collect { |f| f.to_s }.join(", ")
|
591
594
|
unless provider.satisfies?(features)
|
@@ -77,7 +77,8 @@ class Puppet::Property::Ensure < Puppet::Property
|
|
77
77
|
# to get checked, which means that those other properties do not have
|
78
78
|
# @is values set. This seems to be the source of quite a few bugs,
|
79
79
|
# although they're mostly logging bugs, not functional ones.
|
80
|
-
|
80
|
+
prov = @resource.provider
|
81
|
+
if prov && prov.respond_to?(:exists?)
|
81
82
|
result = prov.exists?
|
82
83
|
elsif @resource.respond_to?(:exists?)
|
83
84
|
result = @resource.exists?
|
@@ -107,7 +107,8 @@ module Puppet
|
|
107
107
|
#
|
108
108
|
def retrieve
|
109
109
|
#ok, some 'convention' if the keyvalue property is named properties, provider should implement a properties method
|
110
|
-
|
110
|
+
key_hash = provider.send(name) if provider
|
111
|
+
if key_hash && key_hash != :absent
|
111
112
|
return key_hash
|
112
113
|
else
|
113
114
|
return :absent
|
data/lib/puppet/property/list.rb
CHANGED
@@ -45,7 +45,8 @@ module Puppet
|
|
45
45
|
|
46
46
|
def retrieve
|
47
47
|
#ok, some 'convention' if the list property is named groups, provider should implement a groups method
|
48
|
-
|
48
|
+
tmp = provider.send(name) if provider
|
49
|
+
if tmp && tmp != :absent
|
49
50
|
return tmp.split(delimiter)
|
50
51
|
else
|
51
52
|
return :absent
|
data/lib/puppet/provider.rb
CHANGED
@@ -138,11 +138,10 @@ class Puppet::Provider
|
|
138
138
|
def self.command(name)
|
139
139
|
name = name.intern
|
140
140
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
else
|
141
|
+
command = @commands[name] if defined?(@commands)
|
142
|
+
command = superclass.command(name) if !command && superclass.respond_to?(:command)
|
143
|
+
|
144
|
+
unless command
|
146
145
|
raise Puppet::DevError, _("No command %{command} defined for provider %{provider}") % { command: name, provider: self.name }
|
147
146
|
end
|
148
147
|
|
@@ -466,11 +465,13 @@ class Puppet::Provider
|
|
466
465
|
if param.is_a?(Class)
|
467
466
|
klass = param
|
468
467
|
else
|
469
|
-
|
468
|
+
klass = resource_type.attrclass(param)
|
469
|
+
unless klass
|
470
470
|
raise Puppet::DevError, _("'%{parameter_name}' is not a valid parameter for %{resource_type}") % { parameter_name: param, resource_type: resource_type.name }
|
471
471
|
end
|
472
472
|
end
|
473
|
-
|
473
|
+
features = klass.required_features
|
474
|
+
return true unless features
|
474
475
|
|
475
476
|
!!satisfies?(*features)
|
476
477
|
end
|
@@ -546,7 +547,8 @@ class Puppet::Provider
|
|
546
547
|
# @raise [Puppet::DevError] if no resource is set, or no name defined.
|
547
548
|
#
|
548
549
|
def name
|
549
|
-
|
550
|
+
n = @property_hash[:name]
|
551
|
+
if n
|
550
552
|
return n
|
551
553
|
elsif self.resource
|
552
554
|
resource.name
|
data/lib/puppet/provider/exec.rb
CHANGED
@@ -82,11 +82,14 @@ class Puppet::Provider::Exec < Puppet::Provider
|
|
82
82
|
def extractexe(command)
|
83
83
|
if command.is_a? Array
|
84
84
|
command.first
|
85
|
-
elsif match = /^"([^"]+)"|^'([^']+)'/.match(command)
|
86
|
-
# extract whichever of the two sides matched the content.
|
87
|
-
match[1] or match[2]
|
88
85
|
else
|
89
|
-
|
86
|
+
match = /^"([^"]+)"|^'([^']+)'/.match(command)
|
87
|
+
if match
|
88
|
+
# extract whichever of the two sides matched the content.
|
89
|
+
match[1] or match[2]
|
90
|
+
else
|
91
|
+
command.split(/ /)[0]
|
92
|
+
end
|
90
93
|
end
|
91
94
|
end
|
92
95
|
|
@@ -53,7 +53,8 @@ Puppet::Type.type(:file).provide :posix do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def owner
|
56
|
-
|
56
|
+
stat = resource.stat
|
57
|
+
unless stat
|
57
58
|
return :absent
|
58
59
|
end
|
59
60
|
|
@@ -86,7 +87,8 @@ Puppet::Type.type(:file).provide :posix do
|
|
86
87
|
end
|
87
88
|
|
88
89
|
def group
|
89
|
-
|
90
|
+
stat = resource.stat
|
91
|
+
return :absent unless stat
|
90
92
|
|
91
93
|
currentvalue = stat.gid
|
92
94
|
|
@@ -117,7 +119,8 @@ Puppet::Type.type(:file).provide :posix do
|
|
117
119
|
end
|
118
120
|
|
119
121
|
def mode
|
120
|
-
|
122
|
+
stat = resource.stat
|
123
|
+
if stat
|
121
124
|
return (stat.mode & 007777).to_s(8).rjust(4, '0')
|
122
125
|
else
|
123
126
|
return :absent
|
@@ -24,9 +24,11 @@ Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do
|
|
24
24
|
provider = self
|
25
25
|
manager.generates(:gidNumber).with do
|
26
26
|
largest = 500
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
existing = provider.manager.search
|
28
|
+
if existing
|
29
|
+
existing.each do |hash|
|
30
|
+
value = hash[:gid]
|
31
|
+
next unless value
|
30
32
|
num = value[0].to_i
|
31
33
|
largest = num if num > largest
|
32
34
|
end
|
@@ -36,7 +38,8 @@ Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do
|
|
36
38
|
|
37
39
|
# Convert a group name to an id.
|
38
40
|
def self.name2id(group)
|
39
|
-
|
41
|
+
result = manager.search("cn=#{group}")
|
42
|
+
return nil unless result and result.length > 0
|
40
43
|
|
41
44
|
# Only use the first result.
|
42
45
|
group = result[0]
|
@@ -18,13 +18,15 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService:
|
|
18
18
|
def addcmd
|
19
19
|
cmd = [command(:pw), "groupadd", @resource[:name]]
|
20
20
|
|
21
|
-
|
21
|
+
gid = @resource.should(:gid)
|
22
|
+
if gid
|
22
23
|
unless gid == :absent
|
23
24
|
cmd << flag(:gid) << gid
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
|
-
|
28
|
+
members = @resource.should(:members)
|
29
|
+
if members
|
28
30
|
unless members == :absent
|
29
31
|
if members.is_a?(Array)
|
30
32
|
members = members.join(",")
|
data/lib/puppet/provider/ldap.rb
CHANGED
@@ -10,7 +10,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
|
|
10
10
|
|
11
11
|
# Look up all instances at our location. Yay.
|
12
12
|
def self.instances
|
13
|
-
|
13
|
+
list = manager.search
|
14
|
+
return [] unless list
|
14
15
|
|
15
16
|
list.collect { |entry| new(entry) }
|
16
17
|
end
|
@@ -29,7 +30,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
|
|
29
30
|
# Query all of our resources from ldap.
|
30
31
|
def self.prefetch(resources)
|
31
32
|
resources.each do |name, resource|
|
32
|
-
|
33
|
+
result = manager.find(name)
|
34
|
+
if result
|
33
35
|
result[:ensure] = :present
|
34
36
|
resource.provider = new(result)
|
35
37
|
else
|
@@ -45,7 +47,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
|
|
45
47
|
def create
|
46
48
|
@property_hash[:ensure] = :present
|
47
49
|
self.class.resource_type.validproperties.each do |property|
|
48
|
-
|
50
|
+
val = resource.should(property)
|
51
|
+
if val
|
49
52
|
if property.to_s == 'gid'
|
50
53
|
self.gid = val
|
51
54
|
else
|
@@ -126,7 +129,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
|
|
126
129
|
# LAK:NOTE This is normally not used, because we rely on prefetching.
|
127
130
|
def query
|
128
131
|
# Use the module function.
|
129
|
-
|
132
|
+
attributes = manager.find(name)
|
133
|
+
unless attributes
|
130
134
|
@ldap_properties = {}
|
131
135
|
return nil
|
132
136
|
end
|
@@ -26,7 +26,7 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
26
26
|
objects = []
|
27
27
|
begin
|
28
28
|
method = Puppet::Etc.method(:"get#{section}ent")
|
29
|
-
while ent = method.call
|
29
|
+
while ent = method.call #rubocop:disable Lint/AssignmentInCondition
|
30
30
|
objects << new(:name => ent.name, :canonical_name => ent.canonical_name, :ensure => :present)
|
31
31
|
end
|
32
32
|
ensure
|
@@ -61,7 +61,7 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
61
61
|
names = []
|
62
62
|
Puppet::Etc.send("set#{section()}ent")
|
63
63
|
begin
|
64
|
-
while ent = Puppet::Etc.send("get#{section()}ent")
|
64
|
+
while ent = Puppet::Etc.send("get#{section()}ent") #rubocop:disable Lint/AssignmentInCondition
|
65
65
|
names << ent.name
|
66
66
|
yield ent.name if block_given?
|
67
67
|
end
|
@@ -124,7 +124,8 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
124
124
|
if id_generators[@resource.class.name] == field
|
125
125
|
return self.class.autogen_id(field, @resource.class.name)
|
126
126
|
else
|
127
|
-
|
127
|
+
value = self.class.autogen_default(field)
|
128
|
+
if value
|
128
129
|
return value
|
129
130
|
elsif respond_to?("autogen_#{field}")
|
130
131
|
return send("autogen_#{field}")
|
@@ -214,7 +215,8 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
214
215
|
end
|
215
216
|
|
216
217
|
def munge(name, value)
|
217
|
-
|
218
|
+
block = self.class.option(name, :munge)
|
219
|
+
if block and block.is_a? Proc
|
218
220
|
block.call(value)
|
219
221
|
else
|
220
222
|
value
|
@@ -222,7 +224,8 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
222
224
|
end
|
223
225
|
|
224
226
|
def unmunge(name, value)
|
225
|
-
|
227
|
+
block = self.class.option(name, :unmunge)
|
228
|
+
if block and block.is_a? Proc
|
226
229
|
block.call(value)
|
227
230
|
else
|
228
231
|
value
|